-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Apple Pay in Popup #112
base: release/5.8.3
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
jQuery( function( $ ) { | ||
|
||
$('head').append('<style>.merchant-logo img, img.merchant-logo { max-height: 30px !important; width: auto; }</style>'); | ||
let paystack_submit = false; | ||
|
||
$( '#wc-paystack-form' ).hide(); | ||
|
@@ -13,6 +14,7 @@ jQuery( function( $ ) { | |
jQuery( '#paystack_form form#order_review' ).submit( function() { | ||
return wcPaystackFormHandler(); | ||
} ); | ||
|
||
|
||
function wcPaystackCustomFields() { | ||
|
||
|
@@ -189,11 +191,11 @@ jQuery( function( $ ) { | |
} ); | ||
}; | ||
|
||
let paymentData = { | ||
const paymentData = { | ||
key: wc_paystack_params.key, | ||
email: wc_paystack_params.email, | ||
amount: amount, | ||
ref: wc_paystack_params.txnref, | ||
reference: wc_paystack_params.txnref, | ||
currency: wc_paystack_params.currency, | ||
subaccount: subaccount_code, | ||
bearer: charges_account, | ||
|
@@ -203,20 +205,28 @@ jQuery( function( $ ) { | |
}, | ||
onSuccess: paystack_callback, | ||
onCancel: () => { | ||
$( '#wc-paystack-form' ).show(); | ||
$( this.el ).unblock(); | ||
$('#wc-paystack-form').show(); | ||
$(this.el).unblock(); | ||
} | ||
}; | ||
|
||
if ( Array.isArray( wcPaymentChannels() ) && wcPaymentChannels().length ) { | ||
paymentData[ 'channels' ] = wcPaymentChannels(); | ||
if ( !$.isEmptyObject( wcPaystackCustomFilters() ) ) { | ||
paymentData[ 'metadata' ][ 'custom_filters' ] = wcPaystackCustomFilters(); | ||
if (Array.isArray(wcPaymentChannels()) && wcPaymentChannels().length) { | ||
paymentData.channels = wcPaymentChannels(); | ||
if (!$.isEmptyObject(wcPaystackCustomFilters())) { | ||
paymentData.metadata.custom_filters = wcPaystackCustomFilters(); | ||
} | ||
} | ||
|
||
const paystack = new PaystackPop(); | ||
paystack.newTransaction( paymentData ); | ||
|
||
try { | ||
const paystack = new PaystackPop(); | ||
paystack.checkout(paymentData).then(function(transaction) { | ||
console.log('Transaction:', transaction); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove logging to the console. |
||
}).catch(function(error) { | ||
console.error('Paystack checkout error:', error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove logging to the console. |
||
}); | ||
} catch (error) { | ||
console.error('Paystack checkout error:', error); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove logging to the console. |
||
} | ||
} | ||
|
||
} ); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be removed? I guess this is overriding a global style applied by Paystack?