Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/dynamic-checkout/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
<script>
document.addEventListener("DOMContentLoaded", function () {
// You need to replace these values with your own
const projectId = "test-proj_zkSfc1Cz6vPjhcLkapSpO7UtmCeYuavb"
const invoiceId = "iv_3AFPfYuavbUBf4rerB2VMHKUnmQjke59"
const projectId = "proj_6O2BtRj35JrqX3SDMuvk2dtiROstpU5m"
const invoiceId = "iv_3AFyQtpU5mzTMmOvdXQCyGBy2GKKZCaA"
const clientSecret = ""

const client = new ProcessOut.ProcessOut(projectId)
Expand All @@ -22,7 +22,7 @@
capturePayments: false,
allowFallbackToSale: false,
showStatusMessage: false,
locale: "de",
locale: "en",
})

dynamicCheckout.mount("#dynamic-cko-container")
Expand Down
1 change: 1 addition & 0 deletions src/dynamic-checkout/clients/apple-pay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module ProcessOut {
getViewContainer: () => HTMLElement,
) {
const applePayScript = document.createElement("script")

applePayScript.src = applePaySdkUrl
applePayScript.onload = () => {
buttonContainer.innerHTML = `<apple-pay-button buttonstyle="black" type="plain" locale="en-US"></apple-pay-button>`
Expand Down
16 changes: 10 additions & 6 deletions src/dynamic-checkout/views/payment-methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ module ProcessOut {
classNames: ["dco-express-checkout-payment-methods-wrapper"],
attributes: {
role: "radiogroup",
"aria-label": Translations.getText("express-checkout-header", this.paymentConfig.locale),
"aria-label": Translations.getText(
"express-checkout-header",
this.paymentConfig.locale,
),
},
},
])
Expand Down Expand Up @@ -239,6 +242,8 @@ module ProcessOut {
let expressPaymentMethods = []
let regularPaymentMethods = []

console.log(this.paymentConfig.invoiceDetails.payment_methods)

this.paymentConfig.invoiceDetails.payment_methods.forEach(paymentMethod => {
switch (paymentMethod.type) {
case "googlepay":
Expand All @@ -253,9 +258,7 @@ module ProcessOut {

case "applepay":
// We want to hide Apple Pay for HPP temporarily
const shouldHide = /^https?:\/\/.*pay\.processout\.(com|ninja)\//.test(
window.location.href,
)
const shouldHide = false

if (!shouldHide) {
const applePayPaymentMethod = new ApplePayPaymentMethod(
Expand Down Expand Up @@ -426,8 +429,9 @@ module ProcessOut {
this.createPaymentMethodsManager(expressCheckoutHeader)

const nextFocusTarget =
(paymentManagerMethodsList.querySelector(".dco-delete-payment-method-button") as HTMLElement) ||
(document.querySelector(".close-modal-btn") as HTMLElement)
(paymentManagerMethodsList.querySelector(
".dco-delete-payment-method-button",
) as HTMLElement) || (document.querySelector(".close-modal-btn") as HTMLElement)

if (nextFocusTarget) {
nextFocusTarget.focus()
Expand Down
Loading