@stancer/stancer 1.0.1 → 1.1.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/CHANGELOG.md +23 -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 +34 -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/handler/metadata-handler.d.ts +18 -0
- package/dist/core/common/handler/metadata-handler.d.ts.map +1 -0
- package/dist/core/common/handler/metadata-handler.js +19 -0
- package/dist/core/common/handler/metadata-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/event/model.d.ts +20 -0
- package/dist/event/model.d.ts.map +1 -0
- package/dist/event/model.js +30 -0
- package/dist/event/model.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 +63 -0
- package/dist/payment-intent/api-endpoint.d.ts.map +1 -0
- package/dist/payment-intent/api-endpoint.js +95 -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 +91 -0
- package/dist/payment-intent/model.d.ts.map +1 -0
- package/dist/payment-intent/model.js +183 -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/dist/webhook/api-endpoint.d.ts +16 -0
- package/dist/webhook/api-endpoint.d.ts.map +1 -0
- package/dist/webhook/api-endpoint.js +33 -0
- package/dist/webhook/api-endpoint.js.map +1 -0
- package/dist/webhook/model.d.ts +35 -0
- package/dist/webhook/model.d.ts.map +1 -0
- package/dist/webhook/model.js +110 -0
- package/dist/webhook/model.js.map +1 -0
- package/dist/webhook/repository.d.ts +7 -0
- package/dist/webhook/repository.d.ts.map +1 -0
- package/dist/webhook/repository.js +10 -0
- package/dist/webhook/repository.js.map +1 -0
- package/dist/webhook/validator.d.ts +4 -0
- package/dist/webhook/validator.d.ts.map +1 -0
- package/dist/webhook/validator.js +16 -0
- package/dist/webhook/validator.js.map +1 -0
- package/package.json +4 -2
- package/src/api-endpoint/http/fetch-http-client.ts +8 -1
- package/src/core/common/handler/metadata-handler.ts +19 -0
- package/src/event/model.ts +42 -0
- package/src/payment-intent/api-endpoint.ts +2 -1
- package/src/payment-intent/model.ts +8 -3
- package/src/webhook/api-endpoint.ts +36 -0
- package/src/webhook/model.ts +140 -0
- package/src/webhook/repository.ts +14 -0
- package/src/webhook/validator.ts +18 -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/test/fixtures/endpoint.stub.ts +0 -22
- package/test/fixtures/list-endpoint.stub.ts +0 -33
- package/test/fixtures/list-model.stub.ts +0 -24
- package/test/fixtures/model.stub.ts +0 -12
- package/test/functional/address.test.ts +0 -126
- package/test/functional/card.test.ts +0 -175
- package/test/functional/customer.test.ts +0 -174
- package/test/functional/payment-intent.test.ts +0 -215
- package/test/functional/payment.test.ts +0 -206
- package/test/functional/refund.test.ts +0 -112
- package/test/functional/sepa.test.ts +0 -136
- package/test/integration/stub-integration.test.ts +0 -88
- package/test/stub/stub-endpoint.ts +0 -42
- package/test/stub/stub-model.ts +0 -82
- package/test/stub/stub-repository.ts +0 -11
- package/test/test-helper.ts +0 -133
- package/test/unit/address/api-endpoint.test.ts +0 -134
- package/test/unit/address/fixtures.ts +0 -60
- package/test/unit/address/model.test.ts +0 -75
- package/test/unit/address/repository.test.ts +0 -148
- package/test/unit/address/validator.test.ts +0 -49
- package/test/unit/api-endpoint/http/fetch-http-client.test.ts +0 -44
- package/test/unit/api-endpoint/http/http.test.ts +0 -152
- package/test/unit/card/api-endpoint.test.ts +0 -170
- package/test/unit/card/card-helper.ts +0 -116
- package/test/unit/card/fixtures.ts +0 -87
- package/test/unit/card/model.test.ts +0 -167
- package/test/unit/card/repository.test.ts +0 -146
- package/test/unit/card/validator.test.ts +0 -96
- package/test/unit/core/common/mutation-tracked-object.test.ts +0 -24
- package/test/unit/customer/api-endpoint.test.ts +0 -143
- package/test/unit/customer/fixtures.ts +0 -73
- package/test/unit/customer/model.test.ts +0 -90
- package/test/unit/customer/repository.test.ts +0 -148
- package/test/unit/customer/validator.test.ts +0 -62
- package/test/unit/payment/api-endpoint.test.ts +0 -188
- package/test/unit/payment/fixtures.ts +0 -116
- package/test/unit/payment/model.test.ts +0 -240
- package/test/unit/payment/repository.test.ts +0 -270
- package/test/unit/payment/validator.test.ts +0 -137
- package/test/unit/payment-intent/api-endpoint.test.ts +0 -142
- package/test/unit/payment-intent/fixtures.ts +0 -94
- package/test/unit/payment-intent/model.test.ts +0 -157
- package/test/unit/payment-intent/repository.test.ts +0 -263
- package/test/unit/payment-intent/validator.test.ts +0 -136
- package/test/unit/refund/api-endpoint.test.ts +0 -129
- package/test/unit/refund/fixtures.ts +0 -58
- package/test/unit/refund/model.test.ts +0 -89
- package/test/unit/refund/repository.test.ts +0 -157
- package/test/unit/refund/validator.test.ts +0 -89
- package/test/unit/sepa/api-endpoint.test.ts +0 -170
- package/test/unit/sepa/fixture.ts +0 -62
- package/test/unit/sepa/model.test.ts +0 -86
- package/test/unit/sepa/repository.test.ts +0 -149
- package/test/unit/sepa/sepa-helper.ts +0 -71
- package/test/unit/sepa/validator.test.ts +0 -58
- package/test/unit/stub/stub-endpoint.test.ts +0 -236
- package/test/unit/stub/stub-list-endpoint.test.ts +0 -86
- package/test/unit/stub/stub-model.test.ts +0 -111
- package/test/unit/stub/stub-repository.test.ts +0 -144
- package/tsconfig.json +0 -50
- package/vitest.config.ts +0 -20
package/.gitlab-ci.yml
DELETED
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
spec:
|
|
2
|
-
inputs:
|
|
3
|
-
nodeVersion:
|
|
4
|
-
default: 22
|
|
5
|
-
description: Node version.
|
|
6
|
-
|
|
7
|
-
---
|
|
8
|
-
|
|
9
|
-
.cache: &cache
|
|
10
|
-
key:
|
|
11
|
-
files:
|
|
12
|
-
- pnpm-lock.yaml
|
|
13
|
-
paths:
|
|
14
|
-
- node_modules/.bin
|
|
15
|
-
- node_modules/.cache/pnpm
|
|
16
|
-
- node_modules/.pnpm
|
|
17
|
-
- node_modules/@**
|
|
18
|
-
- node_modules/[a-z]**
|
|
19
|
-
- node_modules/.modules.yaml
|
|
20
|
-
unprotect: true
|
|
21
|
-
when: always
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.base:
|
|
25
|
-
image: wearestancer/node:$[[ inputs.nodeVersion ]]
|
|
26
|
-
|
|
27
|
-
before_script:
|
|
28
|
-
- section_start --collapsed node_install "Package install"
|
|
29
|
-
- echo "node $(node --version)"
|
|
30
|
-
- echo "pnpm $(pnpm --version)"
|
|
31
|
-
- pnpm config set store-dir node_modules/.cache/pnpm
|
|
32
|
-
- pnpm install --frozen-lockfile --prefer-offline
|
|
33
|
-
- section_end node_install
|
|
34
|
-
|
|
35
|
-
cache:
|
|
36
|
-
- <<: *cache
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
stages:
|
|
40
|
-
- test
|
|
41
|
-
- build
|
|
42
|
-
- deploy
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
workflow:
|
|
46
|
-
auto_cancel:
|
|
47
|
-
on_job_failure: none
|
|
48
|
-
on_new_commit: interruptible
|
|
49
|
-
rules:
|
|
50
|
-
- if: $CI_COMMIT_REF_PROTECTED == "true"
|
|
51
|
-
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
52
|
-
- if: $CI_PIPELINE_SOURCE == "web"
|
|
53
|
-
- if: "$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS"
|
|
54
|
-
when: never
|
|
55
|
-
- when: always
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
variables:
|
|
59
|
-
FF_SCRIPT_SECTIONS: true
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
ESLint:
|
|
63
|
-
extends:
|
|
64
|
-
- .base
|
|
65
|
-
|
|
66
|
-
stage: test
|
|
67
|
-
|
|
68
|
-
script:
|
|
69
|
-
- pnpm exec eslint --cache --cache-location 'node_modules/.cache/eslint' "**/*.{js,ts,vue}" || true
|
|
70
|
-
- pnpm exec eslint --cache --cache-location 'node_modules/.cache/eslint' --max-warnings 0 --format junit "**/*.{js,ts,vue}" > junit.xml
|
|
71
|
-
|
|
72
|
-
cache:
|
|
73
|
-
- <<: *cache
|
|
74
|
-
- key: "${CI_COMMIT_REF_SLUG}-eslint"
|
|
75
|
-
fallback_keys:
|
|
76
|
-
- "${CI_DEFAULT_BRANCH}-eslint"
|
|
77
|
-
paths:
|
|
78
|
-
- node_modules/.cache/eslint
|
|
79
|
-
unprotect: true
|
|
80
|
-
when: always
|
|
81
|
-
|
|
82
|
-
artifacts:
|
|
83
|
-
reports:
|
|
84
|
-
junit:
|
|
85
|
-
- junit.xml
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
Build Node package:
|
|
89
|
-
extends:
|
|
90
|
-
- .base
|
|
91
|
-
|
|
92
|
-
stage: build
|
|
93
|
-
|
|
94
|
-
script:
|
|
95
|
-
- section_start publish "Publish"
|
|
96
|
-
- pnpm publish --dry-run --no-git-check --report-summary
|
|
97
|
-
- section_end publish
|
|
98
|
-
|
|
99
|
-
rules:
|
|
100
|
-
- if: "$CI_COMMIT_TAG"
|
|
101
|
-
when: never
|
|
102
|
-
- when: on_success
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
Prettier check:
|
|
106
|
-
extends:
|
|
107
|
-
- .base
|
|
108
|
-
|
|
109
|
-
stage: test
|
|
110
|
-
|
|
111
|
-
script:
|
|
112
|
-
- section_start --collapsed prettier "Prettier rewrite files"
|
|
113
|
-
- pnpm exec prettier --cache-location node_modules/.cache/prettier --write . || true
|
|
114
|
-
- section_end prettier
|
|
115
|
-
|
|
116
|
-
- if [[ -f .npmrc ]]; then git restore .npmrc; fi
|
|
117
|
-
- git diff
|
|
118
|
-
- if [ -n "$(git status --untracked-files=no --porcelain)" ]; then exit 1; fi
|
|
119
|
-
|
|
120
|
-
cache:
|
|
121
|
-
- <<: *cache
|
|
122
|
-
- key: "${CI_COMMIT_REF_SLUG}-prettier"
|
|
123
|
-
fallback_keys:
|
|
124
|
-
- "${CI_DEFAULT_BRANCH}-prettier"
|
|
125
|
-
paths:
|
|
126
|
-
- node_modules/.cache/prettier
|
|
127
|
-
unprotect: true
|
|
128
|
-
when: always
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
Type check:
|
|
132
|
-
extends:
|
|
133
|
-
- .base
|
|
134
|
-
|
|
135
|
-
stage: test
|
|
136
|
-
|
|
137
|
-
script:
|
|
138
|
-
- pnpm exec tsc
|
|
139
|
-
- pnpm exec tsc --noEmit
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
Vitest:
|
|
143
|
-
extends:
|
|
144
|
-
- .base
|
|
145
|
-
|
|
146
|
-
stage: test
|
|
147
|
-
|
|
148
|
-
script:
|
|
149
|
-
- pnpm exec vitest --reporter=verbose --reporter=junit --outputFile.junit=reports/junit.xml
|
|
150
|
-
|
|
151
|
-
coverage: "/All\\sfiles.*?\\s+(\\d+.\\d+)/"
|
|
152
|
-
|
|
153
|
-
artifacts:
|
|
154
|
-
reports:
|
|
155
|
-
coverage_report:
|
|
156
|
-
coverage_format: cobertura
|
|
157
|
-
path: reports/cobertura-coverage.xml
|
|
158
|
-
junit:
|
|
159
|
-
- reports/junit.xml
|
package/.prettierignore
DELETED
package/eslint.config.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import js from '@eslint/js';
|
|
2
|
-
import { defineConfig } from 'eslint/config';
|
|
3
|
-
import globals from 'globals';
|
|
4
|
-
import tseslint from 'typescript-eslint';
|
|
5
|
-
|
|
6
|
-
export default defineConfig([
|
|
7
|
-
{
|
|
8
|
-
files: ['**/*.{js,mjs,cjs,ts,mts,cts}'],
|
|
9
|
-
plugins: { js },
|
|
10
|
-
extends: ['js/recommended'],
|
|
11
|
-
languageOptions: { globals: globals.node },
|
|
12
|
-
},
|
|
13
|
-
tseslint.configs.recommended,
|
|
14
|
-
]);
|
package/pnpm-workspace.yaml
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
catalogs:
|
|
2
|
-
eslint:
|
|
3
|
-
"@eslint/js": ^10.0.0
|
|
4
|
-
eslint: ^10.0.0
|
|
5
|
-
eslint-formatter-junit: ^9.0.0
|
|
6
|
-
globals: ^17.0.0
|
|
7
|
-
typescript-eslint: ^8.0.0
|
|
8
|
-
|
|
9
|
-
prettier:
|
|
10
|
-
"@stancer/prettier": ^3.0.0
|
|
11
|
-
prettier: ^3.0.0
|
|
12
|
-
|
|
13
|
-
vitest:
|
|
14
|
-
"@vitest/coverage-v8": ^4.0.0
|
|
15
|
-
vitest: ^4.0.0
|
|
16
|
-
|
|
17
|
-
lockfileIncludeTarballUrl: true
|
|
18
|
-
|
|
19
|
-
minimumReleaseAge: 10080 # 7days
|
package/prettier.config.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { IdValue } from '#core/common/branded-type.js';
|
|
2
|
-
import { randomNumber, randomString } from '#test/test-helper.js';
|
|
3
|
-
|
|
4
|
-
const id = 'stub_' + randomString(24, 24);
|
|
5
|
-
const defaultValue = randomString(1, 50);
|
|
6
|
-
const defaultNumber = randomNumber(12, 200);
|
|
7
|
-
export const stubSerialized = {
|
|
8
|
-
id,
|
|
9
|
-
default: defaultValue,
|
|
10
|
-
default_number: defaultNumber,
|
|
11
|
-
untouchable: false,
|
|
12
|
-
all_authorized: true,
|
|
13
|
-
ungettable: false,
|
|
14
|
-
unmodifiable: false,
|
|
15
|
-
};
|
|
16
|
-
export const stubDeserialized = {
|
|
17
|
-
id: id as IdValue,
|
|
18
|
-
default: defaultValue,
|
|
19
|
-
defaultNumber: defaultNumber,
|
|
20
|
-
allAuthorized: true,
|
|
21
|
-
unmodifiable: false,
|
|
22
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { randomNumber, randomString } from '#test/test-helper.js';
|
|
2
|
-
|
|
3
|
-
const stub = {
|
|
4
|
-
stubs: [
|
|
5
|
-
{
|
|
6
|
-
id: 'stub_' + randomString(24, 24),
|
|
7
|
-
default: randomString(1, 50),
|
|
8
|
-
defaultNumber: randomNumber(12, 263),
|
|
9
|
-
untouchable: true,
|
|
10
|
-
all_authorized: true,
|
|
11
|
-
ungettable: true,
|
|
12
|
-
unmodifiable: true,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: 'stub_' + randomString(24, 24),
|
|
16
|
-
default: randomString(1, 50),
|
|
17
|
-
defaultNumber: randomNumber(12, 263),
|
|
18
|
-
untouchable: true,
|
|
19
|
-
all_authorized: true,
|
|
20
|
-
ungettable: true,
|
|
21
|
-
unmodifiable: true,
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
range: {
|
|
25
|
-
count: 2080,
|
|
26
|
-
end: 9,
|
|
27
|
-
has_more: false,
|
|
28
|
-
limit: 2,
|
|
29
|
-
start: 0,
|
|
30
|
-
},
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default stub;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IdStub, StubData } from '#test/stub/stub-model.js';
|
|
2
|
-
import { randomNumber, randomString } from '#test/test-helper.js';
|
|
3
|
-
|
|
4
|
-
const listModel: StubData[] = [
|
|
5
|
-
{
|
|
6
|
-
id: ('stub_' + randomString(24, 24)) as IdStub,
|
|
7
|
-
default: randomString(1, 50),
|
|
8
|
-
defaultNumber: randomNumber(12, 100),
|
|
9
|
-
untouchable: true,
|
|
10
|
-
allAuthorized: true,
|
|
11
|
-
ungettable: true,
|
|
12
|
-
unmodifiable: true,
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
id: ('stub_' + randomString(24, 24)) as IdStub,
|
|
16
|
-
default: randomString(1, 50),
|
|
17
|
-
defaultNumber: randomNumber(12, 100),
|
|
18
|
-
untouchable: true,
|
|
19
|
-
allAuthorized: true,
|
|
20
|
-
ungettable: true,
|
|
21
|
-
unmodifiable: true,
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
export default listModel;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { randomNumber, randomString } from '#test/test-helper.js';
|
|
2
|
-
|
|
3
|
-
const model = {
|
|
4
|
-
default: randomString(1, 50),
|
|
5
|
-
defaultNumber: randomNumber(12, 100),
|
|
6
|
-
untouchable: true,
|
|
7
|
-
allAuthorized: true,
|
|
8
|
-
ungettable: true,
|
|
9
|
-
unmodifiable: true,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export default model;
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { Temporal } from 'temporal-polyfill';
|
|
2
|
-
import 'temporal-polyfill/global';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
|
|
5
|
-
import { idAddress } from '#address/model.js';
|
|
6
|
-
import { AddressRepository } from '#address/repository.js';
|
|
7
|
-
import { Configuration } from '#api/configuration.js';
|
|
8
|
-
import { StancerRouteInaccessibleError } from '#error/endpoint/route-inaccessible-error.js';
|
|
9
|
-
import { randomString } from '#test/test-helper.js';
|
|
10
|
-
|
|
11
|
-
const config = Configuration;
|
|
12
|
-
config.setKey({
|
|
13
|
-
privateLiveKey: null,
|
|
14
|
-
privateTestKey: process.env['API_KEY'] ?? null,
|
|
15
|
-
});
|
|
16
|
-
config._host = process.env['API_HOST'] ?? 'api.stancer.com';
|
|
17
|
-
|
|
18
|
-
describe('address functional', () => {
|
|
19
|
-
describe('address creation', () => {
|
|
20
|
-
const city = randomString(1, 50);
|
|
21
|
-
const country = randomString(2);
|
|
22
|
-
const zipCode = randomString(2, 16);
|
|
23
|
-
|
|
24
|
-
it('create an address with aliased value', async () => {
|
|
25
|
-
const repository = new AddressRepository();
|
|
26
|
-
const address = await repository.create({ zipCode, city, country });
|
|
27
|
-
await repository.send(address);
|
|
28
|
-
expect(address.id).toBeTruthy();
|
|
29
|
-
expect(address.id).toContain('addr_');
|
|
30
|
-
expect(address.zipCode).toBe(zipCode);
|
|
31
|
-
expect(address.city).toBe(city);
|
|
32
|
-
expect(address.country).toBe(country);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('create an address', async () => {
|
|
36
|
-
const repository = new AddressRepository();
|
|
37
|
-
const address = await repository.create({ zipCode, city, country });
|
|
38
|
-
const newAddress = await repository.send(address);
|
|
39
|
-
expect(address._data).toStrictEqual(newAddress._data);
|
|
40
|
-
expect(newAddress.id).toBeTruthy();
|
|
41
|
-
expect(newAddress.zipCode).toBe(zipCode);
|
|
42
|
-
expect(newAddress._data.zipCode).toBe(newAddress.zipCode);
|
|
43
|
-
expect(newAddress.city).toBe(city);
|
|
44
|
-
expect(newAddress.country).toBe(country);
|
|
45
|
-
});
|
|
46
|
-
it('create a complete address', async () => {
|
|
47
|
-
const repository = new AddressRepository();
|
|
48
|
-
|
|
49
|
-
const zipCode = randomString(2, 16);
|
|
50
|
-
const city = randomString(1, 50);
|
|
51
|
-
const country = randomString(2);
|
|
52
|
-
|
|
53
|
-
const line1 = randomString(1, 50);
|
|
54
|
-
const line2 = randomString(1, 50);
|
|
55
|
-
const line3 = randomString(1, 50);
|
|
56
|
-
const state = randomString(1, 3);
|
|
57
|
-
|
|
58
|
-
const address = await repository.create({ zipCode, city, line1, line2, line3, state, country });
|
|
59
|
-
await repository.send(address);
|
|
60
|
-
expect(address.id).toBeTruthy();
|
|
61
|
-
expect(address.zipCode).toBe(zipCode);
|
|
62
|
-
expect(address._data.zipCode).toBe(address.zipCode);
|
|
63
|
-
expect(address.city).toBe(city);
|
|
64
|
-
expect(address.country).toBe(country);
|
|
65
|
-
expect(address.line1).toBe(line1);
|
|
66
|
-
expect(address.line2).toBe(line2);
|
|
67
|
-
expect(address.line3).toBe(line3);
|
|
68
|
-
expect(address.state).toBe(state);
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('need required values', async () => {
|
|
72
|
-
const repository = new AddressRepository();
|
|
73
|
-
const addressWithoutZipCode = await repository.create({ city: randomString(1, 50), country: randomString(2) });
|
|
74
|
-
await expect(async () => await repository.send(addressWithoutZipCode)).rejects.toThrow(
|
|
75
|
-
'zipCode is required to send AddressModel',
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
const addressWithoutCity = await repository.create({ zipCode: 'Bloop', country: 'FR' });
|
|
79
|
-
await expect(async () => await repository.send(addressWithoutCity)).rejects.toThrow(
|
|
80
|
-
'city is required to send AddressModel',
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
const addressWithoutCountry = await repository.create({ zipCode: 'Bloop', city: randomString(12) });
|
|
84
|
-
await expect(async () => await repository.send(addressWithoutCountry)).rejects.toThrow(
|
|
85
|
-
'country is required to send AddressModel',
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe('patch', () => {
|
|
90
|
-
it('is not available on address', async () => {
|
|
91
|
-
const repository = new AddressRepository();
|
|
92
|
-
|
|
93
|
-
const zipCode = randomString(2, 16);
|
|
94
|
-
const city = randomString(1, 50);
|
|
95
|
-
const country = randomString(2);
|
|
96
|
-
|
|
97
|
-
const address = await repository.create({ zipCode, city, country });
|
|
98
|
-
await repository.send(address);
|
|
99
|
-
address.setLine1(randomString(1, 25));
|
|
100
|
-
await expect(() => repository.send(address)).rejects.toThrow(StancerRouteInaccessibleError);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
describe('get', () => {
|
|
104
|
-
it('get the correct object', async () => {
|
|
105
|
-
const repository = new AddressRepository();
|
|
106
|
-
const id = idAddress('addr_YHvhVplBRGET3V7Ns4B6pzD2');
|
|
107
|
-
const address = await repository.create(id);
|
|
108
|
-
expect(address.id).toBe(id);
|
|
109
|
-
expect(address.zipCode).toBe('75008');
|
|
110
|
-
expect(address.zipCode).toBe(address._data.zipCode);
|
|
111
|
-
expect(address.city).toBe('Paris');
|
|
112
|
-
expect(address.country).toBe('FR');
|
|
113
|
-
expect(address.line1).toBe('10 rue');
|
|
114
|
-
expect(address.line2).toBe('de la ville');
|
|
115
|
-
expect(address.line3).toBe('leveque');
|
|
116
|
-
expect(address.state).toBe('IDF');
|
|
117
|
-
expect(address.createdAt).toBeInstanceOf(Temporal.Instant);
|
|
118
|
-
// we are not checking the exact hour for Timecode reason (not the same in our pipeline and locally)
|
|
119
|
-
expect(address.createdAt?.toLocaleString()).toContain('8/13/2026, ');
|
|
120
|
-
expect(address.createdAt?.toLocaleString()).toContain(':36:22 PM');
|
|
121
|
-
|
|
122
|
-
expect(address._data.createdAt).toStrictEqual(address.createdAt);
|
|
123
|
-
expect(address.deleted).toBe(false);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
});
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
import { Temporal } from 'temporal-polyfill';
|
|
2
|
-
import 'temporal-polyfill/global';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
|
|
5
|
-
import { Configuration } from '#api/configuration.js';
|
|
6
|
-
import { PreferredNetworkCardEnum } from '#card/enum/network.js';
|
|
7
|
-
import { IdCard } from '#card/model.js';
|
|
8
|
-
import { CardRepository } from '#card/repository.js';
|
|
9
|
-
import { idCustomer } from '#customer/model.ts';
|
|
10
|
-
import { randomCVC, randomExpYear, randomMonth, randomNumber, randomString } from '#test/test-helper.js';
|
|
11
|
-
import { getValidCardNumber } from '#test/unit/card/card-helper.js';
|
|
12
|
-
|
|
13
|
-
const config = Configuration;
|
|
14
|
-
|
|
15
|
-
config.setKey({
|
|
16
|
-
privateLiveKey: null,
|
|
17
|
-
privateTestKey: process.env['API_KEY'] ?? null,
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
config._host = process.env['API_HOST'] ?? 'api.stancer.com';
|
|
21
|
-
|
|
22
|
-
describe('card functional', () => {
|
|
23
|
-
describe('card creation', () => {
|
|
24
|
-
const expMonth = randomMonth();
|
|
25
|
-
const expYear = randomExpYear();
|
|
26
|
-
const number = getValidCardNumber();
|
|
27
|
-
|
|
28
|
-
it('create an card with minimum information', async () => {
|
|
29
|
-
const repository = new CardRepository();
|
|
30
|
-
|
|
31
|
-
const card = await repository.create({ expMonth, expYear, number });
|
|
32
|
-
await repository.send(card);
|
|
33
|
-
expect(card.id).toBeTruthy();
|
|
34
|
-
expect(card.id).toContain('card_');
|
|
35
|
-
expect(card.last4).toBe(number.slice(number.length - 4));
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('create a complete flat card', async () => {
|
|
39
|
-
const repository = new CardRepository();
|
|
40
|
-
const cvc = randomCVC();
|
|
41
|
-
const expMonth = randomMonth();
|
|
42
|
-
const expYear = randomExpYear();
|
|
43
|
-
const externalId = randomString(1, 36);
|
|
44
|
-
const number = getValidCardNumber();
|
|
45
|
-
const last4 = number.slice(number.length - 4);
|
|
46
|
-
const name = randomString(3, 64);
|
|
47
|
-
const preferredNetwork = PreferredNetworkCardEnum[randomNumber(0, PreferredNetworkCardEnum.length - 1)];
|
|
48
|
-
const zipCode = randomString(2, 8);
|
|
49
|
-
|
|
50
|
-
const card = await repository.create({
|
|
51
|
-
cvc,
|
|
52
|
-
expMonth,
|
|
53
|
-
expYear,
|
|
54
|
-
externalId,
|
|
55
|
-
number,
|
|
56
|
-
last4,
|
|
57
|
-
name,
|
|
58
|
-
preferredNetwork,
|
|
59
|
-
zipCode,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
await repository.send(card);
|
|
63
|
-
|
|
64
|
-
expect(card.id).toBeTruthy();
|
|
65
|
-
expect(card).toMatchObject({ expMonth, expYear, last4 });
|
|
66
|
-
});
|
|
67
|
-
it('create a complete card with customer', async () => {
|
|
68
|
-
const repository = new CardRepository();
|
|
69
|
-
const customer = idCustomer(`cust_SsySBRtGUq3pG9zbSOhJSKCa`);
|
|
70
|
-
|
|
71
|
-
const expMonth = randomMonth();
|
|
72
|
-
const expYear = randomExpYear();
|
|
73
|
-
const number = getValidCardNumber();
|
|
74
|
-
|
|
75
|
-
const card = await repository.create({ customer, expMonth, expYear, number });
|
|
76
|
-
|
|
77
|
-
await repository.send(card);
|
|
78
|
-
|
|
79
|
-
expect(card.id).toBeTruthy();
|
|
80
|
-
expect(card.expMonth).toBe(expMonth);
|
|
81
|
-
expect(card.expYear).toBe(expYear);
|
|
82
|
-
expect(card.last4).toBe(number.slice(number.length - 4));
|
|
83
|
-
const now = Temporal.Now.plainDateISO();
|
|
84
|
-
// We check that the date had been created today.
|
|
85
|
-
// If not we cannot ensure the card has the customer we sent.
|
|
86
|
-
if (
|
|
87
|
-
card.createdAt?.toZonedDateTimeISO('UTC').year === now.year &&
|
|
88
|
-
card.createdAt?.toZonedDateTimeISO('UTC').month === now.month &&
|
|
89
|
-
card.createdAt?.toZonedDateTimeISO('UTC').day === now.day
|
|
90
|
-
) {
|
|
91
|
-
expect(card.customer).toBe(customer);
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
it('need required expMonth', async () => {
|
|
96
|
-
const expYear = randomExpYear();
|
|
97
|
-
const number = getValidCardNumber();
|
|
98
|
-
|
|
99
|
-
const repository = new CardRepository();
|
|
100
|
-
|
|
101
|
-
const cardWithoutRequiredValue = await repository.create({ expYear, number });
|
|
102
|
-
|
|
103
|
-
await expect(async () => await repository.send(cardWithoutRequiredValue)).rejects.toThrow(
|
|
104
|
-
'expMonth is required to send CardModel',
|
|
105
|
-
);
|
|
106
|
-
});
|
|
107
|
-
it('need required expYear', async () => {
|
|
108
|
-
const repository = new CardRepository();
|
|
109
|
-
|
|
110
|
-
const cardWithoutRequiredValue = await repository.create({ expMonth, number });
|
|
111
|
-
|
|
112
|
-
await expect(async () => await repository.send(cardWithoutRequiredValue)).rejects.toThrow(
|
|
113
|
-
'expYear is required to send CardModel',
|
|
114
|
-
);
|
|
115
|
-
});
|
|
116
|
-
it('need required number', async () => {
|
|
117
|
-
const repository = new CardRepository();
|
|
118
|
-
|
|
119
|
-
const cardWithoutRequiredValue = await repository.create({ expMonth, expYear });
|
|
120
|
-
|
|
121
|
-
await expect(async () => await repository.send(cardWithoutRequiredValue)).rejects.toThrow(
|
|
122
|
-
'number is required to send CardModel',
|
|
123
|
-
);
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
describe('patch', () => {
|
|
128
|
-
it('is available on card', async () => {
|
|
129
|
-
const repository = new CardRepository();
|
|
130
|
-
|
|
131
|
-
const expMonth = randomMonth();
|
|
132
|
-
const expYear = randomExpYear();
|
|
133
|
-
const number = getValidCardNumber();
|
|
134
|
-
const card = await repository.create({ expMonth, expYear, number });
|
|
135
|
-
|
|
136
|
-
await repository.send(card);
|
|
137
|
-
const id = card.id;
|
|
138
|
-
expect(id).toBeTruthy();
|
|
139
|
-
expect(card.expMonth).toBe(expMonth);
|
|
140
|
-
expect(card.expYear).toBe(expYear);
|
|
141
|
-
|
|
142
|
-
const newExpYear = randomExpYear() + 1;
|
|
143
|
-
card.setExpYear(newExpYear);
|
|
144
|
-
await repository.send(card);
|
|
145
|
-
expect(id).toBe(card.id);
|
|
146
|
-
expect(card.expYear).toBe(newExpYear);
|
|
147
|
-
expect(card.expMonth).toBe(expMonth);
|
|
148
|
-
});
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
describe('get', () => {
|
|
152
|
-
it('get the correct object', async () => {
|
|
153
|
-
const repository = new CardRepository();
|
|
154
|
-
const id = 'card_uqY2HrovY2sPm0Ac2xhnBkfU' as IdCard;
|
|
155
|
-
const card = await repository.create(id);
|
|
156
|
-
expect(card.id).toBe(id);
|
|
157
|
-
expect(card.brand).toBe('visa');
|
|
158
|
-
expect(card.country).toBe('US');
|
|
159
|
-
expect(card.funding).toBe('credit');
|
|
160
|
-
expect(card.last4).toBe('3055');
|
|
161
|
-
expect(card.nature).toBe('personal');
|
|
162
|
-
expect(card.network).toBe('visa');
|
|
163
|
-
expect(card.zipCode).toBe('75001');
|
|
164
|
-
expect(card.createdAt.epochMilliseconds).toBe(1758551022000);
|
|
165
|
-
expect(card.deleted).toBe(false);
|
|
166
|
-
expect(card.expMonth).toBe(12);
|
|
167
|
-
expect(card.expYear).toBe(2099);
|
|
168
|
-
});
|
|
169
|
-
it('get a 404 exception if unknown', async () => {
|
|
170
|
-
const id = 'card_' + randomString(24);
|
|
171
|
-
const repository = new CardRepository();
|
|
172
|
-
await expect(() => repository.create(id)).rejects.toThrow();
|
|
173
|
-
});
|
|
174
|
-
});
|
|
175
|
-
});
|