@swan-io/shared-business 8.15.0 → 8.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/shared-business",
3
- "version": "8.15.0",
3
+ "version": "8.15.1",
4
4
  "engines": {
5
5
  "node": ">=20.9.0",
6
6
  "yarn": "^1.22.0"
@@ -10,12 +10,14 @@ type TransactionStatementV1Props = {
10
10
  generationDate: string;
11
11
  executionDate: string;
12
12
  type: TransactionType;
13
- amount: Amount;
13
+ amount?: Amount;
14
14
  targetTransferAmount?: Amount;
15
+ instructedAmount?: Amount;
16
+ amountCredited?: Amount;
15
17
  exchangeRate?: [Amount, Amount];
16
18
  fees?: Amount;
17
19
  label: string;
18
- reference: string;
20
+ reference?: string;
19
21
  debtorName: string;
20
22
  debtorAccountNumber: string;
21
23
  debtorBankName?: string;
@@ -26,7 +28,7 @@ type TransactionStatementV1Props = {
26
28
  creditorBankIdentifier?: string;
27
29
  style?: StyleProp<ViewStyle>;
28
30
  };
29
- export declare const TransactionStatementV1: ({ partnerLogoUrl, generationDate, executionDate, type, amount, targetTransferAmount, exchangeRate, fees, label, reference, debtorName, debtorAccountNumber, debtorBankName, debtorBankIdentifier, creditorName, creditorAccountNumber, creditorBankName, creditorBankIdentifier, style, }: TransactionStatementV1Props) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const TransactionStatementV1: ({ partnerLogoUrl, generationDate, executionDate, type, amount, instructedAmount, amountCredited, targetTransferAmount, exchangeRate, fees, label, reference, debtorName, debtorAccountNumber, debtorBankName, debtorBankIdentifier, creditorName, creditorAccountNumber, creditorBankName, creditorBankIdentifier, style, }: TransactionStatementV1Props) => import("react/jsx-runtime").JSX.Element;
30
32
  export type TransactionStatementProps = TransactionStatementV1Props;
31
33
  export declare const TransactionStatement: (props: TransactionStatementProps) => import("react/jsx-runtime").JSX.Element;
32
34
  export {};
@@ -9,7 +9,7 @@ import { colors, fonts, interFontStyle } from "@swan-io/lake/src/constants/desig
9
9
  import { isNotNullish, isNotNullishOrEmpty } from "@swan-io/lake/src/utils/nullish";
10
10
  import { StyleSheet, Text, View } from "react-native";
11
11
  import { match } from "ts-pattern";
12
- import { formatCurrency, t } from "../utils/i18n";
12
+ import { formatCurrencyIso, t } from "../utils/i18n";
13
13
  const LOGO_MAX_HEIGHT = 24;
14
14
  const LOGO_MAX_WIDTH = 150;
15
15
  const getTextStyle = (type, fontSize) => ({
@@ -73,7 +73,7 @@ const logoStyle = {
73
73
  objectFit: "contain",
74
74
  objectPosition: "left",
75
75
  };
76
- export const TransactionStatementV1 = ({ partnerLogoUrl, generationDate, executionDate, type, amount, targetTransferAmount, exchangeRate, fees, label, reference, debtorName, debtorAccountNumber, debtorBankName, debtorBankIdentifier, creditorName, creditorAccountNumber, creditorBankName, creditorBankIdentifier, style, }) => {
76
+ export const TransactionStatementV1 = ({ partnerLogoUrl, generationDate, executionDate, type, amount, instructedAmount, amountCredited, targetTransferAmount, exchangeRate, fees, label, reference, debtorName, debtorAccountNumber, debtorBankName, debtorBankIdentifier, creditorName, creditorAccountNumber, creditorBankName, creditorBankIdentifier, style, }) => {
77
77
  return (_jsxs(View, { style: [styles.container, style], children: [_jsxs(Box, { direction: "row", alignItems: "center", children: [isNotNullishOrEmpty(partnerLogoUrl) ? (_jsx("img", { src: partnerLogoUrl, style: logoStyle })) : (_jsx(SwanLogo, { style: styles.defaultLogo })), _jsx(Separator, { horizontal: true, space: 8 }), _jsx(Text, { style: styles.partnershipText, children: t("transactionStatement.partnership") }), _jsx(Space, { width: 4 }), _jsx(SwanLogo, { color: colors.gray[900], style: styles.swanLogo })] }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.pageTitle, children: t("transactionStatement.title.document") }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.sectionTitle, children: t("transactionStatement.title.information") }), _jsx(Space, { height: 8 }), _jsxs(Stack, { space: 8, children: [_jsx(Line, { name: t("transactionStatement.information.executionDate"), value: executionDate }), _jsx(Line, { name: t("transactionStatement.information.type"), value: match(type)
78
78
  .with("SepaCreditTransferIn", () => t("transactionStatement.type.SepaCreditTransferIn"))
79
79
  .with("SepaCreditTransferOut", () => t("transactionStatement.type.SepaCreditTransferOut"))
@@ -83,7 +83,7 @@ export const TransactionStatementV1 = ({ partnerLogoUrl, generationDate, executi
83
83
  .with("InternalCreditTransferOut", () => t("transactionStatement.type.InternalCreditTransferOut"))
84
84
  .with("InternationalCreditTransferIn", () => t("transactionStatement.type.InternationalCreditTransferIn"))
85
85
  .with("InternationalCreditTransferOut", () => t("transactionStatement.type.InternationalCreditTransferOut"))
86
- .exhaustive() }), _jsx(Line, { name: t("transactionStatement.information.amount"), value: formatCurrency(Number(amount.value), amount.currency) }), isNotNullish(targetTransferAmount) && (_jsx(Line, { name: t("transactionStatement.information.targetTransferAmount"), value: formatCurrency(Number(targetTransferAmount.value), targetTransferAmount.currency) })), isNotNullish(exchangeRate) && (_jsx(Line, { name: t("transactionStatement.information.exchangeRate"), value: `${formatCurrency(Number(exchangeRate[0].value), exchangeRate[0].currency)} : ${formatCurrency(Number(exchangeRate[1].value), exchangeRate[1].currency)}` })), isNotNullish(fees) && (_jsx(Line, { name: t("transactionStatement.information.fees"), value: formatCurrency(Number(fees.value), fees.currency) })), _jsx(Line, { name: "Label", value: label }), _jsx(Line, { name: "Reference", value: reference })] }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.sectionTitle, children: t("transactionStatement.title.debtor") }), _jsx(Space, { height: 8 }), _jsxs(Stack, { space: 8, children: [_jsx(Line, { name: t("transactionStatement.debtor.name"), value: debtorName }), _jsx(Line, { name: t("transactionStatement.debtor.accountNumber"), value: debtorAccountNumber }), isNotNullishOrEmpty(debtorBankName) && (_jsx(Line, { name: t("transactionStatement.debtor.bankName"), value: debtorBankName })), isNotNullishOrEmpty(debtorBankIdentifier) && (_jsx(Line, { name: t("transactionStatement.debtor.bankIdentifier"), value: debtorBankIdentifier }))] }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.sectionTitle, children: t("transactionStatement.title.creditor") }), _jsx(Space, { height: 8 }), _jsxs(Stack, { space: 8, children: [_jsx(Line, { name: t("transactionStatement.creditor.name"), value: creditorName }), _jsx(Line, { name: t("transactionStatement.creditor.accountNumber"), value: creditorAccountNumber }), isNotNullishOrEmpty(creditorBankName) && (_jsx(Line, { name: t("transactionStatement.creditor.bankName"), value: creditorBankName })), isNotNullishOrEmpty(creditorBankIdentifier) && (_jsx(Line, { name: t("transactionStatement.creditor.bankIdentifier"), value: creditorBankIdentifier }))] }), _jsx(Fill, { minHeight: 8 }), _jsx(Text, { style: styles.generationInfos, children: t("transactionStatement.generationDate", { date: generationDate }) }), _jsx(Space, { height: 8 }), _jsx(Text, { style: styles.generationInfos, children: t("transactionStatement.generationInfos") }), _jsx(Separator, { space: 24 }), _jsx(Text, { style: styles.footer, children: t("transactionStatement.footer") })] }));
86
+ .exhaustive() }), isNotNullish(instructedAmount) && (_jsx(Line, { name: t("transactionStatement.information.instructedAmount"), value: formatCurrencyIso(Number(instructedAmount.value), instructedAmount.currency) })), isNotNullish(amountCredited) && (_jsx(Line, { name: t("transactionStatement.information.amountCredited"), value: formatCurrencyIso(Number(amountCredited.value), amountCredited.currency) })), isNotNullish(amount) && (_jsx(Line, { name: t("transactionStatement.information.amount"), value: formatCurrencyIso(Number(amount.value), amount.currency) })), isNotNullish(targetTransferAmount) && (_jsx(Line, { name: t("transactionStatement.information.targetTransferAmount"), value: formatCurrencyIso(Number(targetTransferAmount.value), targetTransferAmount.currency) })), isNotNullish(exchangeRate) && (_jsx(Line, { name: t("transactionStatement.information.exchangeRate"), value: `${formatCurrencyIso(Number(exchangeRate[0].value), exchangeRate[0].currency)} = ${formatCurrencyIso(Number(exchangeRate[1].value), exchangeRate[1].currency)}` })), isNotNullish(fees) && (_jsx(Line, { name: t("transactionStatement.information.fees"), value: formatCurrencyIso(Number(fees.value), fees.currency) })), _jsx(Line, { name: "Label", value: label }), isNotNullish(reference) && _jsx(Line, { name: "Reference", value: reference })] }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.sectionTitle, children: t("transactionStatement.title.debtor") }), _jsx(Space, { height: 8 }), _jsxs(Stack, { space: 8, children: [_jsx(Line, { name: t("transactionStatement.debtor.name"), value: debtorName }), _jsx(Line, { name: t("transactionStatement.debtor.accountNumber"), value: debtorAccountNumber }), isNotNullishOrEmpty(debtorBankName) && (_jsx(Line, { name: t("transactionStatement.debtor.bankName"), value: debtorBankName })), isNotNullishOrEmpty(debtorBankIdentifier) && (_jsx(Line, { name: t("transactionStatement.debtor.bankIdentifier"), value: debtorBankIdentifier }))] }), _jsx(Space, { height: 24 }), _jsx(Text, { style: styles.sectionTitle, children: t("transactionStatement.title.creditor") }), _jsx(Space, { height: 8 }), _jsxs(Stack, { space: 8, children: [_jsx(Line, { name: t("transactionStatement.creditor.name"), value: creditorName }), _jsx(Line, { name: t("transactionStatement.creditor.accountNumber"), value: creditorAccountNumber }), isNotNullishOrEmpty(creditorBankName) && (_jsx(Line, { name: t("transactionStatement.creditor.bankName"), value: creditorBankName })), isNotNullishOrEmpty(creditorBankIdentifier) && (_jsx(Line, { name: t("transactionStatement.creditor.bankIdentifier"), value: creditorBankIdentifier }))] }), _jsx(Fill, { minHeight: 8 }), _jsx(Text, { style: styles.generationInfos, children: t("transactionStatement.generationDate", { date: generationDate }) }), _jsx(Space, { height: 8 }), _jsx(Text, { style: styles.generationInfos, children: t("transactionStatement.generationInfos") }), _jsx(Separator, { space: 24 }), _jsx(Text, { style: styles.footer, children: t("transactionStatement.footer") })] }));
87
87
  };
