Skip to content

Commit 45a0ffb

Browse files
committed
feat: payment info screen for dc
1 parent c7e39d4 commit 45a0ffb

16 files changed

Lines changed: 121 additions & 2 deletions

File tree

examples/dynamic-checkout/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
document.addEventListener("DOMContentLoaded", function () {
1212
// You need to replace these values with your own
1313
const projectId = "test-proj_qEi1u5BwoYcZb6mOMKDWIm4mpqKCq6bN"
14-
const invoiceId = "iv_36LHtCq6bNj5JR3yggvgO4cSjR6XGBNB"
14+
const invoiceId = "iv_36NWNCq6bNv4SIQ0vHjXXXpZIuMKb0sM"
1515
const clientSecret = ""
1616

1717
const client = new ProcessOut.ProcessOut(projectId)

src/dynamic-checkout/clients/apple-pay.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ module ProcessOut {
134134
new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
135135
.element,
136136
)
137+
} else {
138+
getViewContainer().appendChild(
139+
new DynamicCheckoutPaymentInfoView(this.processOutInstance, this.paymentConfig)
140+
.element,
141+
)
137142
}
138143

139144
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
@@ -147,6 +152,11 @@ module ProcessOut {
147152
new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
148153
.element,
149154
)
155+
} else {
156+
getViewContainer().appendChild(
157+
new DynamicCheckoutPaymentInfoView(this.processOutInstance, this.paymentConfig)
158+
.element,
159+
)
150160
}
151161

152162
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)

src/dynamic-checkout/clients/google-pay.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,13 @@ module ProcessOut {
136136
this.paymentConfig,
137137
).element,
138138
)
139+
} else {
140+
getViewContainer().appendChild(
141+
new DynamicCheckoutPaymentInfoView(
142+
this.processOutInstance,
143+
this.paymentConfig,
144+
).element,
145+
)
139146
}
140147

141148
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent({
@@ -151,6 +158,13 @@ module ProcessOut {
151158
this.paymentConfig,
152159
).element,
153160
)
161+
} else {
162+
getViewContainer().appendChild(
163+
new DynamicCheckoutPaymentInfoView(
164+
this.processOutInstance,
165+
this.paymentConfig,
166+
).element,
167+
)
154168
}
155169

156170
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)

src/dynamic-checkout/config/payment-config.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ module ProcessOut {
3030

3131
constructor(config: DynamicCheckoutPublicConfigType) {
3232
this.setInitialConfig(config)
33-
console.log(this.showStatusMessage)
3433
}
3534

3635
public getConfig(): DynamicCheckoutPublicConfigType & DynamicCheckoutInternalConfigType {

src/dynamic-checkout/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module ProcessOut {
2020
"other-payment-methods-header": "Other payment methods",
2121
"select-payment-method-label": "Select payment method",
2222
"payment-success-message": "This payment is completed.",
23+
"payment-info-message": "We are processing your payment. You can now close this window.",
2324
"payment-error-generic-message": "We were unable to process your payment.",
2425
"street1-label": "Address line 1",
2526
"street2-label": "Address line 2",

src/dynamic-checkout/locales/es.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module ProcessOut {
2020
"other-payment-methods-header": "Otros métodos de pago",
2121
"select-payment-method-label": "Seleccionar método de pago",
2222
"payment-success-message": "Este pago se ha completado.",
23+
"payment-info-message": "Estamos procesando su pago. Puede cerrar esta ventana.",
2324
"payment-error-generic-message": "No pudimos procesar su pago.",
2425
"street1-label": "Dirección, línea 1",
2526
"street2-label": "Dirección, línea 2",

src/dynamic-checkout/locales/fr.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module ProcessOut {
2020
"other-payment-methods-header": "Autres méthodes de paiement",
2121
"select-payment-method-label": "Sélectionner un méthode de paiement",
2222
"payment-success-message": "Ce paiement a été effectué avec succès.",
23+
"payment-info-message":
24+
"Nous travaillons sur votre paiement. Vous pouvez maintenant fermer cette fenêtre.",
2325
"payment-error-generic-message": "Nous n'avons pas pu traiter votre paiement.",
2426
"street1-label": "Adresse, ligne 1",
2527
"street2-label": "Adresse, ligne 2",

src/dynamic-checkout/locales/pl.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module ProcessOut {
2020
"other-payment-methods-header": "Inne metody płatności",
2121
"select-payment-method-label": "Wybierz metodę płatności",
2222
"payment-success-message": "Płatność została zakończona pomyślnie.",
23+
"payment-info-message": "Przetwarzamy Twoją płatność. Możesz teraz zamknąć tę okno.",
2324
"payment-error-generic-message": "Nie udało nam się przetworzyć Twojej płatności.",
2425
"street1-label": "Adres, linia 1",
2526
"street2-label": "Adres, linia 2",

src/dynamic-checkout/locales/pt.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ module ProcessOut {
2020
"other-payment-methods-header": "Outros métodos de pagamento",
2121
"select-payment-method-label": "Selecionar método de pagamento",
2222
"payment-success-message": "Este pagamento foi concluído.",
23+
"payment-info-message":
24+
"Estamos processando seu pagamento. Você pode agora fechar esta janela.",
2325
"payment-error-generic-message": "Não conseguimos processar o seu pagamento.",
2426
"street1-label": "Endereço, linha 1",
2527
"street2-label": "Endereço, linha 2",

src/dynamic-checkout/payment-methods/apm.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ module ProcessOut {
110110
new DynamicCheckoutPaymentSuccessView(this.processOutInstance, this.paymentConfig)
111111
.element,
112112
)
113+
} else {
114+
this.resetContainerHtml().appendChild(
115+
new DynamicCheckoutPaymentInfoView(this.processOutInstance, this.paymentConfig)
116+
.element,
117+
)
113118
}
114119

115120
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent(invoiceId)
@@ -183,6 +188,13 @@ module ProcessOut {
183188
this.paymentConfig,
184189
).element,
185190
)
191+
} else {
192+
this.resetContainerHtml().appendChild(
193+
new DynamicCheckoutPaymentInfoView(
194+
this.processOutInstance,
195+
this.paymentConfig,
196+
).element,
197+
)
186198
}
187199

188200
DynamicCheckoutEventsUtils.dispatchPaymentSuccessEvent(invoiceId)
@@ -195,6 +207,13 @@ module ProcessOut {
195207
this.paymentConfig,
196208
).element,
197209
)
210+
} else {
211+
this.resetContainerHtml().appendChild(
212+
new DynamicCheckoutPaymentInfoView(
213+
this.processOutInstance,
214+
this.paymentConfig,
215+
).element,
216+
)
198217
}
199218

200219
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
@@ -208,6 +227,11 @@ module ProcessOut {
208227
new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
209228
.element,
210229
)
230+
} else {
231+
this.resetContainerHtml().appendChild(
232+
new DynamicCheckoutPaymentInfoView(this.processOutInstance, this.paymentConfig)
233+
.element,
234+
)
211235
}
212236

213237
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)
@@ -222,6 +246,11 @@ module ProcessOut {
222246
new DynamicCheckoutPaymentErrorView(this.processOutInstance, this.paymentConfig)
223247
.element,
224248
)
249+
} else {
250+
this.resetContainerHtml().appendChild(
251+
new DynamicCheckoutPaymentInfoView(this.processOutInstance, this.paymentConfig)
252+
.element,
253+
)
225254
}
226255

227256
DynamicCheckoutEventsUtils.dispatchPaymentErrorEvent(error)

0 commit comments

Comments
 (0)