From 76625a995873e8bfe7671179f5482ab7c68469c2 Mon Sep 17 00:00:00 2001 From: guilhermer Date: Fri, 1 Dec 2023 17:02:58 +0100 Subject: [PATCH] feat: clean up --- .../src/components/CashAppPay/CashAppPay.tsx | 2 +- packages/lib/src/components/Dropin/Dropin.tsx | 4 +- packages/lib/src/components/PayPal/Paypal.tsx | 2 +- .../playground/src/pages/Dropin/manual.js | 46 ------------------- 4 files changed, 3 insertions(+), 51 deletions(-) diff --git a/packages/lib/src/components/CashAppPay/CashAppPay.tsx b/packages/lib/src/components/CashAppPay/CashAppPay.tsx index a27ef22ed3..86e9c6887a 100644 --- a/packages/lib/src/components/CashAppPay/CashAppPay.tsx +++ b/packages/lib/src/components/CashAppPay/CashAppPay.tsx @@ -93,7 +93,7 @@ export class CashAppPay extends UIElement { return this.props.storedPaymentMethodId ? 'Cash App Pay' : ''; } - public submit = async () => { + public submit = () => { const { onClick, storedPaymentMethodId } = this.props; if (storedPaymentMethodId) { diff --git a/packages/lib/src/components/Dropin/Dropin.tsx b/packages/lib/src/components/Dropin/Dropin.tsx index 84751a3f6e..77f5097d5a 100644 --- a/packages/lib/src/components/Dropin/Dropin.tsx +++ b/packages/lib/src/components/Dropin/Dropin.tsx @@ -83,7 +83,7 @@ class DropinElement extends UIElement { /** * Calls the onSubmit event with the state of the activePaymentMethod */ - public async submit(): Promise { + public override submit(): void { if (!this.activePaymentMethod) { throw new Error('No active payment method.'); } @@ -122,8 +122,6 @@ class DropinElement extends UIElement { }; public handleAction(action: PaymentAction, props = {}): this | null { - debugger; - if (!action || !action.type) { if (hasOwnProperty(action, 'action') && hasOwnProperty(action, 'resultCode')) { throw new Error( diff --git a/packages/lib/src/components/PayPal/Paypal.tsx b/packages/lib/src/components/PayPal/Paypal.tsx index 9c8091df33..55517faf0f 100644 --- a/packages/lib/src/components/PayPal/Paypal.tsx +++ b/packages/lib/src/components/PayPal/Paypal.tsx @@ -42,7 +42,7 @@ class PaypalElement extends UIElement { }; } - public submit = async () => { + public submit = () => { this.handleError(new AdyenCheckoutError('IMPLEMENTATION_ERROR', ERRORS.SUBMIT_NOT_SUPPORTED)); }; diff --git a/packages/playground/src/pages/Dropin/manual.js b/packages/playground/src/pages/Dropin/manual.js index 6028d27df8..b73fae229d 100644 --- a/packages/playground/src/pages/Dropin/manual.js +++ b/packages/playground/src/pages/Dropin/manual.js @@ -16,7 +16,6 @@ export async function initManual() { locale: 'pt-BR', translationFile: getTranslationFile(shopperLocale), - // translationFile: nl_NL, environment: process.env.__CLIENT_ENV__, @@ -64,19 +63,6 @@ export async function initManual() { // // return; // } - // - // if (result.resultCode === 'Authorised' || result.resultCode === 'Received') { - // actions.resolve(result); // DO I NEED FULL RESULT? - // } else { - // actions.reject(result); - // } - - // return { - // googlePayError: { - // message: 'Not sufficient funds', - // reason: 'OTHER_ERROR,' - // } - // } // // // Trigger Error for GooglePay @@ -93,38 +79,6 @@ export async function initManual() { onPaymentCompleted(result, element) { console.log('onPaymentCompleted', result, element); }, - // - // - // // payments call - // if (result === AUTHORIZED) - // return action.resolve({ orderTrackng: { /// details }})} - // } - // - // - // action.reject(new ApplePayError(''))); - - // // handle actions - // if (result.action) { - // // demo only - store paymentData & order - // if (result.action.paymentData) localStorage.setItem('storedPaymentData', result.action.paymentData); - // component.handleAction(result.action, { challengeWindowSize: '01' }); - // } else if (result.order && result.order?.remainingAmount?.value > 0) { - // // handle orders - // const order = { - // orderData: result.order.orderData, - // pspReference: result.order.pspReference - // }; - // - // const orderPaymentMethods = await getPaymentMethods({ order, amount, shopperLocale }); - // checkout.update({ paymentMethodsResponse: orderPaymentMethods, order, amount: result.order.remainingAmount }); - // } else { - // handleFinalState(result.resultCode, component); - // } - // }, - // srConfig: { showPanel: true }, - // onChange: state => { - // console.log('onChange', state); - // }, onAdditionalDetails: async (state, component) => { const result = await makeDetailsCall(state.data);