88
88
  export const TransactionStatement = (props) => match(props)
89
89
  .with({ version: "v1" }, props => _jsx(TransactionStatementV1, { ...props }))
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Generiert am:{date}",
286
286
  "transactionStatement.generationInfos": "Dieses Dokument bestätigt Ihren Transaktionsantrag. Es stellt keinen Nachweis der Transaktionsausführung dar. Ihre Transaktion wird nach Bestehen eines obligatorischen Verifizierungsprozesses ausgeführt.",
287
287
  "transactionStatement.information.amount": "Betrag",
288
+ "transactionStatement.information.amountCredited": "Betrag gutgeschrieben",
288
289
  "transactionStatement.information.exchangeRate": "Wechselkurs",
289
290
  "transactionStatement.information.executionDate": "Ausführungsdatum",
290
291
  "transactionStatement.information.fees": "Gebühren",
292
+ "transactionStatement.information.instructedAmount": "Angewiesener Betrag",
291
293
  "transactionStatement.information.label": "Etikett",
292
294
  "transactionStatement.information.reference": "Kundenreferenz",
293
295
  "transactionStatement.information.targetTransferAmount": "Zielbetrag der Überweisung",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Generated on: {date}",
286
286
  "transactionStatement.generationInfos": "This document is confirmation of your transaction request. It doesn't constitute proof of transaction execution. Your transaction will be executed after passing a mandatory verification process.",
