billing
This commit is contained in:
parent
7b9078c6da
commit
42c08797e3
44 changed files with 2798 additions and 350 deletions
50
Yavsc/Views/Shared/DisplayTemplates/PaypalPayment.cshtml
Normal file
50
Yavsc/Views/Shared/DisplayTemplates/PaypalPayment.cshtml
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
@model PaypalPayment
|
||||
|
||||
@if (Model!=null && Model.Executor!=null) {
|
||||
@Html.DisplayFor(m=>m.Executor)
|
||||
} else {
|
||||
|
||||
<div id="paypal-button"></div>
|
||||
|
||||
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
|
||||
<environement names="lua,coiffure,zicmoove,yavsc,yavscpre">
|
||||
<script>
|
||||
var CREATE_PAYMENT_URL = '@(ViewData["PaymentUrl"])';
|
||||
var EXECUTE_PAYMENT_URL = 'https://lua.pschneider.fr/api/payment/execute';
|
||||
var PAYPAL_ENV = 'sandbox';
|
||||
</script>
|
||||
</environement>
|
||||
<environement names="Development">
|
||||
<script>
|
||||
var CREATE_PAYMENT_URL = '@(ViewData["PaymentUrl"])';
|
||||
var EXECUTE_PAYMENT_URL = 'https://dev.pschneider.fr/api/payment/execute';
|
||||
var PAYPAL_ENV = 'sandbox';
|
||||
</script>
|
||||
</environement>
|
||||
<script>
|
||||
paypal.Button.render({
|
||||
|
||||
env: PAYPAL_ENV, // 'production', Optional: specify 'sandbox' environment
|
||||
|
||||
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) { /* Go to a success page */ })
|
||||
.catch(function(err) { /* Go to an error page */ });
|
||||
}
|
||||
|
||||
}, '#paypal-button');
|
||||
</script>
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue