routex-client 0.4.8 → 0.5.0
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/README.md +16 -0
- package/client.d.ts +89 -1
- package/index.js +102 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,6 +4,22 @@ A client for [YAXI](https://yaxi.tech/)'s Open Banking services.
|
|
|
4
4
|
|
|
5
5
|
## Changelog
|
|
6
6
|
|
|
7
|
+
### [0.5.0] - 2026-02-20
|
|
8
|
+
|
|
9
|
+
#### Added
|
|
10
|
+
|
|
11
|
+
- `RoutexClient.systemVersion`
|
|
12
|
+
- `RoutexClient.transfer`, `RoutexClient.respondTransfer`, `RoutexClient.confirmTransfer`
|
|
13
|
+
|
|
14
|
+
#### Removed
|
|
15
|
+
|
|
16
|
+
- `RoutexClient.measurement`
|
|
17
|
+
|
|
18
|
+
#### Fixed
|
|
19
|
+
|
|
20
|
+
- `AccountFilter.any` with more than two elements
|
|
21
|
+
- `PaymentFailedException.userMessage` was always `undefined`
|
|
22
|
+
|
|
7
23
|
### [0.4.8] - 2026-02-04
|
|
8
24
|
|
|
9
25
|
#### Added
|
package/client.d.ts
CHANGED
|
@@ -138,10 +138,78 @@ export interface CollectPaymentOptions extends ServiceOptions {
|
|
|
138
138
|
currency?: string;
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
+
export interface TransferOptions extends ServiceOptions {
|
|
142
|
+
product: PaymentProduct;
|
|
143
|
+
debtorAccount?: AccountReference;
|
|
144
|
+
debtorName?: string;
|
|
145
|
+
requestedExecutionDate?: Date;
|
|
146
|
+
details: {
|
|
147
|
+
endToEndIdentification?: string;
|
|
148
|
+
amount: {
|
|
149
|
+
/**
|
|
150
|
+
* Decimal amount, e.g. "123.45".
|
|
151
|
+
*/
|
|
152
|
+
amount: string | number;
|
|
153
|
+
/**
|
|
154
|
+
* ISO 4217 Alpha 3 currency code.
|
|
155
|
+
*/
|
|
156
|
+
currency: string;
|
|
157
|
+
};
|
|
158
|
+
creditorAccount: {
|
|
159
|
+
iban: string;
|
|
160
|
+
};
|
|
161
|
+
creditorAgentBic?: string;
|
|
162
|
+
creditorName: string;
|
|
163
|
+
creditorAddress?: {
|
|
164
|
+
townName: string;
|
|
165
|
+
/**
|
|
166
|
+
* ISO 3166-1 ALPHA-2 country code.
|
|
167
|
+
*/
|
|
168
|
+
country: string;
|
|
169
|
+
};
|
|
170
|
+
remittance?: string;
|
|
171
|
+
chargeBearer?: ChargeBearer;
|
|
172
|
+
}[];
|
|
173
|
+
}
|
|
141
174
|
interface AccountReference {
|
|
142
175
|
iban: string;
|
|
143
176
|
currency?: string;
|
|
144
177
|
}
|
|
178
|
+
export declare enum PaymentProduct {
|
|
179
|
+
/**
|
|
180
|
+
* SEPA Credit Transfer (SCT) in EUR
|
|
181
|
+
*/
|
|
182
|
+
SepaCreditTransfer = "SEPA_CREDIT_TRANSFER",
|
|
183
|
+
/**
|
|
184
|
+
* SEPA Instant Credit Transfer (SCT Inst) in EUR
|
|
185
|
+
*/
|
|
186
|
+
SepaInstantCreditTransfer = "SEPA_INSTANT_CREDIT_TRANSFER",
|
|
187
|
+
/**
|
|
188
|
+
* Default SEPA Credit Transfer in EUR
|
|
189
|
+
*
|
|
190
|
+
* Tries SCT Inst with a fallback to SCT if this is supported.
|
|
191
|
+
* Otherwise, SCT is used.
|
|
192
|
+
*/
|
|
193
|
+
DefaultSepaCreditTransfer = "DEFAULT_SEPA_CREDIT_TRANSFER",
|
|
194
|
+
/**
|
|
195
|
+
* International credit transfer outside of SEPA (typically SWIFT)
|
|
196
|
+
*/
|
|
197
|
+
CrossBorderCreditTransfer = "CROSS_BORDER_CREDIT_TRANSFER",
|
|
198
|
+
/**
|
|
199
|
+
* Domestic credit transfer in the domestic, non-EUR currency
|
|
200
|
+
*/
|
|
201
|
+
DomesticCreditTransfer = "DOMESTIC_CREDIT_TRANSFER",
|
|
202
|
+
/**
|
|
203
|
+
* Instant domestic credit transfer in the domestic, non-EUR currency
|
|
204
|
+
*/
|
|
205
|
+
DomesticInstantCreditTransfer = "DOMESTIC_INSTANT_CREDIT_TRANSFER"
|
|
206
|
+
}
|
|
207
|
+
export declare enum ChargeBearer {
|
|
208
|
+
BorneByDebtor = "DEBT",
|
|
209
|
+
BorneByCreditor = "CRED",
|
|
210
|
+
Shared = "SHAR",
|
|
211
|
+
FollowingServiceLevel = "SLEV"
|
|
212
|
+
}
|
|
145
213
|
export interface Credentials {
|
|
146
214
|
connectionId: string;
|
|
147
215
|
userId?: string;
|
|
@@ -499,6 +567,10 @@ export declare class RoutexClient {
|
|
|
499
567
|
constructor(options?: RoutexClientOptions);
|
|
500
568
|
private _unsealBody;
|
|
501
569
|
private _request;
|
|
570
|
+
/**
|
|
571
|
+
* System version for the currently established session
|
|
572
|
+
*/
|
|
573
|
+
systemVersion(): string | undefined;
|
|
502
574
|
/**
|
|
503
575
|
* Search for service connections (banks and other providers)
|
|
504
576
|
*
|
|
@@ -594,6 +666,18 @@ export declare class RoutexClient {
|
|
|
594
666
|
* Confirm {@link Dialog} or {@link Redirect} returned initiating the payment
|
|
595
667
|
*/
|
|
596
668
|
confirmCollectPayment(options: ConfirmationOptions): Promise<OBResponse>;
|
|
669
|
+
/**
|
|
670
|
+
* [Transfer service]{@link https://docs.yaxi.tech/transfer.html}
|
|
671
|
+
*/
|
|
672
|
+
transfer({ credentials, session, recurringConsents, ticket, product, debtorAccount, debtorName, requestedExecutionDate, details, }: TransferOptions): Promise<OBResponse>;
|
|
673
|
+
/**
|
|
674
|
+
* Respond to {@link Dialog} returned while initiating the transfer
|
|
675
|
+
*/
|
|
676
|
+
respondTransfer(options: ResponseOptions): Promise<OBResponse>;
|
|
677
|
+
/**
|
|
678
|
+
* Confirm {@link Dialog} or {@link Redirect} returned initiating the transfer
|
|
679
|
+
*/
|
|
680
|
+
confirmTransfer(options: ConfirmationOptions): Promise<OBResponse>;
|
|
597
681
|
}
|
|
598
682
|
export declare class RequestException extends Error {
|
|
599
683
|
constructor(error: string, options?: ErrorOptions);
|
|
@@ -653,7 +737,11 @@ export declare enum UnsupportedProductReason {
|
|
|
653
737
|
/**
|
|
654
738
|
* The recipient is not capable to receive the payment product.
|
|
655
739
|
*/
|
|
656
|
-
Recipient = "RECIPIENT"
|
|
740
|
+
Recipient = "RECIPIENT",
|
|
741
|
+
/**
|
|
742
|
+
* Scheduled payments are not supported.
|
|
743
|
+
*/
|
|
744
|
+
Scheduled = "SCHEDULED"
|
|
657
745
|
}
|
|
658
746
|
export declare class PaymentFailedException extends Error {
|
|
659
747
|
constructor(code?: string, userMessage?: string, options?: ErrorOptions);
|
package/index.js
CHANGED
|
@@ -41,7 +41,7 @@ function bytesToUtf8(bytes) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
var version = "0.
|
|
44
|
+
var version = "0.5.0";
|
|
45
45
|
|
|
46
46
|
var AccountField;
|
|
47
47
|
(function (AccountField) {
|
|
@@ -164,6 +164,59 @@ function _mapAccountType(type) {
|
|
|
164
164
|
throw new TypeError("unknown value for `AccountType`: " + type);
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
+
var PaymentProduct;
|
|
168
|
+
(function (PaymentProduct) {
|
|
169
|
+
/**
|
|
170
|
+
* SEPA Credit Transfer (SCT) in EUR
|
|
171
|
+
*/
|
|
172
|
+
PaymentProduct["SepaCreditTransfer"] = "SEPA_CREDIT_TRANSFER";
|
|
173
|
+
/**
|
|
174
|
+
* SEPA Instant Credit Transfer (SCT Inst) in EUR
|
|
175
|
+
*/
|
|
176
|
+
PaymentProduct["SepaInstantCreditTransfer"] = "SEPA_INSTANT_CREDIT_TRANSFER";
|
|
177
|
+
/**
|
|
178
|
+
* Default SEPA Credit Transfer in EUR
|
|
179
|
+
*
|
|
180
|
+
* Tries SCT Inst with a fallback to SCT if this is supported.
|
|
181
|
+
* Otherwise, SCT is used.
|
|
182
|
+
*/
|
|
183
|
+
PaymentProduct["DefaultSepaCreditTransfer"] = "DEFAULT_SEPA_CREDIT_TRANSFER";
|
|
184
|
+
/**
|
|
185
|
+
* International credit transfer outside of SEPA (typically SWIFT)
|
|
186
|
+
*/
|
|
187
|
+
PaymentProduct["CrossBorderCreditTransfer"] = "CROSS_BORDER_CREDIT_TRANSFER";
|
|
188
|
+
/**
|
|
189
|
+
* Domestic credit transfer in the domestic, non-EUR currency
|
|
190
|
+
*/
|
|
191
|
+
PaymentProduct["DomesticCreditTransfer"] = "DOMESTIC_CREDIT_TRANSFER";
|
|
192
|
+
/**
|
|
193
|
+
* Instant domestic credit transfer in the domestic, non-EUR currency
|
|
194
|
+
*/
|
|
195
|
+
PaymentProduct["DomesticInstantCreditTransfer"] = "DOMESTIC_INSTANT_CREDIT_TRANSFER";
|
|
196
|
+
})(PaymentProduct || (PaymentProduct = {}));
|
|
197
|
+
function _mapPaymentProduct(product) {
|
|
198
|
+
switch (product) {
|
|
199
|
+
case PaymentProduct.SepaCreditTransfer:
|
|
200
|
+
return "SepaCreditTransfer";
|
|
201
|
+
case PaymentProduct.SepaInstantCreditTransfer:
|
|
202
|
+
return "SepaInstantCreditTransfer";
|
|
203
|
+
case PaymentProduct.DefaultSepaCreditTransfer:
|
|
204
|
+
return "DefaultSepaCreditTransfer";
|
|
205
|
+
case PaymentProduct.CrossBorderCreditTransfer:
|
|
206
|
+
return "CrossBorderCreditTransfer";
|
|
207
|
+
case PaymentProduct.DomesticCreditTransfer:
|
|
208
|
+
return "DomesticCreditTransfer";
|
|
209
|
+
case PaymentProduct.DomesticInstantCreditTransfer:
|
|
210
|
+
return "DomesticInstantCreditTransfer";
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
var ChargeBearer;
|
|
214
|
+
(function (ChargeBearer) {
|
|
215
|
+
ChargeBearer["BorneByDebtor"] = "DEBT";
|
|
216
|
+
ChargeBearer["BorneByCreditor"] = "CRED";
|
|
217
|
+
ChargeBearer["Shared"] = "SHAR";
|
|
218
|
+
ChargeBearer["FollowingServiceLevel"] = "SLEV";
|
|
219
|
+
})(ChargeBearer || (ChargeBearer = {}));
|
|
167
220
|
/**
|
|
168
221
|
* Response from YAXI Open Banking services.
|
|
169
222
|
*
|
|
@@ -538,6 +591,12 @@ class RoutexClient {
|
|
|
538
591
|
return yield this._unsealBody(response, { fallback: false });
|
|
539
592
|
});
|
|
540
593
|
}
|
|
594
|
+
/**
|
|
595
|
+
* System version for the currently established session
|
|
596
|
+
*/
|
|
597
|
+
systemVersion() {
|
|
598
|
+
return this._settlement.systemVersion();
|
|
599
|
+
}
|
|
541
600
|
/**
|
|
542
601
|
* Search for service connections (banks and other providers)
|
|
543
602
|
*
|
|
@@ -752,6 +811,38 @@ class RoutexClient {
|
|
|
752
811
|
return yield this._confirm("collect-payment", options);
|
|
753
812
|
});
|
|
754
813
|
}
|
|
814
|
+
/**
|
|
815
|
+
* [Transfer service]{@link https://docs.yaxi.tech/transfer.html}
|
|
816
|
+
*/
|
|
817
|
+
transfer(_a) {
|
|
818
|
+
return __awaiter(this, arguments, void 0, function* ({ credentials, session, recurringConsents, ticket, product, debtorAccount, debtorName, requestedExecutionDate, details, }) {
|
|
819
|
+
const data = _prepareData(credentials, session, recurringConsents, {
|
|
820
|
+
product: _mapPaymentProduct(product),
|
|
821
|
+
debtorAccount,
|
|
822
|
+
debtorName,
|
|
823
|
+
requestedExecutionDate,
|
|
824
|
+
details,
|
|
825
|
+
});
|
|
826
|
+
const r = yield this._request(ticket, "transfer/service", data);
|
|
827
|
+
return _readOBResponse(r);
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
/**
|
|
831
|
+
* Respond to {@link Dialog} returned while initiating the transfer
|
|
832
|
+
*/
|
|
833
|
+
respondTransfer(options) {
|
|
834
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
835
|
+
return yield this._respond("transfer", options);
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
/**
|
|
839
|
+
* Confirm {@link Dialog} or {@link Redirect} returned initiating the transfer
|
|
840
|
+
*/
|
|
841
|
+
confirmTransfer(options) {
|
|
842
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
843
|
+
return yield this._confirm("transfer", options);
|
|
844
|
+
});
|
|
845
|
+
}
|
|
755
846
|
}
|
|
756
847
|
function _prepareData({ connectionId, userId, password, connectionData }, session, recurringConsents, data) {
|
|
757
848
|
return Object.assign({ credentials: {
|
|
@@ -791,7 +882,7 @@ function _mapFilter(filter) {
|
|
|
791
882
|
if ("any" in filter) {
|
|
792
883
|
let other;
|
|
793
884
|
if (filter.any.length > 2) {
|
|
794
|
-
other = {
|
|
885
|
+
other = { any: filter.any.slice(1) };
|
|
795
886
|
}
|
|
796
887
|
else {
|
|
797
888
|
other = filter.any[1];
|
|
@@ -850,7 +941,7 @@ function _responseError(response) {
|
|
|
850
941
|
return new UnsupportedProductException(error.UnsupportedProduct.reason, error.UnsupportedProduct.userMessage);
|
|
851
942
|
}
|
|
852
943
|
if ("PaymentFailed" in error) {
|
|
853
|
-
return new PaymentFailedException(error.PaymentFailed.code, error.userMessage);
|
|
944
|
+
return new PaymentFailedException(error.PaymentFailed.code, error.PaymentFailed.userMessage);
|
|
854
945
|
}
|
|
855
946
|
if ("UnexpectedValue" in error) {
|
|
856
947
|
return new UnexpectedValueException(error.UnexpectedValue.error);
|
|
@@ -962,6 +1053,9 @@ class UnsupportedProductException extends Error {
|
|
|
962
1053
|
case "Recipient":
|
|
963
1054
|
this.reason = UnsupportedProductReason.Recipient;
|
|
964
1055
|
break;
|
|
1056
|
+
case "Scheduled":
|
|
1057
|
+
this.reason = UnsupportedProductReason.Scheduled;
|
|
1058
|
+
break;
|
|
965
1059
|
}
|
|
966
1060
|
this.userMessage = userMessage;
|
|
967
1061
|
}
|
|
@@ -976,6 +1070,10 @@ var UnsupportedProductReason;
|
|
|
976
1070
|
* The recipient is not capable to receive the payment product.
|
|
977
1071
|
*/
|
|
978
1072
|
UnsupportedProductReason["Recipient"] = "RECIPIENT";
|
|
1073
|
+
/**
|
|
1074
|
+
* Scheduled payments are not supported.
|
|
1075
|
+
*/
|
|
1076
|
+
UnsupportedProductReason["Scheduled"] = "SCHEDULED";
|
|
979
1077
|
})(UnsupportedProductReason || (UnsupportedProductReason = {}));
|
|
980
1078
|
class PaymentFailedException extends Error {
|
|
981
1079
|
constructor(code, userMessage, options) {
|
|
@@ -1178,4 +1276,4 @@ function clearCredentials() {
|
|
|
1178
1276
|
}
|
|
1179
1277
|
}
|
|
1180
1278
|
|
|
1181
|
-
export { AccessExceededException, AccountField, AccountStatus, AccountType, CanceledException, Confirmation, ConsentExpiredException, Dialog, DialogContext, Field, InputType, InvalidCredentialsException, NotFoundException, OBResponse, PaymentFailedCode, PaymentFailedException, PeriodOutOfBoundsException, ProviderErrorCode, ProviderErrorException, Redirect, RedirectHandle, RequestException, ResponseException, Result, RoutexClient, SecrecyLevel, Selection, ServiceBlockedCode, ServiceBlockedException, SupportedService, TicketException, TicketExceptionCode, UnauthorizedException, UnexpectedErrorException, UnexpectedValueException, UnsupportedProductException, UnsupportedProductReason, _testing, clearCredentials, loadCredentials, removeCredentials, retryRequestExceptionNTimesPolicy, storeCredentials };
|
|
1279
|
+
export { AccessExceededException, AccountField, AccountStatus, AccountType, CanceledException, ChargeBearer, Confirmation, ConsentExpiredException, Dialog, DialogContext, Field, InputType, InvalidCredentialsException, NotFoundException, OBResponse, PaymentFailedCode, PaymentFailedException, PaymentProduct, PeriodOutOfBoundsException, ProviderErrorCode, ProviderErrorException, Redirect, RedirectHandle, RequestException, ResponseException, Result, RoutexClient, SecrecyLevel, Selection, ServiceBlockedCode, ServiceBlockedException, SupportedService, TicketException, TicketExceptionCode, UnauthorizedException, UnexpectedErrorException, UnexpectedValueException, UnsupportedProductException, UnsupportedProductReason, _testing, clearCredentials, loadCredentials, removeCredentials, retryRequestExceptionNTimesPolicy, storeCredentials };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "routex-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "YAXI routex client",
|
|
5
5
|
"homepage": "https://yaxi.tech",
|
|
6
6
|
"author": "YAXI GmbH",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@noble/ciphers": "^2.0.0",
|
|
26
26
|
"jwt-decode": "^4.0.0",
|
|
27
|
-
"routex-settlement": "^0.
|
|
27
|
+
"routex-settlement": "^0.2.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@eslint/js": "^9.18.0",
|