aboutsummaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2024-06-06 09:24:50 -0300
committerSebastian <sebasjm@gmail.com>2024-06-06 10:41:22 -0300
commit920595aa3864615c07aba0ecfc233acf05f3e3e6 (patch)
treedab4f0d64ef57902996d98d46ea3dccd59fb4659 /packages
parent59b4e069c8f26bee6e6f9918a63cfb7051c5f529 (diff)
downloadwallet-core-920595aa3864615c07aba0ecfc233acf05f3e3e6.tar.xz
update bank api with card fee
Diffstat (limited to 'packages')
-rw-r--r--packages/taler-util/src/http-client/bank-integration.ts4
-rw-r--r--packages/taler-util/src/http-client/types.ts35
-rw-r--r--packages/taler-util/src/taler-error-codes.ts124
-rw-r--r--packages/taler-util/src/wallet-types.ts1
-rw-r--r--packages/taler-wallet-core/src/withdraw.ts5
5 files changed, 165 insertions, 4 deletions
diff --git a/packages/taler-util/src/http-client/bank-integration.ts b/packages/taler-util/src/http-client/bank-integration.ts
index 75e6a627a..08dab58e2 100644
--- a/packages/taler-util/src/http-client/bank-integration.ts
+++ b/packages/taler-util/src/http-client/bank-integration.ts
@@ -147,6 +147,10 @@ export class TalerBankIntegrationHttpClient {
return opKnownTalerFailure(details.code, details);
case TalerErrorCode.BANK_ACCOUNT_IS_NOT_EXCHANGE:
return opKnownTalerFailure(details.code, details);
+ case TalerErrorCode.BANK_AMOUNT_DIFFERS:
+ return opKnownTalerFailure(details.code, details);
+ case TalerErrorCode.BANK_AMOUNT_REQUIRED:
+ return opKnownTalerFailure(details.code, details);
default:
return opUnknownFailure(resp, details);
}
diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts
index 9268f6387..94f2c7518 100644
--- a/packages/taler-util/src/http-client/types.ts
+++ b/packages/taler-util/src/http-client/types.ts
@@ -1312,6 +1312,7 @@ export const codecForBankWithdrawalOperationStatus =
),
)
.property("amount", codecOptional(codecForAmountString()))
+ .property("card_fees", codecOptional(codecForAmountString()))
.property("sender_wire", codecOptional(codecForPaytoString()))
.property("suggested_exchange", codecOptional(codecForString()))
.property("confirm_transfer_url", codecOptional(codecForURL()))
@@ -2029,16 +2030,41 @@ export namespace TalerBankIntegrationApi {
status: WithdrawalOperationStatus;
// Amount that will be withdrawn with this operation
- // (raw amount without fee considerations).
- amount: AmountString | undefined;
+ // (raw amount without fee considerations). Only
+ // given once the amount is fixed and cannot be changed.
+ // Optional since **vC2EC**.
+ amount?: AmountString | undefined;
+
+ // Maximum amount that the wallet can choose to withdraw.
+ // Only applicable when the amount is not fixed.
+ // @since **vC2EC**.
+ max_amount?: AmountString | undefined;
+
+ // The non-Taler card fees the customer will have
+ // to pay to the bank / payment service provider
+ // they are using to make the withdrawal.
+ // @since **vC2EC**
+ card_fees?: AmountString | undefined;
// Bank account of the customer that is withdrawing, as a
// payto URI.
sender_wire?: PaytoString;
+ // Suggestion for the amount to be withdrawn with this
+ // operation. Given if a suggestion was made but the
+ // user may still change the amount.
+ // Optional since **vC2EC**.
+ suggested_amount?: AmountString | undefined;
+
// Suggestion for an exchange given by the bank.
suggested_exchange?: string;
+ // Base URL of an exchange that must be used. Optional,
+ // not given *unless* a particular exchange is mandatory.
+ // This value is typically set in the bank's configuration.
+ // @since **vC2EC**
+ required_exchange?: string;
+
// URL that the user needs to navigate to in order to
// complete some final confirmation (e.g. 2FA).
// It may contain withdrawal operation id
@@ -2062,6 +2088,11 @@ export namespace TalerBankIntegrationApi {
// Payto address of the exchange selected for the withdrawal.
selected_exchange: PaytoString;
+
+ // Selected amount to be transferred. Optional if the
+ // backend already knows the amount.
+ // @since **vC2EC**
+ amount?: AmountString | undefined;
}
export interface BankWithdrawalOperationPostResponse {
diff --git a/packages/taler-util/src/taler-error-codes.ts b/packages/taler-util/src/taler-error-codes.ts
index 9985e74b3..c463d94a0 100644
--- a/packages/taler-util/src/taler-error-codes.ts
+++ b/packages/taler-util/src/taler-error-codes.ts
@@ -354,7 +354,7 @@ export enum TalerErrorCode {
/**
* The backend could not locate a required template to generate an HTML reply. The system administrator should check if the resource files are installed in the correct location and are readable to the service.
- * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
+ * Returned with an HTTP status code of #MHD_HTTP_NOT_ACCEPTABLE (406).
* (A value of 0 indicates that the error is generated client-side).
*/
GENERIC_FAILED_TO_LOAD_TEMPLATE = 74,
@@ -1945,7 +1945,7 @@ export enum TalerErrorCode {
/**
- * The payto-URI hash did not match. Hence the request was denied.
+ * The KYC authorization signature was invalid. Hence the request was denied.
* Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).
* (A value of 0 indicates that the error is generated client-side).
*/
@@ -2017,6 +2017,22 @@ export enum TalerErrorCode {
/**
+ * The exchange is unaware of the given requirement row.
+ * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ EXCHANGE_KYC_CHECK_REQUEST_UNKNOWN = 1939,
+
+
+ /**
+ * The exchange has no account public key to check the KYC authorization signature against. Hence the request was denied. The user should do a wire transfer to the exchange with the KYC authorization key in the subject.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ EXCHANGE_KYC_CHECK_AUTHORIZATION_KEY_UNKNOWN = 1940,
+
+
+ /**
* The exchange does not know a contract under the given contract public key.
* Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
* (A value of 0 indicates that the error is generated client-side).
@@ -2105,6 +2121,14 @@ export enum TalerErrorCode {
/**
+ * The product category is not known to the backend.
+ * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ MERCHANT_GENERIC_CATEGORY_UNKNOWN = 2003,
+
+
+ /**
* The proposal is not known to the backend.
* Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
* (A value of 0 indicates that the error is generated client-side).
@@ -3057,6 +3081,14 @@ export enum TalerErrorCode {
/**
+ * A category with the same name exists already.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ MERCHANT_PRIVATE_POST_CATEGORIES_CONFLICT_CATEGORY_EXISTS = 2651,
+
+
+ /**
* The update would have reduced the total amount of product lost, which is not allowed.
* Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
* (A value of 0 indicates that the error is generated client-side).
@@ -3233,6 +3265,22 @@ export enum TalerErrorCode {
/**
+ * The auditor refused the connection due to a lack of authorization.
+ * Returned with an HTTP status code of #MHD_HTTP_UNAUTHORIZED (401).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ AUDITOR_GENERIC_UNAUTHORIZED = 3001,
+
+
+ /**
+ * This method is not allowed here.
+ * Returned with an HTTP status code of #MHD_HTTP_METHOD_NOT_ALLOWED (405).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ AUDITOR_GENERIC_METHOD_NOT_ALLOWED = 3002,
+
+
+ /**
* The signature from the exchange on the deposit confirmation is invalid.
* Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).
* (A value of 0 indicates that the error is generated client-side).
@@ -3633,6 +3681,22 @@ export enum TalerErrorCode {
/**
+ * Specified amount will not work for this withdrawal.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ BANK_AMOUNT_DIFFERS = 5148,
+
+
+ /**
+ * The backend requires an amount to be specified.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ BANK_AMOUNT_REQUIRED = 5149,
+
+
+ /**
* The sync service failed find the account in its database.
* Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
* (A value of 0 indicates that the error is generated client-side).
@@ -4609,6 +4673,62 @@ export enum TalerErrorCode {
/**
+ * The Donau is not aware of the donation unit requested for the operation.
+ * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_GENERIC_DONATION_UNIT_UNKNOWN = 8611,
+
+
+ /**
+ * The Donau failed to talk to the process responsible for its private donation unit keys or the helpers had no donation units (properly) configured.
+ * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_DONATION_UNIT_HELPER_UNAVAILABLE = 8612,
+
+
+ /**
+ * The Donau failed to talk to the process responsible for its private signing keys.
+ * Returned with an HTTP status code of #MHD_HTTP_BAD_GATEWAY (502).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_SIGNKEY_HELPER_UNAVAILABLE = 8613,
+
+
+ /**
+ * The response from the online signing key helper process was malformed.
+ * Returned with an HTTP status code of #MHD_HTTP_INTERNAL_SERVER_ERROR (500).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_SIGNKEY_HELPER_BUG = 8614,
+
+
+ /**
+ * The number of segments included in the URI does not match the number of segments expected by the endpoint.
+ * Returned with an HTTP status code of #MHD_HTTP_NOT_FOUND (404).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_GENERIC_WRONG_NUMBER_OF_SEGMENTS = 8615,
+
+
+ /**
+ * The signature of the donation receipt is not valid.
+ * Returned with an HTTP status code of #MHD_HTTP_FORBIDDEN (403).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_DONATION_RECEIPT_SIGNATURE_INVALID = 8616,
+
+
+ /**
+ * The client re-used a unique donor identifier nonce, which is not allowed.
+ * Returned with an HTTP status code of #MHD_HTTP_CONFLICT (409).
+ * (A value of 0 indicates that the error is generated client-side).
+ */
+ DONAU_DONOR_IDENTIFIER_NONCE_REUSE = 8617,
+
+
+ /**
* A generic error happened in the LibEuFin nexus. See the enclose details JSON for more information.
* Returned with an HTTP status code of #MHD_HTTP_UNINITIALIZED (0).
* (A value of 0 indicates that the error is generated client-side).
diff --git a/packages/taler-util/src/wallet-types.ts b/packages/taler-util/src/wallet-types.ts
index 24a48b415..a7cd65fa2 100644
--- a/packages/taler-util/src/wallet-types.ts
+++ b/packages/taler-util/src/wallet-types.ts
@@ -988,6 +988,7 @@ export interface BankWithdrawDetails {
status: WithdrawalOperationStatus;
currency: string;
amount: AmountJson | undefined;
+ wireFee: AmountJson | undefined;
senderWire?: string;
suggestedExchange?: string;
confirmTransferUrl?: string;
diff --git a/packages/taler-wallet-core/src/withdraw.ts b/packages/taler-wallet-core/src/withdraw.ts
index b2cecea16..24e2861e1 100644
--- a/packages/taler-wallet-core/src/withdraw.ts
+++ b/packages/taler-wallet-core/src/withdraw.ts
@@ -862,12 +862,17 @@ export async function getBankWithdrawalInfo(
if (status.amount) {
amount = Amounts.parseOrThrow(status.amount);
}
+ let wireFee: AmountJson | undefined;
+ if (status.card_fees) {
+ wireFee = Amounts.parseOrThrow(status.card_fees);
+ }
return {
operationId: uriResult.withdrawalOperationId,
apiBaseUrl: uriResult.bankIntegrationApiBaseUrl,
currency: config.currency,
amount,
+ wireFee,
confirmTransferUrl: status.confirm_transfer_url,
senderWire: status.sender_wire,
suggestedExchange: status.suggested_exchange,