Skip to content

Commit

Permalink
Prevent the embedded card function to be triggered meant for non WC b…
Browse files Browse the repository at this point in the history
…lock when WC block is not enabled.
  • Loading branch information
aashishgurung committed Aug 6, 2024
1 parent 2b1eb51 commit ab7d01a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 46 deletions.
35 changes: 19 additions & 16 deletions assets/javascripts/omise-payment-form-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -255,22 +255,25 @@
}

function initializeSecureCardForm() {
const omiseCardElement = document.getElementById('omise-card');
if (omiseCardElement && Boolean(omise_params.secure_form_enabled)) {
showOmiseEmbeddedCardForm({
element: omiseCardElement,
publicKey: omise_params.key,
hideRememberCard: HIDE_REMEMBER_CARD,
locale: LOCALE,
theme: CARD_FORM_THEME ?? 'light',
design: FORM_DESIGN,
brandIcons: CARD_BRAND_ICONS,
onSuccess: handleCreateOrder,
onError: (error) => {
showError(error)
$form.unblock()
}
})
// This will be undefined when WC block is enabled in Checkout page
if (typeof HIDE_REMEMBER_CARD !== 'undefined') {
const omiseCardElement = document.getElementById('omise-card');
if (omiseCardElement && Boolean(omise_params.secure_form_enabled)) {
showOmiseEmbeddedCardForm({
element: omiseCardElement,
publicKey: omise_params.key,
hideRememberCard: HIDE_REMEMBER_CARD,
locale: LOCALE,
theme: CARD_FORM_THEME ?? 'light',
design: FORM_DESIGN,
brandIcons: CARD_BRAND_ICONS,
onSuccess: handleCreateOrder,
onError: (error) => {
showError(error)
$form.unblock()
}
})
}
}
}

Expand Down
30 changes: 0 additions & 30 deletions tests/unit/includes/gateway/class-omise-payment-ocbc-pao-test.php

This file was deleted.

0 comments on commit ab7d01a

Please sign in to comment.