From e14310825437c5de93c07c570639d2a09fc4826b Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 16 Sep 2022 16:04:41 -0300 Subject: pretty --- .../src/cta/Payment/index.ts | 1 - .../src/cta/Payment/stories.tsx | 2 - .../src/cta/Payment/test.ts | 204 +++++++++++---------- .../src/cta/Payment/views.tsx | 16 +- 4 files changed, 118 insertions(+), 105 deletions(-) (limited to 'packages/taler-wallet-webextension/src/cta/Payment') diff --git a/packages/taler-wallet-webextension/src/cta/Payment/index.ts b/packages/taler-wallet-webextension/src/cta/Payment/index.ts index 1dd84fd7e..8e446722e 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/index.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/index.ts @@ -85,7 +85,6 @@ export namespace State { payStatus: PreparePayResultAlreadyConfirmed; balance: AmountJson; } - } const viewMapping: StateViewMap = { diff --git a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx index 6946f6906..c499dc285 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx @@ -333,5 +333,3 @@ export const AlreadyConfirmedByOther = createExample(BaseView, { paid: false, }, }); - - diff --git a/packages/taler-wallet-webextension/src/cta/Payment/test.ts b/packages/taler-wallet-webextension/src/cta/Payment/test.ts index 91d2d825d..f4ce5afb3 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/test.ts @@ -75,7 +75,9 @@ describe("Payment CTA states", () => { talerPayUri: undefined, cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, @@ -111,19 +113,21 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:10", - status: PreparePayResultType.InsufficientBalance, - } as Partial), + ({ + amountRaw: "USD:10", + status: PreparePayResultType.InsufficientBalance, + } as Partial), getBalance: async () => - ({ - balances: [], - } as Partial), + ({ + balances: [], + } as Partial), } as Partial as any, ), ); @@ -154,23 +158,25 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:10", - status: PreparePayResultType.InsufficientBalance, - } as Partial), + ({ + amountRaw: "USD:10", + status: PreparePayResultType.InsufficientBalance, + } as Partial), getBalance: async () => - ({ - balances: [ - { - available: "USD:5", - }, - ], - } as Partial), + ({ + balances: [ + { + available: "USD:5", + }, + ], + } as Partial), } as Partial as any, ), ); @@ -201,24 +207,26 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:10", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial), + ({ + amountRaw: "USD:10", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial), } as Partial as any, ), ); @@ -251,24 +259,26 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial), } as Partial as any, ), ); @@ -301,29 +311,31 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial), confirmPay: async () => - ({ - type: ConfirmPayResultType.Done, - contractTerms: {}, - } as Partial), + ({ + type: ConfirmPayResultType.Done, + contractTerms: {}, + } as Partial), } as Partial as any, ), ); @@ -370,29 +382,31 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: nullFunction, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial), getBalance: async () => - ({ - balances: [ - { - available: "USD:15", - }, - ], - } as Partial), + ({ + balances: [ + { + available: "USD:15", + }, + ], + } as Partial), confirmPay: async () => - ({ - type: ConfirmPayResultType.Pending, - lastError: { code: 1 }, - } as Partial), + ({ + type: ConfirmPayResultType.Pending, + lastError: { code: 1 }, + } as Partial), } as Partial as any, ), ); @@ -454,24 +468,26 @@ describe("Payment CTA states", () => { talerPayUri: "taller://pay", cancel: nullFunction, goToWalletManualWithdraw: nullFunction, - onSuccess: async () => { null; }, + onSuccess: async () => { + null; + }, }, { onUpdateNotification: subscriptions.saveSubscription, preparePay: async () => - ({ - amountRaw: "USD:9", - amountEffective: "USD:10", - status: PreparePayResultType.PaymentPossible, - } as Partial), + ({ + amountRaw: "USD:9", + amountEffective: "USD:10", + status: PreparePayResultType.PaymentPossible, + } as Partial), getBalance: async () => - ({ - balances: [ - { - available: Amounts.stringify(availableBalance), - }, - ], - } as Partial), + ({ + balances: [ + { + available: Amounts.stringify(availableBalance), + }, + ], + } as Partial), } as Partial as any, ), ); diff --git a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx index a2e52269c..7646e4bf1 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/views.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/views.tsx @@ -166,14 +166,14 @@ export function BaseView(state: SupportedStates): VNode { /> )} - +
Cancel -- cgit v1.2.3