changed plugin name to cipf
This commit is contained in:
56
plugins/cipf_plugin/js/paypal/paypal.js
Normal file
56
plugins/cipf_plugin/js/paypal/paypal.js
Normal file
@@ -0,0 +1,56 @@
|
||||
import { createOrder } from './create_order.js';
|
||||
import { onApprove } from './on_approve.js';
|
||||
|
||||
|
||||
window.paypal.Buttons({
|
||||
/*
|
||||
style: {
|
||||
layout: 'vertical',
|
||||
color: 'blue',
|
||||
shape: 'rect',
|
||||
label: 'paypal',
|
||||
},
|
||||
*/
|
||||
createOrder: createOrder,
|
||||
onApprove: onApprove,
|
||||
})
|
||||
.render("#paypal-button-container");
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* customize card fields
|
||||
* from : https://developer.paypal.com/docs/checkout/advanced/integrate#link-addpaypalbuttonsandcardfields
|
||||
*
|
||||
// Create the Card Fields Component and define callbacks
|
||||
const cardField = paypal.CardFields({
|
||||
createOrder: createOrder,
|
||||
onApprove: onApprove,
|
||||
});
|
||||
|
||||
// Render each field after checking for eligibility
|
||||
if (cardField.isEligible()) {
|
||||
const nameField = cardField.NameField();
|
||||
nameField.render("#card-name-field-container");
|
||||
|
||||
const numberField = cardField.NumberField();
|
||||
numberField.render("#card-number-field-container");
|
||||
|
||||
const cvvField = cardField.CVVField();
|
||||
cvvField.render("#card-cvv-field-container");
|
||||
|
||||
const expiryField = cardField.ExpiryField();
|
||||
expiryField.render("#card-expiry-field-container");
|
||||
|
||||
// Add click listener to submit button and call the submit function on the CardField component
|
||||
document
|
||||
.getElementById("card-field-submit-button")
|
||||
.addEventListener("click", () => {
|
||||
cardField.submit().then(() => {
|
||||
// submit successful
|
||||
});
|
||||
});
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user