287
287
  "transactionStatement.information.amount": "Amount",
288
+ "transactionStatement.information.amountCredited": "Amount credited",
288
289
  "transactionStatement.information.exchangeRate": "Exchange rate",
289
290
  "transactionStatement.information.executionDate": "Execution date",
290
291
  "transactionStatement.information.fees": "Fees",
292
+ "transactionStatement.information.instructedAmount": "Instructed amount",
291
293
  "transactionStatement.information.label": "Label",
292
294
  "transactionStatement.information.reference": "Reference",
293
295
  "transactionStatement.information.targetTransferAmount": "Target transfer amount",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Generado el: {date}",
286
286
  "transactionStatement.generationInfos": "Este documento es la confirmación de tu solicitud de transacción. No constituye una prueba de la ejecución de la transacción. La transacción se ejecutará tras pasar un proceso de verificación obligatorio.",
287
287
  "transactionStatement.information.amount": "Monto",
288
+ "transactionStatement.information.amountCredited": "Importe abonado",
288
289
  "transactionStatement.information.exchangeRate": "Tipo de cambio",
289
290
  "transactionStatement.information.executionDate": "Fecha de ejecución",
290
291
  "transactionStatement.information.fees": "Tasas",
292
+ "transactionStatement.information.instructedAmount": "Importe instruido",
291
293
  "transactionStatement.information.label": "Etiqueta",
292
294
  "transactionStatement.information.reference": "Referencia",
293
295
  "transactionStatement.information.targetTransferAmount": "Importe objetivo de la transferencia",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Generated on: {date}",
286
286
  "transactionStatement.generationInfos": "This document is confirmation of your transaction request. It doesn't constitute proof of transaction execution. Your transaction will be executed after passing a mandatory verification process.",
287
287
  "transactionStatement.information.amount": "Summa",
288
+ "transactionStatement.information.amountCredited": "Hyvitetty määrä",
288
289
  "transactionStatement.information.exchangeRate": "Vaihtokurssi",
289
290
  "transactionStatement.information.executionDate": "Suorituksen päivämäärä",
290
291
  "transactionStatement.information.fees": "Maksut",
292
+ "transactionStatement.information.instructedAmount": "Ohjeistettu määrä",
291
293
  "transactionStatement.information.label": "Viesti",
292
294
  "transactionStatement.information.reference": "Viite",
293
295
  "transactionStatement.information.targetTransferAmount": "Target transfer amount",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Généré le : {date}",
286
286
  "transactionStatement.generationInfos": "Ce document atteste de votre demande de transaction. En aucun cas il ne constitue une preuve de son exécution. Votre transaction sera exécutée après un processus de vérification obligatoire.",
287
287
  "transactionStatement.information.amount": "Montant",
288
+ "transactionStatement.information.amountCredited": "Montant crédité",
288
289
  "transactionStatement.information.exchangeRate": "Taux de change",
289
290
  "transactionStatement.information.executionDate": "Date d'exécution",
290
291
  "transactionStatement.information.fees": "Frais",
292
+ "transactionStatement.information.instructedAmount": "Montant indiqué",
291
293
  "transactionStatement.information.label": "Libellé",
292
294
  "transactionStatement.information.reference": "Référence",
293
295
  "transactionStatement.information.targetTransferAmount": "Montant de la demande de transfert",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Generato il: {date}",
286
286
  "transactionStatement.generationInfos": "Questo documento è la conferma della tua richiesta di transazione. Non costituisce prova dell'esecuzione della transazione. La tua transazione verrà eseguita dopo aver superato un obbligatorio processo di verifica.",
