From 9fe01b9dcfb6a1186a1b3496320d58028ac4d5ec Mon Sep 17 00:00:00 2001 From: kpieloch <113994423+kpieloch@users.noreply.github.com> Date: Tue, 7 Jan 2025 17:05:52 +0100 Subject: [PATCH 1/3] AD-390: Removing session --- ...checkout-adyen-payment-method.component.spec.ts | 2 +- .../checkout-adyen-payment-method.component.ts | 14 ++++++-------- .../src/core/models/occ.config.models.ts | 6 ------ .../src/core/models/occ.order.models.ts | 3 ++- .../adapters/occ-checkout-config.adapter.spec.ts | 4 ---- .../apple-express-payment.component.spec.ts | 1 - .../google-express-payment.component.spec.ts | 1 - .../checkout-adyen-configuration.service.spec.ts | 1 - 8 files changed, 9 insertions(+), 23 deletions(-) diff --git a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.spec.ts b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.spec.ts index f7d6eae..43b2348 100644 --- a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.spec.ts +++ b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.spec.ts @@ -75,7 +75,7 @@ describe('CheckoutAdyenPaymentMethodComponent', () => { adyenClientKey: 'mockClientKey', adyenPaypalMerchantId: 'mockPaypalMerchantId', deviceFingerPrintUrl: 'mockDeviceFingerPrintUrl', - sessionData: { id: 'mockSessionId', sessionData: 'mockSessionData' }, + selectedPaymentMethod: 'mockPaymentMethod', showRememberTheseDetails: true, checkoutShopperHost: 'mockShopperHost', diff --git a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts index e4d90b0..94c3d70 100644 --- a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts +++ b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts @@ -137,12 +137,10 @@ export class CheckoutAdyenPaymentMethodComponent implements OnInit, OnDestroy { storedPaymentMethods: adyenConfig.storedPaymentMethodList }, locale: adyenConfig.shopperLocale, + countryCode: adyenConfig.countryCode, environment: this.castToEnvironment(adyenConfig.environmentMode), clientKey: adyenConfig.adyenClientKey, - session: { - id: adyenConfig.sessionData.id, - sessionData: adyenConfig.sessionData.sessionData - }, + amount: adyenConfig.amount, analytics: { enabled: false }, @@ -230,13 +228,13 @@ export class CheckoutAdyenPaymentMethodComponent implements OnInit, OnDestroy { } private handleResponse(response: PlaceOrderResponse | void, actions: SubmitActions) { - if (!!response) { + if (response !== null && response !== undefined) { if (response.success) { - if (response.executeAction && response.paymentsAction !== undefined) { + if (response.executeAction === true && response.paymentsAction != null) { this.dropIn.handleAction(response.paymentsAction) - } else { + } else if (response.paymentsResponse !== undefined) { actions.resolve({ - resultCode: 'Authorised' + resultCode: response.paymentsResponse.resultCode }); this.onSuccess(); } diff --git a/projects/adyen/adyen-spartacus/src/core/models/occ.config.models.ts b/projects/adyen/adyen-spartacus/src/core/models/occ.config.models.ts index 2d91d66..6475ecf 100644 --- a/projects/adyen/adyen-spartacus/src/core/models/occ.config.models.ts +++ b/projects/adyen/adyen-spartacus/src/core/models/occ.config.models.ts @@ -12,7 +12,6 @@ export interface AdyenConfigData { adyenClientKey: string; adyenPaypalMerchantId: string; deviceFingerPrintUrl: string; - sessionData: SessionData; selectedPaymentMethod: string; showRememberTheseDetails: boolean; checkoutShopperHost: string; @@ -60,11 +59,6 @@ interface ExpressPaymentConfig { amazonPayExpressEnabledOnProduct: boolean } -interface SessionData { - id: string, - sessionData: string -} - interface StoredPaymentMethodData { brand: string; expiryMonth: string; diff --git a/projects/adyen/adyen-spartacus/src/core/models/occ.order.models.ts b/projects/adyen/adyen-spartacus/src/core/models/occ.order.models.ts index 19ff60d..50ea2d0 100644 --- a/projects/adyen/adyen-spartacus/src/core/models/occ.order.models.ts +++ b/projects/adyen/adyen-spartacus/src/core/models/occ.order.models.ts @@ -1,4 +1,4 @@ -import { PaymentAction } from "@adyen/adyen-web"; +import { PaymentAction,PaymentResponseData } from "@adyen/adyen-web"; import { Order } from '@spartacus/order/root'; export interface ApplePayExpressRequest { @@ -25,6 +25,7 @@ export interface PlaceOrderResponse { success: boolean, executeAction?: boolean, paymentsAction?: PaymentAction, + paymentsResponse?: PaymentResponseData, error?: string, errorFieldCodes?: string[] orderNumber?: string, diff --git a/projects/adyen/adyen-spartacus/src/core/occ/adapters/occ-checkout-config.adapter.spec.ts b/projects/adyen/adyen-spartacus/src/core/occ/adapters/occ-checkout-config.adapter.spec.ts index 7b54a0a..b75026c 100644 --- a/projects/adyen/adyen-spartacus/src/core/occ/adapters/occ-checkout-config.adapter.spec.ts +++ b/projects/adyen/adyen-spartacus/src/core/occ/adapters/occ-checkout-config.adapter.spec.ts @@ -50,10 +50,6 @@ describe('OccCheckoutConfigAdapter', () => { adyenClientKey: 'mockClientKey', adyenPaypalMerchantId: 'mockPaypalMerchantId', deviceFingerPrintUrl: 'https://mock.device.fingerprint.url', - sessionData: { - id: 'mockSessionId', - sessionData: 'mockSessionData' - }, selectedPaymentMethod: 'mockPaymentMethod', showRememberTheseDetails: true, checkoutShopperHost: 'https://mock.checkout.shopper.host', diff --git a/projects/adyen/adyen-spartacus/src/express/apple-express-payment/apple-express-payment.component.spec.ts b/projects/adyen/adyen-spartacus/src/express/apple-express-payment/apple-express-payment.component.spec.ts index 8132db9..fadeb60 100644 --- a/projects/adyen/adyen-spartacus/src/express/apple-express-payment/apple-express-payment.component.spec.ts +++ b/projects/adyen/adyen-spartacus/src/express/apple-express-payment/apple-express-payment.component.spec.ts @@ -25,7 +25,6 @@ describe('AppleExpressPaymentComponent', () => { adyenClientKey: 'mockClientKey', adyenPaypalMerchantId: 'mockPaypalMerchantId', deviceFingerPrintUrl: 'mockDeviceFingerPrintUrl', - sessionData: { id: 'mockSessionId', sessionData: 'mockSessionData' }, selectedPaymentMethod: 'mockPaymentMethod', showRememberTheseDetails: true, checkoutShopperHost: 'mockShopperHost', diff --git a/projects/adyen/adyen-spartacus/src/express/google-express-payment/google-express-payment.component.spec.ts b/projects/adyen/adyen-spartacus/src/express/google-express-payment/google-express-payment.component.spec.ts index 31f6cc2..833d8f4 100644 --- a/projects/adyen/adyen-spartacus/src/express/google-express-payment/google-express-payment.component.spec.ts +++ b/projects/adyen/adyen-spartacus/src/express/google-express-payment/google-express-payment.component.spec.ts @@ -24,7 +24,6 @@ describe('GoogleExpressPaymentComponent', () => { adyenClientKey: 'mockClientKey', adyenPaypalMerchantId: 'mockPaypalMerchantId', deviceFingerPrintUrl: 'mockDeviceFingerPrintUrl', - sessionData: { id: 'mockSessionId', sessionData: 'mockSessionData' }, selectedPaymentMethod: 'mockPaymentMethod', showRememberTheseDetails: true, checkoutShopperHost: 'mockShopperHost', diff --git a/projects/adyen/adyen-spartacus/src/service/checkout-adyen-configuration.service.spec.ts b/projects/adyen/adyen-spartacus/src/service/checkout-adyen-configuration.service.spec.ts index d068999..98a2fe3 100644 --- a/projects/adyen/adyen-spartacus/src/service/checkout-adyen-configuration.service.spec.ts +++ b/projects/adyen/adyen-spartacus/src/service/checkout-adyen-configuration.service.spec.ts @@ -68,7 +68,6 @@ describe('CheckoutAdyenConfigurationService', () => { adyenClientKey: 'testClientKey', adyenPaypalMerchantId: 'testPaypalMerchantId', deviceFingerPrintUrl: 'https://example.com/fingerprint', - sessionData: { id: 'sessionId', sessionData: 'sessionData' }, selectedPaymentMethod: 'visa', showRememberTheseDetails: true, checkoutShopperHost: 'https://example.com/shopper', From 1f29c6633f55d248ac71471a2aa643287deaabd0 Mon Sep 17 00:00:00 2001 From: kpieloch <113994423+kpieloch@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:09:13 +0100 Subject: [PATCH 2/3] AD-390: Removing session --- .../checkout-adyen-payment-method.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts index 94c3d70..ec7e91d 100644 --- a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts +++ b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts @@ -228,7 +228,7 @@ export class CheckoutAdyenPaymentMethodComponent implements OnInit, OnDestroy { } private handleResponse(response: PlaceOrderResponse | void, actions: SubmitActions) { - if (response !== null && response !== undefined) { + if (!!response) { if (response.success) { if (response.executeAction === true && response.paymentsAction != null) { this.dropIn.handleAction(response.paymentsAction) From ebf5e4fe57f0608e14b0b4786ec042e590a14bea Mon Sep 17 00:00:00 2001 From: kpieloch <113994423+kpieloch@users.noreply.github.com> Date: Wed, 8 Jan 2025 10:42:26 +0100 Subject: [PATCH 3/3] AD-390: Removing session --- .../checkout-adyen-payment-method.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts index ec7e91d..1c18747 100644 --- a/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts +++ b/projects/adyen/adyen-spartacus/src/checkout-adyen-payment-method/checkout-adyen-payment-method.component.ts @@ -230,9 +230,9 @@ export class CheckoutAdyenPaymentMethodComponent implements OnInit, OnDestroy { private handleResponse(response: PlaceOrderResponse | void, actions: SubmitActions) { if (!!response) { if (response.success) { - if (response.executeAction === true && response.paymentsAction != null) { + if (response.executeAction === true && !!response.paymentsAction) { this.dropIn.handleAction(response.paymentsAction) - } else if (response.paymentsResponse !== undefined) { + } else if (!!response.paymentsResponse) { actions.resolve({ resultCode: response.paymentsResponse.resultCode });