aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian <sebasjm@gmail.com>2023-11-29 13:41:22 -0300
committerSebastian <sebasjm@gmail.com>2023-11-29 15:10:35 -0300
commit4324a5c3bf3ba636b99440c94986420c795dc03a (patch)
tree270bd487d64be80175d38218c0c95bd06f266f3a
parent1a0293add0a9c81eb035da57400254c8203ab9a6 (diff)
new api for creating account
-rw-r--r--packages/taler-util/src/http-client/bank-core.ts4
-rw-r--r--packages/taler-util/src/http-client/types.ts13
2 files changed, 15 insertions, 2 deletions
diff --git a/packages/taler-util/src/http-client/bank-core.ts b/packages/taler-util/src/http-client/bank-core.ts
index 9d1a18e04..83adb6370 100644
--- a/packages/taler-util/src/http-client/bank-core.ts
+++ b/packages/taler-util/src/http-client/bank-core.ts
@@ -31,7 +31,7 @@ import { TalerAuthenticationHttpClient } from "./authentication.js";
import { TalerBankIntegrationHttpClient } from "./bank-integration.js";
import { TalerRevenueHttpClient } from "./bank-revenue.js";
import { TalerWireGatewayHttpClient } from "./bank-wire.js";
-import { AccessToken, PaginationParams, TalerCorebankApi, UserAndToken, codecForAccountData, codecForBankAccountCreateWithdrawalResponse, codecForBankAccountGetWithdrawalResponse, codecForBankAccountTransactionInfo, codecForBankAccountTransactionsResponse, codecForCashinConversionResponse, codecForCashoutConversionResponse, codecForCashoutPending, codecForCashoutStatusResponse, codecForCashouts, codecForCoreBankConfig, codecForGlobalCashouts, codecForListBankAccountsResponse, codecForMonitorResponse, codecForPublicAccountsResponse } from "./types.js";
+import { AccessToken, PaginationParams, TalerCorebankApi, UserAndToken, codecForAccountData, codecForBankAccountCreateWithdrawalResponse, codecForBankAccountGetWithdrawalResponse, codecForBankAccountTransactionInfo, codecForBankAccountTransactionsResponse, codecForCashinConversionResponse, codecForCashoutConversionResponse, codecForCashoutPending, codecForCashoutStatusResponse, codecForCashouts, codecForCoreBankConfig, codecForGlobalCashouts, codecForListBankAccountsResponse, codecForMonitorResponse, codecForPublicAccountsResponse, codecForRegisterAccountResponse } from "./types.js";
import { addPaginationParams, makeBearerTokenAuthHeader } from "./utils.js";
import { TalerBankConversionHttpClient } from "./bank-conversion.js";
@@ -94,7 +94,7 @@ export class TalerCoreBankHttpClient {
},
});
switch (resp.status) {
- case HttpStatusCode.Created: return opEmptySuccess()
+ case HttpStatusCode.Ok: return opSuccess(resp, codecForRegisterAccountResponse())
case HttpStatusCode.BadRequest: return opKnownFailure("invalid-phone-or-email", resp);
case HttpStatusCode.Unauthorized: return opKnownFailure("unauthorized", resp);
case HttpStatusCode.Conflict: {
diff --git a/packages/taler-util/src/http-client/types.ts b/packages/taler-util/src/http-client/types.ts
index bc9c2bc82..153cb340c 100644
--- a/packages/taler-util/src/http-client/types.ts
+++ b/packages/taler-util/src/http-client/types.ts
@@ -380,6 +380,14 @@ export const codecForBankAccountTransactionInfo =
.property("date", codecForTimestamp)
.build("TalerCorebankApi.BankAccountTransactionInfo");
+
+export const codecForRegisterAccountResponse =
+ (): Codec<TalerCorebankApi.RegisterAccountResponse> =>
+ buildCodecForObject<TalerCorebankApi.RegisterAccountResponse>()
+ .property("internal_payto_uri", codecForPaytoString())
+ .build("TalerCorebankApi.RegisterAccountResponse");
+
+
export const codecForBankAccountCreateWithdrawalResponse =
(): Codec<TalerCorebankApi.BankAccountCreateWithdrawalResponse> =>
buildCodecForObject<TalerCorebankApi.BankAccountCreateWithdrawalResponse>()
@@ -1283,6 +1291,11 @@ export namespace TalerCorebankApi {
amount?: AmountString;
}
+ export interface RegisterAccountResponse {
+ // Internal payto URI of this bank account.
+ internal_payto_uri: PaytoString;
+ }
+
export interface RegisterAccountRequest {
// Username
username: string;