diff options
author | Sebastian <sebasjm@gmail.com> | 2023-10-22 14:47:50 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2023-10-22 14:47:50 -0300 |
commit | 5e160a2d4d1d77c87600f28f806bc94c086267c7 (patch) | |
tree | ec8475a39d7aa4565b490e259d787b195fb98bb3 /packages/taler-wallet-webextension/src/cta/Payment | |
parent | 2005273d1286819e68d3ea7a3290f8c357be5e40 (diff) | |
download | wallet-core-5e160a2d4d1d77c87600f28f806bc94c086267c7.tar.xz |
update the amountString definitionv0.9.3-dev.34
Diffstat (limited to 'packages/taler-wallet-webextension/src/cta/Payment')
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Payment/stories.tsx | 129 | ||||
-rw-r--r-- | packages/taler-wallet-webextension/src/cta/Payment/test.ts | 43 |
2 files changed, 87 insertions, 85 deletions
diff --git a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx index f030fa219..eee5fb684 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx +++ b/packages/taler-wallet-webextension/src/cta/Payment/stories.tsx @@ -20,6 +20,7 @@ */ import { + AmountString, Amounts, MerchantContractTerms as ContractTerms, PreparePayResultType, @@ -52,13 +53,13 @@ export const NoEnoughBalanceAvailable = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.InsufficientBalance, balanceDetails: { - amountRequested: "USD:10", - balanceAvailable: "USD:9", - balanceMaterial: "USD:9", - balanceAgeAcceptable: "USD:9", - balanceMerchantAcceptable: "USD:9", - balanceMerchantDepositable: "USD:9", - feeGapEstimate: "USD:1", + amountRequested: "USD:10" as AmountString, + balanceAvailable: "USD:9" as AmountString, + balanceMaterial: "USD:9" as AmountString, + balanceAgeAcceptable: "USD:9" as AmountString, + balanceMerchantAcceptable: "USD:9" as AmountString, + balanceMerchantDepositable: "USD:9" as AmountString, + feeGapEstimate: "USD:1" as AmountString, }, talerUri: "taler://pay/..", @@ -73,7 +74,7 @@ export const NoEnoughBalanceAvailable = tests.createExample(BaseView, { summary: "some beers", amount: "USD:10", } as Partial<ContractTerms> as any, - amountRaw: "USD:10", + amountRaw: "USD:10" as AmountString, }, }); @@ -92,13 +93,13 @@ export const NoEnoughBalanceMaterial = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.InsufficientBalance, balanceDetails: { - amountRequested: "USD:10", - balanceAvailable: "USD:10", - balanceMaterial: "USD:9", - balanceAgeAcceptable: "USD:9", - balanceMerchantAcceptable: "USD:9", - balanceMerchantDepositable: "USD:0", - feeGapEstimate: "USD:1", + amountRequested: "USD:10" as AmountString, + balanceAvailable: "USD:10" as AmountString, + balanceMaterial: "USD:9" as AmountString, + balanceAgeAcceptable: "USD:9" as AmountString, + balanceMerchantAcceptable: "USD:9" as AmountString, + balanceMerchantDepositable: "USD:0" as AmountString, + feeGapEstimate: "USD:1" as AmountString, }, talerUri: "taler://pay/..", @@ -111,9 +112,9 @@ export const NoEnoughBalanceMaterial = tests.createExample(BaseView, { email: "contact@merchant.taler", }, summary: "some beers", - amount: "USD:10", + amount: "USD:10" as AmountString, } as Partial<ContractTerms> as any, - amountRaw: "USD:10", + amountRaw: "USD:10" as AmountString, }, }); @@ -132,13 +133,13 @@ export const NoEnoughBalanceAgeAcceptable = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.InsufficientBalance, balanceDetails: { - amountRequested: "USD:10", - balanceAvailable: "USD:10", - balanceMaterial: "USD:10", - balanceAgeAcceptable: "USD:9", - balanceMerchantAcceptable: "USD:9", - balanceMerchantDepositable: "USD:9", - feeGapEstimate: "USD:1", + amountRequested: "USD:10" as AmountString, + balanceAvailable: "USD:10" as AmountString, + balanceMaterial: "USD:10" as AmountString, + balanceAgeAcceptable: "USD:9" as AmountString, + balanceMerchantAcceptable: "USD:9" as AmountString, + balanceMerchantDepositable: "USD:9" as AmountString, + feeGapEstimate: "USD:1" as AmountString, }, talerUri: "taler://pay/..", @@ -154,7 +155,7 @@ export const NoEnoughBalanceAgeAcceptable = tests.createExample(BaseView, { summary: "some beers", amount: "USD:10", } as Partial<ContractTerms> as any, - amountRaw: "USD:10", + amountRaw: "USD:10" as AmountString, }, }); @@ -173,13 +174,13 @@ export const NoEnoughBalanceMerchantAcceptable = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.InsufficientBalance, balanceDetails: { - amountRequested: "USD:10", - balanceAvailable: "USD:10", - balanceMaterial: "USD:10", - balanceAgeAcceptable: "USD:10", - balanceMerchantAcceptable: "USD:9", - balanceMerchantDepositable: "USD:9", - feeGapEstimate: "USD:1", + amountRequested: "USD:10" as AmountString, + balanceAvailable: "USD:10" as AmountString, + balanceMaterial: "USD:10" as AmountString, + balanceAgeAcceptable: "USD:10" as AmountString, + balanceMerchantAcceptable: "USD:9" as AmountString, + balanceMerchantDepositable: "USD:9" as AmountString, + feeGapEstimate: "USD:1" as AmountString, }, talerUri: "taler://pay/..", @@ -192,9 +193,9 @@ export const NoEnoughBalanceMerchantAcceptable = tests.createExample(BaseView, { email: "contact@merchant.taler", }, summary: "some beers", - amount: "USD:10", + amount: "USD:10" as AmountString, } as Partial<ContractTerms> as any, - amountRaw: "USD:10", + amountRaw: "USD:10" as AmountString, }, }); @@ -215,13 +216,13 @@ export const NoEnoughBalanceMerchantDepositable = tests.createExample( transactionId: " " as TransactionIdStr, status: PreparePayResultType.InsufficientBalance, balanceDetails: { - amountRequested: "USD:10", - balanceAvailable: "USD:10", - balanceMaterial: "USD:10", - balanceAgeAcceptable: "USD:10", - balanceMerchantAcceptable: "USD:10", - balanceMerchantDepositable: "USD:9", - feeGapEstimate: "USD:1", + amountRequested: "USD:10" as AmountString, + balanceAvailable: "USD:10" as AmountString, + balanceMaterial: "USD:10" as AmountString, + balanceAgeAcceptable: "USD:10" as AmountString, + balanceMerchantAcceptable: "USD:10" as AmountString, + balanceMerchantDepositable: "USD:9" as AmountString, + feeGapEstimate: "USD:1" as AmountString, }, talerUri: "taler://pay/..", @@ -234,9 +235,9 @@ export const NoEnoughBalanceMerchantDepositable = tests.createExample( email: "contact@merchant.taler", }, summary: "some beers", - amount: "USD:10", + amount: "USD:10" as AmountString, } as Partial<ContractTerms> as any, - amountRaw: "USD:10", + amountRaw: "USD:10" as AmountString, }, }, ); @@ -256,13 +257,13 @@ export const NoEnoughBalanceFeeGap = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.InsufficientBalance, balanceDetails: { - amountRequested: "USD:10", - balanceAvailable: "USD:10", - balanceMaterial: "USD:10", - balanceAgeAcceptable: "USD:10", - balanceMerchantAcceptable: "USD:10", - balanceMerchantDepositable: "USD:10", - feeGapEstimate: "USD:1", + amountRequested: "USD:10" as AmountString, + balanceAvailable: "USD:10" as AmountString, + balanceMaterial: "USD:10" as AmountString, + balanceAgeAcceptable: "USD:10" as AmountString, + balanceMerchantAcceptable: "USD:10" as AmountString, + balanceMerchantDepositable: "USD:10" as AmountString, + feeGapEstimate: "USD:1" as AmountString, }, talerUri: "taler://pay/..", @@ -276,9 +277,9 @@ export const NoEnoughBalanceFeeGap = tests.createExample(BaseView, { }, minimum_age: 18, summary: "some beers", - amount: "USD:10", + amount: "USD:10" as AmountString, } as Partial<ContractTerms> as any, - amountRaw: "USD:10", + amountRaw: "USD:10" as AmountString, }, }); @@ -300,8 +301,8 @@ export const PaymentPossible = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.PaymentPossible, talerUri: "taler://pay/..", - amountEffective: "USD:10", - amountRaw: "USD:10", + amountEffective: "USD:10" as AmountString, + amountRaw: "USD:10" as AmountString, contractTerms: { nonce: "123213123", @@ -314,7 +315,7 @@ export const PaymentPossible = tests.createExample(BaseView, { pay_deadline: { t_s: new Date().getTime() / 1000 + 60 * 60 * 3, }, - amount: "USD:10", + amount: "USD:10" as AmountString, summary: "some beers", } as Partial<ContractTerms> as any, contractTermsHash: "123456", @@ -340,8 +341,8 @@ export const PaymentPossibleWithFee = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.PaymentPossible, talerUri: "taler://pay/..", - amountEffective: "USD:10.20", - amountRaw: "USD:10", + amountEffective: "USD:10.20" as AmountString, + amountRaw: "USD:10" as AmountString, contractTerms: { nonce: "123213123", @@ -351,7 +352,7 @@ export const PaymentPossibleWithFee = tests.createExample(BaseView, { website: "https://www.themerchant.taler", email: "contact@merchant.taler", }, - amount: "USD:10", + amount: "USD:10" as AmountString, summary: "some beers", } as Partial<ContractTerms> as any, contractTermsHash: "123456", @@ -377,8 +378,8 @@ export const TicketWithAProductList = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.PaymentPossible, talerUri: "taler://pay/..", - amountEffective: "USD:10.20", - amountRaw: "USD:10", + amountEffective: "USD:10.20" as AmountString, + amountRaw: "USD:10" as AmountString, contractTerms: { nonce: "123213123", @@ -433,8 +434,8 @@ export const TicketWithShipping = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.PaymentPossible, talerUri: "taler://pay/..", - amountEffective: "USD:10.20", - amountRaw: "USD:10", + amountEffective: "USD:10.20" as AmountString, + amountRaw: "USD:10" as AmountString, contractTerms: { nonce: "123213123", @@ -481,8 +482,8 @@ export const AlreadyConfirmedByOther = tests.createExample(BaseView, { transactionId: " " as TransactionIdStr, status: PreparePayResultType.AlreadyConfirmed, talerUri: "taler://pay/..", - amountEffective: "USD:10", - amountRaw: "USD:10", + amountEffective: "USD:10" as AmountString, + amountRaw: "USD:10" as AmountString, contractTerms: { merchant: { name: "the merchant", diff --git a/packages/taler-wallet-webextension/src/cta/Payment/test.ts b/packages/taler-wallet-webextension/src/cta/Payment/test.ts index e2935fc4e..213382efc 100644 --- a/packages/taler-wallet-webextension/src/cta/Payment/test.ts +++ b/packages/taler-wallet-webextension/src/cta/Payment/test.ts @@ -20,6 +20,7 @@ */ import { + AmountString, Amounts, ConfirmPayResult, ConfirmPayResultType, @@ -139,10 +140,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:5", + available: "USD:5" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", @@ -199,10 +200,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:15", + available: "USD:15" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", @@ -262,10 +263,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:15", + available: "USD:15" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", @@ -323,10 +324,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:15", + available: "USD:15" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", @@ -392,10 +393,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:15", + available: "USD:15" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", @@ -480,10 +481,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:10", + available: "USD:10" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", @@ -511,10 +512,10 @@ describe("Payment CTA states", () => { { balances: [ { - available: "USD:15", + available: "USD:15" as AmountString, hasPendingTransactions: false, - pendingIncoming: "USD:0", - pendingOutgoing: "USD:0", + pendingIncoming: "USD:0" as AmountString, + pendingOutgoing: "USD:0" as AmountString, requiresUserInput: false, scopeInfo: { currency: "USD", |