-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
461 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { SET_LAST_LOCATION } from '../types' | ||
|
||
export let setLastLocation = props => dispatch => { | ||
dispatch({ type: SET_LAST_LOCATION, payload: props.location.pathname }) | ||
export let setLastLocation = (path, search) => dispatch => { | ||
dispatch({ type: SET_LAST_LOCATION, payload: { path, search } }) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export default { | ||
status: 200, | ||
data: { | ||
redirect_url: 'https://www.sandbox.paypal.com/cgi-bin/webscr' | ||
} | ||
} | ||
|
||
export const executedBillingAgreementResponse = { data: { message: 'Success' } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,31 @@ | ||
export default [ | ||
{ | ||
id: 2, | ||
email: 'premium@premi.um', | ||
created_at: '2019-01-09T23:29:28.825Z', | ||
updated_at: '2019-01-11T14:39:33.221Z', | ||
first_name: 'Retha', | ||
last_name: 'Dietrich', | ||
display_email: null, | ||
youtube_id: null, | ||
slug: 'retha-dietrich', | ||
display_profile: true, | ||
latitude: null, | ||
longitude: null, | ||
country_name: 'Falkland Islands (malvinas)', | ||
city: null, | ||
region: null, | ||
youtube_user_name: null, | ||
github_profile_url: null, | ||
display_hire_me: null, | ||
bio: null, | ||
receive_mailings: false, | ||
country_code: 'FK', | ||
timezone_offset: null, | ||
status_count: 0, | ||
deleted_at: null, | ||
event_participation_count: 0, | ||
can_see_dashboard: false, | ||
skill_list: [], | ||
title_list: [] | ||
} | ||
] | ||
export default | ||
{ | ||
id: 2, | ||
email: 'premium@premi.um', | ||
created_at: '2019-01-09T23:29:28.825Z', | ||
updated_at: '2019-01-11T14:39:33.221Z', | ||
first_name: 'Retha', | ||
last_name: 'Dietrich', | ||
display_email: null, | ||
youtube_id: null, | ||
slug: 'retha-dietrich', | ||
display_profile: true, | ||
latitude: null, | ||
longitude: null, | ||
country_name: 'Falkland Islands (malvinas)', | ||
city: null, | ||
region: null, | ||
youtube_user_name: null, | ||
github_profile_url: null, | ||
display_hire_me: null, | ||
bio: null, | ||
receive_mailings: false, | ||
country_code: 'FK', | ||
timezone_offset: null, | ||
status_count: 0, | ||
deleted_at: null, | ||
event_participation_count: 0, | ||
can_see_dashboard: false, | ||
skill_list: [], | ||
title_list: [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,17 @@ | ||
import axios from 'axios' | ||
|
||
export default cookies => async event => { | ||
export default cookies => event => { | ||
event.preventDefault() | ||
try { | ||
let response = await axios({ | ||
method: 'POST', | ||
timeout: 50000, | ||
url: '/paypal/new.json', | ||
data: { | ||
plan: 1 | ||
}, | ||
headers: { | ||
Authorization: cookies.get('_WebsiteOne_session') | ||
} | ||
}) | ||
if (response.status === 200) { | ||
window.location.assign(response.data.redirect_url) | ||
return axios({ | ||
method: 'POST', | ||
timeout: 50000, | ||
url: '/paypal/new.json', | ||
data: { | ||
plan: 1 | ||
}, | ||
headers: { | ||
Authorization: cookies.get('_WebsiteOne_session') | ||
} | ||
return response.data | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
}) | ||
.then(response => window.location.assign(response.data.redirect_url)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
import axios from 'axios' | ||
|
||
export default async (props, params) => { | ||
try { | ||
let response = await axios({ | ||
method: 'GET', | ||
timeout: 50000, | ||
url: '/paypal/create.json', | ||
params: { | ||
plan: params.plan, | ||
token: params.token | ||
}, | ||
headers: { | ||
Authorization: props.cookies.get('_WebsiteOne_session') | ||
} | ||
}) | ||
if (response.status === 200) { | ||
// test for status you want, etc | ||
console.log(response) | ||
export default (props, params) => { | ||
return axios({ | ||
method: 'GET', | ||
timeout: 50000, | ||
url: '/paypal/create.json', | ||
params: { | ||
plan: params.plan, | ||
token: params.token | ||
}, | ||
headers: { | ||
Authorization: props.cookies.get('_WebsiteOne_session') | ||
} | ||
// Don't forget to return something | ||
} catch (err) { | ||
console.log(err) | ||
} | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
import { shallow } from 'enzyme' | ||
import PayPalAgreementNew from '../../components/PayPalAgreementNew' | ||
|
||
describe('PayPalAgreementNew', () => { | ||
let wrapper | ||
const props = { | ||
cookies: () => {}, | ||
createBillingAgreement: jest.fn() | ||
} | ||
beforeEach(() => { | ||
wrapper = shallow(<PayPalAgreementNew {...props} />) | ||
}) | ||
|
||
it('has a form to submit a new paypal agreement', () => { | ||
wrapper.find('form').simulate('submit') | ||
expect(props.createBillingAgreement).toHaveBeenCalled() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import { PayPalSuccess } from '../../components/PayPalSuccess' | ||
|
||
describe('PayPalSuccess', () => { | ||
let wrapper | ||
const props = { | ||
cookies: { get: () => {} }, | ||
location: { search: '?plan=premium' } | ||
} | ||
beforeEach(() => { | ||
wrapper = mount(<PayPalSuccess {...props} />) | ||
}) | ||
|
||
it('renders a success segment', () => { | ||
wrapper.setProps({ location: { search: '?plan=premiummob' } }) | ||
expect(wrapper.find('Segment')).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import React from 'react' | ||
import { mount } from 'enzyme' | ||
import { Subscriptions } from '../../components/Subscriptions' | ||
|
||
describe('Subscriptions', () => { | ||
let wrapper | ||
const props = { | ||
cookies: { get: () => {} }, | ||
setLastLocation: jest.fn(), | ||
location: { pathname: 'subscriptions/new', search: '?plan=premium' }, | ||
history: { push: jest.fn() }, | ||
loggedInUser: { data: {} } | ||
} | ||
|
||
beforeEach(() => { | ||
wrapper = mount(<Subscriptions {...props} />) | ||
}) | ||
|
||
it('should render PayPalAgreementNew', () => { | ||
expect(wrapper.find('PayPalAgreementNew')).toBeTruthy() | ||
}) | ||
|
||
it('should call setLastLocation', () => { | ||
expect(props.setLastLocation).toHaveBeenCalledTimes(1) | ||
}) | ||
}) |
Oops, something went wrong.