@stancer/stancer 1.0.1 → 1.0.2
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/CHANGELOG.md +15 -2
- package/dist/address/api-endpoint.d.ts +20 -0
- package/dist/address/api-endpoint.d.ts.map +1 -0
- package/dist/address/api-endpoint.js +28 -0
- package/dist/address/api-endpoint.js.map +1 -0
- package/dist/address/model.d.ts +35 -0
- package/dist/address/model.d.ts.map +1 -0
- package/dist/address/model.js +63 -0
- package/dist/address/model.js.map +1 -0
- package/dist/address/repository.d.ts +7 -0
- package/dist/address/repository.d.ts.map +1 -0
- package/dist/address/repository.js +14 -0
- package/dist/address/repository.js.map +1 -0
- package/dist/address/validator.d.ts +4 -0
- package/dist/address/validator.d.ts.map +1 -0
- package/dist/address/validator.js +32 -0
- package/dist/address/validator.js.map +1 -0
- package/dist/api-endpoint/abstract-api-endpoint.d.ts +46 -0
- package/dist/api-endpoint/abstract-api-endpoint.d.ts.map +1 -0
- package/dist/api-endpoint/abstract-api-endpoint.js +220 -0
- package/dist/api-endpoint/abstract-api-endpoint.js.map +1 -0
- package/dist/api-endpoint/configuration.d.ts +34 -0
- package/dist/api-endpoint/configuration.d.ts.map +1 -0
- package/dist/api-endpoint/configuration.js +99 -0
- package/dist/api-endpoint/configuration.js.map +1 -0
- package/dist/api-endpoint/http/fetch-http-client.d.ts +3 -0
- package/dist/api-endpoint/http/fetch-http-client.d.ts.map +1 -0
- package/dist/api-endpoint/http/fetch-http-client.js +28 -0
- package/dist/api-endpoint/http/fetch-http-client.js.map +1 -0
- package/dist/api-endpoint/http/http.d.ts +18 -0
- package/dist/api-endpoint/http/http.d.ts.map +1 -0
- package/dist/api-endpoint/http/http.js +47 -0
- package/dist/api-endpoint/http/http.js.map +1 -0
- package/dist/api-endpoint/http/index.d.ts +3 -0
- package/dist/api-endpoint/http/index.d.ts.map +1 -0
- package/dist/api-endpoint/http/index.js +3 -0
- package/dist/api-endpoint/http/index.js.map +1 -0
- package/dist/api-endpoint/version.d.ts +5 -0
- package/dist/api-endpoint/version.d.ts.map +1 -0
- package/dist/api-endpoint/version.js +6 -0
- package/dist/api-endpoint/version.js.map +1 -0
- package/dist/card/api-endpoint.d.ts +28 -0
- package/dist/card/api-endpoint.d.ts.map +1 -0
- package/dist/card/api-endpoint.js +37 -0
- package/dist/card/api-endpoint.js.map +1 -0
- package/dist/card/enum/funding.d.ts +3 -0
- package/dist/card/enum/funding.d.ts.map +1 -0
- package/dist/card/enum/funding.js +10 -0
- package/dist/card/enum/funding.js.map +1 -0
- package/dist/card/enum/nature.d.ts +3 -0
- package/dist/card/enum/nature.d.ts.map +1 -0
- package/dist/card/enum/nature.js +6 -0
- package/dist/card/enum/nature.js.map +1 -0
- package/dist/card/enum/network.d.ts +5 -0
- package/dist/card/enum/network.d.ts.map +1 -0
- package/dist/card/enum/network.js +12 -0
- package/dist/card/enum/network.js.map +1 -0
- package/dist/card/model.d.ts +55 -0
- package/dist/card/model.d.ts.map +1 -0
- package/dist/card/model.js +90 -0
- package/dist/card/model.js.map +1 -0
- package/dist/card/repository.d.ts +7 -0
- package/dist/card/repository.d.ts.map +1 -0
- package/dist/card/repository.js +10 -0
- package/dist/card/repository.js.map +1 -0
- package/dist/card/validator.d.ts +8 -0
- package/dist/card/validator.d.ts.map +1 -0
- package/dist/card/validator.js +71 -0
- package/dist/card/validator.js.map +1 -0
- package/dist/core/abstract-model.d.ts +51 -0
- package/dist/core/abstract-model.d.ts.map +1 -0
- package/dist/core/abstract-model.js +93 -0
- package/dist/core/abstract-model.js.map +1 -0
- package/dist/core/abstract-repository.d.ts +86 -0
- package/dist/core/abstract-repository.d.ts.map +1 -0
- package/dist/core/abstract-repository.js +97 -0
- package/dist/core/abstract-repository.js.map +1 -0
- package/dist/core/common/branded-type.d.ts +6 -0
- package/dist/core/common/branded-type.d.ts.map +1 -0
- package/dist/core/common/branded-type.js +9 -0
- package/dist/core/common/branded-type.js.map +1 -0
- package/dist/core/common/handler/date-handler.d.ts +5 -0
- package/dist/core/common/handler/date-handler.d.ts.map +1 -0
- package/dist/core/common/handler/date-handler.js +23 -0
- package/dist/core/common/handler/date-handler.js.map +1 -0
- package/dist/core/common/handler/enum-handler.d.ts +3 -0
- package/dist/core/common/handler/enum-handler.d.ts.map +1 -0
- package/dist/core/common/handler/enum-handler.js +14 -0
- package/dist/core/common/handler/enum-handler.js.map +1 -0
- package/dist/core/common/handler/handler.d.ts +24 -0
- package/dist/core/common/handler/handler.d.ts.map +1 -0
- package/dist/core/common/handler/handler.js +33 -0
- package/dist/core/common/handler/handler.js.map +1 -0
- package/dist/core/common/handler/id-handler.d.ts +4 -0
- package/dist/core/common/handler/id-handler.d.ts.map +1 -0
- package/dist/core/common/handler/id-handler.js +21 -0
- package/dist/core/common/handler/id-handler.js.map +1 -0
- package/dist/core/common/id-validator.d.ts +10 -0
- package/dist/core/common/id-validator.d.ts.map +1 -0
- package/dist/core/common/id-validator.js +17 -0
- package/dist/core/common/id-validator.js.map +1 -0
- package/dist/core/common/mutation-tracked-object.d.ts +8 -0
- package/dist/core/common/mutation-tracked-object.d.ts.map +1 -0
- package/dist/core/common/mutation-tracked-object.js +38 -0
- package/dist/core/common/mutation-tracked-object.js.map +1 -0
- package/dist/core/endpoint-interface.d.ts +38 -0
- package/dist/core/endpoint-interface.d.ts.map +1 -0
- package/dist/core/endpoint-interface.js +2 -0
- package/dist/core/endpoint-interface.js.map +1 -0
- package/dist/core/error/base-error.d.ts +3 -0
- package/dist/core/error/base-error.d.ts.map +1 -0
- package/dist/core/error/base-error.js +3 -0
- package/dist/core/error/base-error.js.map +1 -0
- package/dist/core/error/endpoint/api/api-conflict-error.d.ts +5 -0
- package/dist/core/error/endpoint/api/api-conflict-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/api-conflict-error.js +7 -0
- package/dist/core/error/endpoint/api/api-conflict-error.js.map +1 -0
- package/dist/core/error/endpoint/api/api-error.d.ts +6 -0
- package/dist/core/error/endpoint/api/api-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/api-error.js +9 -0
- package/dist/core/error/endpoint/api/api-error.js.map +1 -0
- package/dist/core/error/endpoint/api/api-not-found-error.d.ts +5 -0
- package/dist/core/error/endpoint/api/api-not-found-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/api-not-found-error.js +7 -0
- package/dist/core/error/endpoint/api/api-not-found-error.js.map +1 -0
- package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts +5 -0
- package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/api-unauthorized-error.js +7 -0
- package/dist/core/error/endpoint/api/api-unauthorized-error.js.map +1 -0
- package/dist/core/error/endpoint/api/api-unknown-error.d.ts +5 -0
- package/dist/core/error/endpoint/api/api-unknown-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/api-unknown-error.js +7 -0
- package/dist/core/error/endpoint/api/api-unknown-error.js.map +1 -0
- package/dist/core/error/endpoint/api/api-validation-error.d.ts +11 -0
- package/dist/core/error/endpoint/api/api-validation-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/api-validation-error.js +9 -0
- package/dist/core/error/endpoint/api/api-validation-error.js.map +1 -0
- package/dist/core/error/endpoint/api/index.d.ts +7 -0
- package/dist/core/error/endpoint/api/index.d.ts.map +1 -0
- package/dist/core/error/endpoint/api/index.js +7 -0
- package/dist/core/error/endpoint/api/index.js.map +1 -0
- package/dist/core/error/endpoint/route-inaccessible-error.d.ts +5 -0
- package/dist/core/error/endpoint/route-inaccessible-error.d.ts.map +1 -0
- package/dist/core/error/endpoint/route-inaccessible-error.js +8 -0
- package/dist/core/error/endpoint/route-inaccessible-error.js.map +1 -0
- package/dist/core/error/unpopulated-error.d.ts +4 -0
- package/dist/core/error/unpopulated-error.d.ts.map +1 -0
- package/dist/core/error/unpopulated-error.js +4 -0
- package/dist/core/error/unpopulated-error.js.map +1 -0
- package/dist/core/error/unsendable-error.d.ts +4 -0
- package/dist/core/error/unsendable-error.d.ts.map +1 -0
- package/dist/core/error/unsendable-error.js +4 -0
- package/dist/core/error/unsendable-error.js.map +1 -0
- package/dist/core/error/validation-error.d.ts +4 -0
- package/dist/core/error/validation-error.d.ts.map +1 -0
- package/dist/core/error/validation-error.js +4 -0
- package/dist/core/error/validation-error.js.map +1 -0
- package/dist/core/validator.d.ts +63 -0
- package/dist/core/validator.d.ts.map +1 -0
- package/dist/core/validator.js +73 -0
- package/dist/core/validator.js.map +1 -0
- package/dist/customer/api-endpoint.d.ts +21 -0
- package/dist/customer/api-endpoint.d.ts.map +1 -0
- package/dist/customer/api-endpoint.js +27 -0
- package/dist/customer/api-endpoint.js.map +1 -0
- package/dist/customer/model.d.ts +39 -0
- package/dist/customer/model.d.ts.map +1 -0
- package/dist/customer/model.js +73 -0
- package/dist/customer/model.js.map +1 -0
- package/dist/customer/repository.d.ts +7 -0
- package/dist/customer/repository.d.ts.map +1 -0
- package/dist/customer/repository.js +10 -0
- package/dist/customer/repository.js.map +1 -0
- package/dist/customer/validator.d.ts +4 -0
- package/dist/customer/validator.d.ts.map +1 -0
- package/dist/customer/validator.js +23 -0
- package/dist/customer/validator.js.map +1 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +2 -0
- package/dist/main.js.map +1 -0
- package/dist/payment/api-endpoint.d.ts +51 -0
- package/dist/payment/api-endpoint.d.ts.map +1 -0
- package/dist/payment/api-endpoint.js +110 -0
- package/dist/payment/api-endpoint.js.map +1 -0
- package/dist/payment/enum/currency.d.ts +3 -0
- package/dist/payment/enum/currency.d.ts.map +1 -0
- package/dist/payment/enum/currency.js +13 -0
- package/dist/payment/enum/currency.js.map +1 -0
- package/dist/payment/enum/method.d.ts +3 -0
- package/dist/payment/enum/method.d.ts.map +1 -0
- package/dist/payment/enum/method.js +2 -0
- package/dist/payment/enum/method.js.map +1 -0
- package/dist/payment/enum/status.d.ts +4 -0
- package/dist/payment/enum/status.d.ts.map +1 -0
- package/dist/payment/enum/status.js +19 -0
- package/dist/payment/enum/status.js.map +1 -0
- package/dist/payment/model.d.ts +135 -0
- package/dist/payment/model.d.ts.map +1 -0
- package/dist/payment/model.js +232 -0
- package/dist/payment/model.js.map +1 -0
- package/dist/payment/repository.d.ts +17 -0
- package/dist/payment/repository.d.ts.map +1 -0
- package/dist/payment/repository.js +56 -0
- package/dist/payment/repository.js.map +1 -0
- package/dist/payment/validator.d.ts +16 -0
- package/dist/payment/validator.d.ts.map +1 -0
- package/dist/payment/validator.js +81 -0
- package/dist/payment/validator.js.map +1 -0
- package/dist/payment-intent/api-endpoint.d.ts +48 -0
- package/dist/payment-intent/api-endpoint.d.ts.map +1 -0
- package/dist/payment-intent/api-endpoint.js +94 -0
- package/dist/payment-intent/api-endpoint.js.map +1 -0
- package/dist/payment-intent/enum/status.d.ts +5 -0
- package/dist/payment-intent/enum/status.d.ts.map +1 -0
- package/dist/payment-intent/enum/status.js +20 -0
- package/dist/payment-intent/enum/status.js.map +1 -0
- package/dist/payment-intent/enum/threeds.d.ts +3 -0
- package/dist/payment-intent/enum/threeds.d.ts.map +1 -0
- package/dist/payment-intent/enum/threeds.js +2 -0
- package/dist/payment-intent/enum/threeds.js.map +1 -0
- package/dist/payment-intent/model.d.ts +90 -0
- package/dist/payment-intent/model.d.ts.map +1 -0
- package/dist/payment-intent/model.js +177 -0
- package/dist/payment-intent/model.js.map +1 -0
- package/dist/payment-intent/repository.d.ts +13 -0
- package/dist/payment-intent/repository.d.ts.map +1 -0
- package/dist/payment-intent/repository.js +65 -0
- package/dist/payment-intent/repository.js.map +1 -0
- package/dist/payment-intent/validator.d.ts +4 -0
- package/dist/payment-intent/validator.d.ts.map +1 -0
- package/dist/payment-intent/validator.js +38 -0
- package/dist/payment-intent/validator.js.map +1 -0
- package/dist/payout/model.d.ts +7 -0
- package/dist/payout/model.d.ts.map +1 -0
- package/dist/payout/model.js +6 -0
- package/dist/payout/model.js.map +1 -0
- package/dist/refund/api-endpoint.d.ts +22 -0
- package/dist/refund/api-endpoint.d.ts.map +1 -0
- package/dist/refund/api-endpoint.js +32 -0
- package/dist/refund/api-endpoint.js.map +1 -0
- package/dist/refund/enum/refund-status.d.ts +3 -0
- package/dist/refund/enum/refund-status.d.ts.map +1 -0
- package/dist/refund/enum/refund-status.js +10 -0
- package/dist/refund/enum/refund-status.js.map +1 -0
- package/dist/refund/model.d.ts +38 -0
- package/dist/refund/model.d.ts.map +1 -0
- package/dist/refund/model.js +51 -0
- package/dist/refund/model.js.map +1 -0
- package/dist/refund/repository.d.ts +7 -0
- package/dist/refund/repository.d.ts.map +1 -0
- package/dist/refund/repository.js +10 -0
- package/dist/refund/repository.js.map +1 -0
- package/dist/refund/validator.d.ts +4 -0
- package/dist/refund/validator.d.ts.map +1 -0
- package/dist/refund/validator.js +41 -0
- package/dist/refund/validator.js.map +1 -0
- package/dist/sepa/api-endpoint.d.ts +19 -0
- package/dist/sepa/api-endpoint.d.ts.map +1 -0
- package/dist/sepa/api-endpoint.js +25 -0
- package/dist/sepa/api-endpoint.js.map +1 -0
- package/dist/sepa/model.d.ts +32 -0
- package/dist/sepa/model.d.ts.map +1 -0
- package/dist/sepa/model.js +53 -0
- package/dist/sepa/model.js.map +1 -0
- package/dist/sepa/repository.d.ts +7 -0
- package/dist/sepa/repository.d.ts.map +1 -0
- package/dist/sepa/repository.js +10 -0
- package/dist/sepa/repository.js.map +1 -0
- package/dist/sepa/validator.d.ts +8 -0
- package/dist/sepa/validator.d.ts.map +1 -0
- package/dist/sepa/validator.js +47 -0
- package/dist/sepa/validator.js.map +1 -0
- package/package.json +1 -1
- package/reports/base.css +362 -0
- package/reports/block-navigation.js +75 -0
- package/reports/cobertura-coverage.xml +18 -0
- package/reports/favicon.png +0 -0
- package/reports/index.html +177 -0
- package/reports/junit.xml +25 -0
- package/reports/prettify.css +101 -0
- package/reports/prettify.js +955 -0
- package/reports/sort-arrow-sprite.png +0 -0
- package/reports/sorter.js +205 -0
- package/.editorconfig +0 -14
- package/.gitlab-ci.yml +0 -159
- package/.prettierignore +0 -3
- package/eslint.config.js +0 -14
- package/pnpm-workspace.yaml +0 -19
- package/prettier.config.js +0 -3
- package/tsconfig.json +0 -50
- package/vitest.config.ts +0 -20
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
import { AbstractModel } from '#core/abstract-model.js';
|
|
3
|
+
import { validateID } from '#core/common/id-validator.js';
|
|
4
|
+
import { StancerValidationError } from '#core/error/validation-error.js';
|
|
5
|
+
export const idRefund = (id) => validateID(id, RefundModel.regex);
|
|
6
|
+
export const isRefundAmount = (value) => value >= 0;
|
|
7
|
+
export const refundAmount = (value) => {
|
|
8
|
+
if (!isRefundAmount(value)) {
|
|
9
|
+
throw new StancerValidationError(`${value} is not a valid Refund amount`);
|
|
10
|
+
}
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
export class RefundModel extends AbstractModel {
|
|
14
|
+
static regex = /^refd_[a-zA-Z0-9]{24}$/;
|
|
15
|
+
//#region Getters
|
|
16
|
+
get amount() {
|
|
17
|
+
return this._data.amount;
|
|
18
|
+
}
|
|
19
|
+
get currency() {
|
|
20
|
+
return this._data.currency;
|
|
21
|
+
}
|
|
22
|
+
get dateBank() {
|
|
23
|
+
return this._data.dateBank;
|
|
24
|
+
}
|
|
25
|
+
get dateRefund() {
|
|
26
|
+
return this._data.dateRefund;
|
|
27
|
+
}
|
|
28
|
+
get payment() {
|
|
29
|
+
return this._data.payment;
|
|
30
|
+
}
|
|
31
|
+
get paymentIntent() {
|
|
32
|
+
return this._data.paymentIntent;
|
|
33
|
+
}
|
|
34
|
+
get payout() {
|
|
35
|
+
return this._data.payout;
|
|
36
|
+
}
|
|
37
|
+
get status() {
|
|
38
|
+
return this._data.status;
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
//#region Setters
|
|
42
|
+
setAmount(value) {
|
|
43
|
+
this._data.amount = value;
|
|
44
|
+
return this;
|
|
45
|
+
}
|
|
46
|
+
setPayment(value) {
|
|
47
|
+
this._data.payment = value;
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/refund/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AASzE,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,UAAU,CAAW,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AAGpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAa,EAAyB,EAAE,CAAC,KAAK,IAAI,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAgB,EAAE;IAC1D,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,sBAAsB,CAAC,GAAG,KAAK,+BAA+B,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAcF,MAAM,OAAO,WAAY,SAAQ,aAAyB;IACxD,MAAM,CAAC,KAAK,GAAG,wBAAwB,CAAC;IAExC,iBAAiB;IAEjB,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC;IAC/B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IAED,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC;IAClC,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,YAAY;IAEZ,iBAAiB;IAEjB,SAAS,CAAC,KAAmB;QAC3B,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,UAAU,CAAC,KAAgB;QACzB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;CAGF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractRepository, type Repository } from '#core/abstract-repository.js';
|
|
2
|
+
import type { EndpointInterface } from '#core/endpoint-interface.js';
|
|
3
|
+
import { type RefundData, RefundModel } from '#refund/model.js';
|
|
4
|
+
export declare class RefundRepository extends AbstractRepository<RefundData, RefundModel> implements Repository<RefundData, RefundModel> {
|
|
5
|
+
constructor(endpoint?: EndpointInterface<RefundData>);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/refund/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,KAAK,UAAU,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAGhE,qBAAa,gBACX,SAAQ,kBAAkB,CAAC,UAAU,EAAE,WAAW,CAClD,YAAW,UAAU,CAAC,UAAU,EAAE,WAAW,CAAC;IAE9C,YAAY,QAAQ,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC,EAEnD;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractRepository } from '#core/abstract-repository.js';
|
|
2
|
+
import { RefundApiEndpoint } from '#refund/api-endpoint.js';
|
|
3
|
+
import { RefundModel } from '#refund/model.js';
|
|
4
|
+
import { refundValidator } from '#refund/validator.js';
|
|
5
|
+
export class RefundRepository extends AbstractRepository {
|
|
6
|
+
constructor(endpoint) {
|
|
7
|
+
super({ endpoint: endpoint ?? new RefundApiEndpoint(), validator: refundValidator, model: RefundModel });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/refund/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,EAAmB,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,OAAO,gBACX,SAAQ,kBAA2C;IAGnD,YAAY,QAAwC;QAClD,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI,iBAAiB,EAAE,EAAE,SAAS,EAAE,eAAe,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAAC;IAC3G,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/refund/validator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAyD,MAAM,oBAAoB,CAAC;AAO3G,OAAO,EAAiB,KAAK,UAAU,EAA+B,MAAM,YAAY,CAAC;AAuBzF,eAAO,MAAM,eAAe,EAAE,SAAS,CAAC,UAAU,CAYjD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { IdValidator, isValidID } from '#core/common/id-validator.js';
|
|
2
|
+
import { createdAtValidator, enumValidator, plainDateValidator } from '#core/validator.js';
|
|
3
|
+
import { CurrencyEnum } from '#payment/enum/currency.js';
|
|
4
|
+
import { PaymentModel } from '#payment/model.js';
|
|
5
|
+
import { PaymentIntentModel } from '../payment-intent/model.js';
|
|
6
|
+
import { PayoutModel } from '../payout/model.js';
|
|
7
|
+
import { RefundStatusEnum } from './enum/refund-status.js';
|
|
8
|
+
import { RefundModel, isRefundAmount } from './model.js';
|
|
9
|
+
const amountValidator = {
|
|
10
|
+
validate: (value) => typeof value === 'number' && isRefundAmount(value),
|
|
11
|
+
errorMessage: (value) => `value (${value}) is not a valid amount (not a number or too low a number)`,
|
|
12
|
+
};
|
|
13
|
+
const paymentValidator = {
|
|
14
|
+
validate: (arg0) => {
|
|
15
|
+
if (typeof arg0 === 'string') {
|
|
16
|
+
return isValidID(arg0, PaymentModel.regex);
|
|
17
|
+
}
|
|
18
|
+
if (!(arg0 instanceof PaymentModel)) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
if (!arg0.id) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
25
|
+
},
|
|
26
|
+
errorMessage: () => `payment must be a payment model and have an id to be refunded`,
|
|
27
|
+
};
|
|
28
|
+
export const refundValidator = {
|
|
29
|
+
id: IdValidator(RefundModel.regex),
|
|
30
|
+
amount: amountValidator,
|
|
31
|
+
currency: enumValidator(CurrencyEnum),
|
|
32
|
+
createdAt: createdAtValidator,
|
|
33
|
+
dateBank: plainDateValidator('dateBank'),
|
|
34
|
+
dateRefund: plainDateValidator('dateRefund'),
|
|
35
|
+
deleted: true,
|
|
36
|
+
payment: paymentValidator,
|
|
37
|
+
paymentIntent: IdValidator(PaymentIntentModel.regex),
|
|
38
|
+
payout: IdValidator(PayoutModel.regex),
|
|
39
|
+
status: enumValidator(RefundStatusEnum, false),
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/refund/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAkB,kBAAkB,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAkB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAwB,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAiB,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAkC,WAAW,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEzF,MAAM,eAAe,GAAG;IACtB,QAAQ,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,cAAc,CAAC,KAAK,CAAC;IAC/E,YAAY,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,UAAU,KAAK,4DAA4D;CAC7G,CAAC;AAEF,MAAM,gBAAgB,GAAG;IACvB,QAAQ,EAAE,CAAC,IAA8B,EAAE,EAAE;QAC3C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;YAC7B,OAAO,SAAS,CAAY,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,CAAC,IAAI,YAAY,YAAY,CAAC,EAAE,CAAC;YACpC,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC;YACb,OAAO,KAAK,CAAC;QACf,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,YAAY,EAAE,GAAG,EAAE,CAAC,+DAA+D;CACpF,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAA0B;IACpD,EAAE,EAAE,WAAW,CAAW,WAAW,CAAC,KAAK,CAAC;IAC5C,MAAM,EAAE,eAAe;IACvB,QAAQ,EAAE,aAAa,CAAC,YAAY,CAAC;IACrC,SAAS,EAAE,kBAAkB;IAC7B,QAAQ,EAAE,kBAAkB,CAAC,UAAU,CAAC;IACxC,UAAU,EAAE,kBAAkB,CAAC,YAAY,CAAC;IAC5C,OAAO,EAAE,IAAI;IACb,OAAO,EAAE,gBAAgB;IACzB,aAAa,EAAE,WAAW,CAAkB,kBAAkB,CAAC,KAAK,CAAC;IACrE,MAAM,EAAE,WAAW,CAAW,WAAW,CAAC,KAAK,CAAC;IAChD,MAAM,EAAE,aAAa,CAAC,gBAAgB,EAAE,KAAK,CAAC;CAC/C,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ApiEndpoint } from '#api/abstract-api-endpoint.js';
|
|
2
|
+
import { type IdCustomer } from '../customer/model.js';
|
|
3
|
+
import { type IdSepa, type SepaData } from './model.js';
|
|
4
|
+
export declare class SepaApiEndpoint extends ApiEndpoint<SepaData> {
|
|
5
|
+
_handler: {
|
|
6
|
+
createdAt: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.Instant>;
|
|
7
|
+
deleted: import("#core/common/handler/handler.js").Handler<boolean>;
|
|
8
|
+
bic: import("#core/common/handler/handler.js").Handler<string>;
|
|
9
|
+
customer: import("#core/common/handler/handler.js").Handler<IdCustomer>;
|
|
10
|
+
dateMandate: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.PlainDate>;
|
|
11
|
+
id: import("#core/common/handler/handler.js").Handler<IdSepa>;
|
|
12
|
+
last4: import("#core/common/handler/handler.js").Handler<string>;
|
|
13
|
+
mandate: import("#core/common/handler/handler.js").Handler<string>;
|
|
14
|
+
name: import("#core/common/handler/handler.js").Handler<string>;
|
|
15
|
+
iban: import("#core/common/handler/handler.js").Handler<string>;
|
|
16
|
+
};
|
|
17
|
+
constructor();
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=api-endpoint.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-endpoint.d.ts","sourceRoot":"","sources":["../../src/sepa/api-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,+BAA+B,CAAC;AAKzE,OAAO,EAAiB,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAa,MAAM,YAAY,CAAC;AAEnE,qBAAa,eAAgB,SAAQ,WAAW,CAAC,QAAQ,CAAC;IACjD,QAAQ;;;;;;;;;;;MAUb;IACF,cAIC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ApiEndpoint, baseHandler } from '#api/abstract-api-endpoint.js';
|
|
2
|
+
import { RFC9557Handler } from '#core/common/handler/date-handler.js';
|
|
3
|
+
import { defaultHandler } from '#core/common/handler/handler.js';
|
|
4
|
+
import { IdHandler } from '#core/common/handler/id-handler.js';
|
|
5
|
+
import { CustomerModel } from '../customer/model.js';
|
|
6
|
+
import { SepaModel } from './model.js';
|
|
7
|
+
export class SepaApiEndpoint extends ApiEndpoint {
|
|
8
|
+
_handler = {
|
|
9
|
+
...baseHandler('created'),
|
|
10
|
+
bic: defaultHandler('string', { patchable: false }),
|
|
11
|
+
customer: IdHandler(CustomerModel.regex, { patchable: false }),
|
|
12
|
+
dateMandate: RFC9557Handler({}),
|
|
13
|
+
id: IdHandler(SepaModel.regex, { postable: false, patchable: false }),
|
|
14
|
+
last4: defaultHandler('string', { postable: false, patchable: false }),
|
|
15
|
+
mandate: defaultHandler('string'),
|
|
16
|
+
name: defaultHandler('string', { postRequired: true }),
|
|
17
|
+
iban: defaultHandler('string', { postRequired: true, gettable: false, patchable: false }),
|
|
18
|
+
};
|
|
19
|
+
constructor() {
|
|
20
|
+
super({
|
|
21
|
+
name: 'sepa',
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=api-endpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-endpoint.js","sourceRoot":"","sources":["../../src/sepa/api-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAE/D,OAAO,EAAE,aAAa,EAAmB,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAA8B,SAAS,EAAE,MAAM,YAAY,CAAC;AAEnE,MAAM,OAAO,eAAgB,SAAQ,WAAqB;IACjD,QAAQ,GAAG;QAChB,GAAG,WAAW,CAAC,SAAS,CAAC;QACzB,GAAG,EAAE,cAAc,CAAkB,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACpE,QAAQ,EAAE,SAAS,CAAa,aAAa,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC1E,WAAW,EAAE,cAAc,CAAC,EAAE,CAAC;QAC/B,EAAE,EAAE,SAAS,CAAS,SAAS,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC7E,KAAK,EAAE,cAAc,CAAoB,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACzF,OAAO,EAAE,cAAc,CAAsB,QAAQ,CAAC;QACtD,IAAI,EAAE,cAAc,CAAmB,QAAQ,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QACxE,IAAI,EAAE,cAAc,CAAmB,QAAQ,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;KAC5G,CAAC;IACF;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,MAAM;SACb,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AbstractModel, type ModelData } from '#core/abstract-model.js';
|
|
2
|
+
import type { IdValue } from '#core/common/branded-type.js';
|
|
3
|
+
import type { IdCustomer } from '../customer/model.js';
|
|
4
|
+
export type IdSepa = IdValue<`sepa_${string}`>;
|
|
5
|
+
export declare const IdSepa: (id: string) => IdSepa;
|
|
6
|
+
export interface SepaData extends ModelData {
|
|
7
|
+
bic: string;
|
|
8
|
+
customer: IdCustomer;
|
|
9
|
+
dateMandate: Temporal.PlainDate;
|
|
10
|
+
deleted: boolean;
|
|
11
|
+
id: IdSepa;
|
|
12
|
+
last4: string;
|
|
13
|
+
mandate: string;
|
|
14
|
+
name: string;
|
|
15
|
+
iban: string;
|
|
16
|
+
}
|
|
17
|
+
export declare class SepaModel extends AbstractModel<SepaData> {
|
|
18
|
+
static regex: RegExp;
|
|
19
|
+
get bic(): string | undefined;
|
|
20
|
+
get customer(): IdCustomer | undefined;
|
|
21
|
+
get last4(): string | undefined;
|
|
22
|
+
get mandate(): string | undefined;
|
|
23
|
+
get dateMandate(): Temporal.PlainDate | undefined;
|
|
24
|
+
get name(): string | undefined;
|
|
25
|
+
setMandate(value: string): this;
|
|
26
|
+
setName(value: string): this;
|
|
27
|
+
setDateMandate(value: Temporal.PlainDate): this;
|
|
28
|
+
setIban(value: string): this;
|
|
29
|
+
setBic(value: string): this;
|
|
30
|
+
setCustomer(value: IdCustomer): this;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/sepa/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC;AAC/C,eAAO,MAAM,MAAM,OAAQ,MAAM,WAA4C,CAAC;AAC9E,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,UAAU,CAAC;IACrB,WAAW,EAAE,QAAQ,CAAC,SAAS,CAAC;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AACD,qBAAa,SAAU,SAAQ,aAAa,CAAC,QAAQ,CAAC;IACpD,MAAM,CAAC,KAAK,SAA4B;IAExC,IAAI,GAAG,uBAEN;IAED,IAAI,QAAQ,2BAEX;IAED,IAAI,KAAK,uBAKR;IAED,IAAI,OAAO,uBAEV;IAED,IAAI,WAAW,mCAEd;IAED,IAAI,IAAI,uBAEP;IAED,UAAU,CAAC,KAAK,EAAE,MAAM,QAGvB;IAED,OAAO,CAAC,KAAK,EAAE,MAAM,QAGpB;IAED,cAAc,CAAC,KAAK,EAAE,QAAQ,CAAC,SAAS,QAGvC;IAED,OAAO,CAAC,KAAK,EAAE,MAAM,QAIpB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,QAGnB;IAED,WAAW,CAAC,KAAK,EAAE,UAAU,QAG5B;CACF"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AbstractModel } from '#core/abstract-model.js';
|
|
2
|
+
import { validateID } from '#core/common/id-validator.js';
|
|
3
|
+
export const IdSepa = (id) => validateID(id, SepaModel.regex);
|
|
4
|
+
export class SepaModel extends AbstractModel {
|
|
5
|
+
static regex = /^sepa_[a-zA-Z0-9]{24}$/;
|
|
6
|
+
get bic() {
|
|
7
|
+
return this._data.bic;
|
|
8
|
+
}
|
|
9
|
+
get customer() {
|
|
10
|
+
return this._data.customer;
|
|
11
|
+
}
|
|
12
|
+
get last4() {
|
|
13
|
+
if (this._data.iban && !this._data.last4) {
|
|
14
|
+
return this._data.iban?.slice(-4);
|
|
15
|
+
}
|
|
16
|
+
return this._data.last4;
|
|
17
|
+
}
|
|
18
|
+
get mandate() {
|
|
19
|
+
return this._data.mandate;
|
|
20
|
+
}
|
|
21
|
+
get dateMandate() {
|
|
22
|
+
return this._data.dateMandate;
|
|
23
|
+
}
|
|
24
|
+
get name() {
|
|
25
|
+
return this._data.name;
|
|
26
|
+
}
|
|
27
|
+
setMandate(value) {
|
|
28
|
+
this._data.mandate = value;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
setName(value) {
|
|
32
|
+
this._data.name = value;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
setDateMandate(value) {
|
|
36
|
+
this._data.dateMandate = value;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
setIban(value) {
|
|
40
|
+
this._data.iban = value;
|
|
41
|
+
this._data.last4 = value.slice(-4);
|
|
42
|
+
return this;
|
|
43
|
+
}
|
|
44
|
+
setBic(value) {
|
|
45
|
+
this._data.bic = value;
|
|
46
|
+
return this;
|
|
47
|
+
}
|
|
48
|
+
setCustomer(value) {
|
|
49
|
+
this._data.customer = value;
|
|
50
|
+
return this;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/sepa/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAkB,MAAM,yBAAyB,CAAC;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAK1D,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,UAAU,CAAS,EAAE,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;AAY9E,MAAM,OAAO,SAAU,SAAQ,aAAuB;IACpD,MAAM,CAAC,KAAK,GAAG,wBAAwB,CAAC;IAExC,IAAI,GAAG;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;IACxB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;IAED,IAAI,KAAK;QACP,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;IAC1B,CAAC;IAED,IAAI,OAAO;QACT,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC;IAC5B,CAAC;IAED,IAAI,WAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;IAChC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC;IACzB,CAAC;IAED,UAAU,CAAC,KAAa;QACtB,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,KAAK,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAa;QACnB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,cAAc,CAAC,KAAyB;QACtC,IAAI,CAAC,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,KAAa;QACnB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,KAAK,CAAC;QACxB,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,CAAC,KAAa;QAClB,IAAI,CAAC,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,KAAiB;QAC3B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,KAAK,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractRepository, type Repository } from '#core/abstract-repository.js';
|
|
2
|
+
import type { EndpointInterface } from '#core/endpoint-interface.js';
|
|
3
|
+
import { type SepaData, SepaModel } from '#sepa/model.js';
|
|
4
|
+
export declare class SepaRepository extends AbstractRepository<SepaData, SepaModel> implements Repository<SepaData, SepaModel> {
|
|
5
|
+
constructor(endpoint?: EndpointInterface<SepaData>);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=repository.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/sepa/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AACnF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAErE,OAAO,EAAE,KAAK,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG1D,qBAAa,cAAe,SAAQ,kBAAkB,CAAC,QAAQ,EAAE,SAAS,CAAE,YAAW,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC;IACpH,YAAY,QAAQ,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,EAEjD;CACF"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { AbstractRepository } from '#core/abstract-repository.js';
|
|
2
|
+
import { SepaApiEndpoint } from '#sepa/api-endpoint.js';
|
|
3
|
+
import { SepaModel } from '#sepa/model.js';
|
|
4
|
+
import { sepaValidator } from '#sepa/validator.js';
|
|
5
|
+
export class SepaRepository extends AbstractRepository {
|
|
6
|
+
constructor(endpoint) {
|
|
7
|
+
super({ endpoint: endpoint ?? new SepaApiEndpoint(), validator: sepaValidator, model: SepaModel });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/sepa/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAiB,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,MAAM,OAAO,cAAe,SAAQ,kBAAuC;IACzE,YAAY,QAAsC;QAChD,KAAK,CAAC,EAAE,QAAQ,EAAE,QAAQ,IAAI,IAAI,eAAe,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACrG,CAAC;CACF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Validator } from '#core/validator.js';
|
|
2
|
+
import { type SepaData } from './model.js';
|
|
3
|
+
export declare const ibanValidator: {
|
|
4
|
+
validate: (arg0: string) => boolean;
|
|
5
|
+
errorMessage: (value: string) => string;
|
|
6
|
+
};
|
|
7
|
+
export declare const sepaValidator: Validator<SepaData>;
|
|
8
|
+
//# sourceMappingURL=validator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/sepa/validator.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,SAAS,EAA2C,MAAM,oBAAoB,CAAC;AAG7F,OAAO,EAAe,KAAK,QAAQ,EAAa,MAAM,YAAY,CAAC;AAInE,eAAO,MAAM,aAAa;IACxB,QAAQ,SAAS,MAAM;IA0BvB,YAAY,UAAU,MAAM;CAC7B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,SAAS,CAAC,QAAQ,CAe7C,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Temporal } from 'temporal-polyfill';
|
|
2
|
+
import { IdValidator } from '#core/common/id-validator.js';
|
|
3
|
+
import { createdAtValidator, goldilocksValidator } from '#core/validator.js';
|
|
4
|
+
import { CustomerModel } from '../customer/model.js';
|
|
5
|
+
import { SepaModel } from './model.js';
|
|
6
|
+
// IBAN validation using ISO/IEC 7064 MOD 97-10 algorithm
|
|
7
|
+
// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number#Validating_the_IBAN
|
|
8
|
+
export const ibanValidator = {
|
|
9
|
+
validate: (arg0) => {
|
|
10
|
+
const iban = arg0.replaceAll(' ', '');
|
|
11
|
+
if (!/^[a-zA-Z0-9]+$/.test(iban)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
const start = iban.slice(0, 4);
|
|
15
|
+
const bban = iban.slice(4);
|
|
16
|
+
const codeWithLetters = (bban + start).toUpperCase();
|
|
17
|
+
const letterToNumber = (character) => character.charCodeAt(0) - 55;
|
|
18
|
+
const code = codeWithLetters
|
|
19
|
+
.split('')
|
|
20
|
+
.map((character) => (Number.isNaN(Number(character)) ? letterToNumber(character) : character))
|
|
21
|
+
.join('');
|
|
22
|
+
const check = code.slice(0, 2);
|
|
23
|
+
const parts = code.slice(2).match(/.{1,7}/g) ?? [];
|
|
24
|
+
const result = parts.reduce((prev, curr) => String(Number(prev + curr) % 97), check);
|
|
25
|
+
if (result === '1') {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
},
|
|
30
|
+
errorMessage: (value) => `IBAN ending in ${value.slice(-4)} is not valid`,
|
|
31
|
+
};
|
|
32
|
+
export const sepaValidator = {
|
|
33
|
+
id: IdValidator(SepaModel.regex),
|
|
34
|
+
bic: goldilocksValidator('bic', { min: 8, max: 11 }),
|
|
35
|
+
customer: IdValidator(CustomerModel.regex),
|
|
36
|
+
createdAt: createdAtValidator,
|
|
37
|
+
deleted: true,
|
|
38
|
+
dateMandate: {
|
|
39
|
+
validate: (arg0) => arg0.year > 1970 && Temporal.PlainDate.compare(Temporal.Now.plainDateISO(), arg0) === 1,
|
|
40
|
+
errorMessage: () => 'DateMandate must be a past date.',
|
|
41
|
+
},
|
|
42
|
+
iban: ibanValidator,
|
|
43
|
+
last4: true,
|
|
44
|
+
mandate: goldilocksValidator('mandate', { min: 1, max: 35 }),
|
|
45
|
+
name: goldilocksValidator('name', { min: 3, max: 64 }),
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=validator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/sepa/validator.ts"],"names":[],"mappings":"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"}
|