Last active
April 15, 2018 12:31
-
-
Save Akiyamka/afec4865307e883e98f05e1d41c31020 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const processors = { | |
| paypal: { | |
| checker: urlParams.PayerID && urlParams.paymentId && urlParams.token, | |
| resolver: () => { | |
| this.savePaypalPayment(urlParams).then( | |
| () => this.toast.success('Payment is successfull'), | |
| e => this.toast.error(e || 'Payment is not successfull'), | |
| ); | |
| }, | |
| }, | |
| webmoney: { | |
| checker: Object.keys(urlParams).includes('webmoney_success'), | |
| resolver: () => { | |
| if (JSON.parse(urlParams.webmoney_success)) { | |
| this.toast.success('Payment is successfull'); | |
| } else { | |
| this.toast.error('Payment is canceled'); | |
| } | |
| }, | |
| }, | |
| }; | |
| }; | |
| const currentPaymentRedirect = Object.values(processors).find( | |
| proc => proc.checker, | |
| ); | |
| if (currentPaymentRedirect) { | |
| currentPaymentRedirect.resolver(); | |
| this.sendMetricks(); | |
| // this.router.navigateToRoute('ROUTE_CAMPAIGNS'); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment