diff options
author | Sebastian <sebasjm@gmail.com> | 2022-11-04 15:58:10 -0300 |
---|---|---|
committer | Sebastian <sebasjm@gmail.com> | 2022-11-04 15:58:10 -0300 |
commit | 709ac2349c2b5a73377f8a33669d6349aede1787 (patch) | |
tree | 96fcb27a74a4ff1fd32783373b837b2c46ceb08e /packages/taler-util | |
parent | cd6321d3034cfd5c31457fbe659fa5ae60f1cc04 (diff) |
read bic from iban payto
Diffstat (limited to 'packages/taler-util')
-rw-r--r-- | packages/taler-util/src/payto.ts | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/taler-util/src/payto.ts b/packages/taler-util/src/payto.ts index b474e533c..3073b991c 100644 --- a/packages/taler-util/src/payto.ts +++ b/packages/taler-util/src/payto.ts @@ -37,6 +37,7 @@ export interface PaytoUriIBAN extends PaytoUriGeneric { isKnown: true; targetType: "iban"; iban: string; + bic?: string; } export interface PaytoUriTalerBank extends PaytoUriGeneric { @@ -134,12 +135,24 @@ export function parsePaytoUri(s: string): PaytoUri | undefined { }; } if (targetType === "iban") { + const parts = targetPath.split("/"); + let iban: string | undefined = undefined; + let bic: string | undefined = undefined; + if (parts.length === 1) { + iban = parts[0] + } if (parts.length === 2) { + bic = parts[0] + iban = parts[1] + } else { + iban = targetPath + } return { isKnown: true, targetPath, targetType, params, - iban: targetPath, + iban, + bic, }; } if (targetType === "bitcoin") { |