Use NVP/SOAP Api from PayPal

This commit is contained in:
2017-05-24 23:36:49 +02:00
parent 0aa9ac202b
commit 938159a55c
33 changed files with 2385 additions and 634 deletions

View File

@ -0,0 +1,33 @@
+(function($, paypal, PAYPAL_ENV, CREATE_PAYMENT_URL, EXECUTE_PAYMENT_URL) {
$(document).ready(function() {
paypal.Button.render({
env: PAYPAL_ENV, // 'production', Optional: specify 'sandbox' environment
commit: true,
payment: function(resolve, reject) {
return paypal.request.post(CREATE_PAYMENT_URL)
.then(function(data) { resolve(data.id); })
.catch(function(err) { reject(err); });
},
onAuthorize: function(data) {
// Note: you can display a confirmation page before executing
return paypal.request.post(EXECUTE_PAYMENT_URL, { paymentID: data.paymentID, payerID: data.payerID })
.then(function(data) {
document.location = '@ViewBag.Urls.Details';
/* Go to a success page */
})
.catch(function(err) {
document.location = '/Manage/PaymentInfo/' + data.paymentID + '/?error=' + err;
/* Go to an error page */
});
}
}, '#paypal-button');
})
})(jQuery);

1
Yavsc/wwwroot/js/paypalbutton.min.js vendored Normal file
View File

@ -0,0 +1 @@
+function(n,t,e,o,u){n(document).ready(function(){t.Button.render({env:e,commit:!0,payment:function(n,e){return t.request.post(o).then(function(t){n(t.id)})["catch"](function(n){e(n)})},onAuthorize:function(n){return t.request.post(u,{paymentID:n.paymentID,payerID:n.payerID}).then(function(n){document.location="@ViewBag.Urls.Details"})["catch"](function(t){document.location="/Manage/PaymentInfo/"+n.paymentID+"/?error="+t})}},"#paypal-button")})}(jQuery);