287
287
  "transactionStatement.information.amount": "Importo",
288
+ "transactionStatement.information.amountCredited": "Importo accreditato",
288
289
  "transactionStatement.information.exchangeRate": "Tasso di cambio",
289
290
  "transactionStatement.information.executionDate": "Data di esecuzione",
290
291
  "transactionStatement.information.fees": "Commissioni",
292
+ "transactionStatement.information.instructedAmount": "Importo istruito",
291
293
  "transactionStatement.information.label": "Etichetta",
292
294
  "transactionStatement.information.reference": "Riferimento",
293
295
  "transactionStatement.information.targetTransferAmount": "Importo di trasferimento previsto",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Gegenereerd op: {date}",
286
286
  "transactionStatement.generationInfos": "Dit document bevestigt je transactieverzoek. Het vormt geen bewijs van transactie-uitvoering. Je transactie zal worden uitgevoerd na het doorlopen van een verplicht verificatieproces.",
287
287
  "transactionStatement.information.amount": "Bedrag",
288
+ "transactionStatement.information.amountCredited": "Bedrag bijgeschreven",
288
289
  "transactionStatement.information.exchangeRate": "Wisselkoers",
289
290
  "transactionStatement.information.executionDate": "Uitvoeringsdatum",
290
291
  "transactionStatement.information.fees": "Kosten",
292
+ "transactionStatement.information.instructedAmount": "Instructiebedrag",
291
293
  "transactionStatement.information.label": "Etiket",
292
294
  "transactionStatement.information.reference": "Referentie",
293
295
  "transactionStatement.information.targetTransferAmount": "Doeloverdracht",
@@ -285,9 +285,11 @@
285
285
  "transactionStatement.generationDate": "Gerado em:{date}",
286
286
  "transactionStatement.generationInfos": "Este documento é a confirmação do seu pedido de transação. Não constitui prova da execução da transação. A sua transação será executada ao completar o processo de verificação obrigatório.",
287
287
  "transactionStatement.information.amount": "Valor",
288
+ "transactionStatement.information.amountCredited": "Valor creditado",
288
289
  "transactionStatement.information.exchangeRate": "Taxa de câmbio",
289
290
  "transactionStatement.information.executionDate": "Data de execução",
290
291
  "transactionStatement.information.fees": "Taxas",
292
+ "transactionStatement.information.instructedAmount": "Valor instruído",
291
293
  "transactionStatement.information.label": "Etiqueta",
292
294
  "transactionStatement.information.reference": "Referência",
293
295
  "transactionStatement.information.targetTransferAmount": "Montante de transferência pretendido",
@@ -18,7 +18,7 @@ type Locale = {
18
18
  };
19
19
  export declare const locale: Locale;
20
20
  export declare const t: (key: TranslationKey, params?: TranslationParams) => string;
21
- export declare const formatCurrency: (value: number, currency: string) => string;
21
+ export declare const formatCurrencyIso: (value: number, currency: string) => string;
22
22
  export declare const formatNestedMessage: (key: TranslationKey, params: Record<string, string | number | ReactElement | ((children: ReactNode) => ReactNode)>) => (string | ReactElement<any, string | import("react").JSXElementConstructor<any>>)[];
23
23
  export declare const rifmDateProps: RifmProps;
24
24
  export declare const isTranslationKey: (value: unknown) => value is TranslationKey;
package/src/utils/i18n.js CHANGED
@@ -116,7 +116,7 @@ const intl = createIntl({
116
116
  messages: locale.translations,
117
117
  }, createIntlCache());
118
118
  export const t = (key, params) => intl.formatMessage({ id: key, defaultMessage: translationEN[key] }, params).toString();
119
- export const formatCurrency = (value, currency) => intl.formatNumber(value, { style: "currency", currency });
119
+ export const formatCurrencyIso = (value, currency) => `${intl.formatNumber(value, { style: "decimal", minimumFractionDigits: 2 })} ${currency}`;
120
120
  export const formatNestedMessage = (key, params) => {
121
121
  const result = intl.formatMessage({ id: key, defaultMessage: translationEN[key] },
122
122
  // @ts-expect-error