Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
74 add spinner to create billing agreement (#86)
* Add spinner to Subscriptions component * Handle errors in create/execute billing agreement * Extract types, get tests passing - create billing agreement failure - execute billing agreement failure
- Loading branch information
1 parent
6195d5d
commit 9655ac8
Showing
20 changed files
with
451 additions
and
180 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import axios from 'axios' | ||
import { CREATE_BILLING_AGREEMENT_FAILURE } from '../types' | ||
|
||
export default (cookies, id, dispatch) => event => { | ||
event.preventDefault() | ||
return axios({ | ||
method: 'POST', | ||
timeout: 30000, | ||
url: '/paypal/new.json', | ||
data: { | ||
plan: id | ||
}, | ||
headers: { | ||
Authorization: cookies.get('_WebsiteOne_session') | ||
} | ||
}) | ||
.then(response => window.location.assign(response.data.redirect_url)) | ||
.catch(error => { | ||
dispatch({ | ||
type: CREATE_BILLING_AGREEMENT_FAILURE, | ||
message: error.message | ||
}) | ||
}) | ||
} |
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,23 @@ | ||
import axios from 'axios' | ||
import { EXECUTE_BILLING_AGREEMENT_FAILURE } from '../types' | ||
|
||
export default (cookies, params, dispatch) => { | ||
return axios({ | ||
method: 'GET', | ||
timeout: 20000, | ||
url: '/paypal/create', | ||
params: { | ||
plan: params.plan, | ||
token: params.token | ||
}, | ||
headers: { | ||
Authorization: cookies.get('_WebsiteOne_session') | ||
} | ||
}) | ||
.catch(error => { | ||
dispatch({ | ||
type: EXECUTE_BILLING_AGREEMENT_FAILURE, | ||
message: error.message | ||
}) | ||
}) | ||
} |
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,12 @@ | ||
export default (props, queryString) => { | ||
let info | ||
let plan = queryString.parse(props.location.search).plan | ||
if (plan === 'premiummob') { | ||
info = { id: 2, name: 'Premium Mob', price: '£25.00' } | ||
} else if (plan === 'premiumf2f') { | ||
info = { id: 3, name: 'Premium F2F', price: '£50.00' } | ||
} else { | ||
info = { id: 1, name: 'Premium', price: '£10.00' } | ||
} | ||
return info | ||
} |
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
Oops, something went wrong.