@fire-spark/payments 0.7.0 → 0.7.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/dist/index.d.ts +5 -2
- package/dist/index.js +4 -2
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -428,6 +428,8 @@ type PaymentAdapter = {
|
|
|
428
428
|
reversalFor?(result: PaymentResult, now: Date): PaymentReversal;
|
|
429
429
|
terminal?: TerminalOperations;
|
|
430
430
|
capabilities?: PaymentAdapterCapabilities;
|
|
431
|
+
/** Adapter default over the library one; dashboard config still wins. */
|
|
432
|
+
policy?: Partial<PaymentPolicy>;
|
|
431
433
|
errors: PaymentErrorDictionary;
|
|
432
434
|
};
|
|
433
435
|
type PaymentAdapterCapabilities = {
|
|
@@ -467,10 +469,11 @@ declare const defaultReversalFor: (result: PaymentResult) => PaymentReversal;
|
|
|
467
469
|
//#region src/policy.d.ts
|
|
468
470
|
declare const DEFAULT_PAYMENT_POLICY: PaymentPolicy;
|
|
469
471
|
/**
|
|
470
|
-
* Library default, then `payment_methods.config`
|
|
471
|
-
* `qr_ttl_ms`), then `payments.config.runtime`.
|
|
472
|
+
* Library default, then the adapter's `policy`, then `payment_methods.config`
|
|
473
|
+
* (its `runtime` or root `qr_ttl_ms`), then `payments.config.runtime`.
|
|
472
474
|
*/
|
|
473
475
|
declare const resolvePaymentPolicy: (input: {
|
|
476
|
+
adapterPolicy?: Partial<PaymentPolicy> | null;
|
|
474
477
|
methodConfig?: Record<string, unknown> | null;
|
|
475
478
|
paymentConfig?: Record<string, unknown> | null;
|
|
476
479
|
}) => PaymentPolicy;
|
package/dist/index.js
CHANGED
|
@@ -1179,10 +1179,11 @@ const pickPolicy = (value) => {
|
|
|
1179
1179
|
return out;
|
|
1180
1180
|
};
|
|
1181
1181
|
/**
|
|
1182
|
-
* Library default, then `payment_methods.config`
|
|
1183
|
-
* `qr_ttl_ms`), then `payments.config.runtime`.
|
|
1182
|
+
* Library default, then the adapter's `policy`, then `payment_methods.config`
|
|
1183
|
+
* (its `runtime` or root `qr_ttl_ms`), then `payments.config.runtime`.
|
|
1184
1184
|
*/
|
|
1185
1185
|
const resolvePaymentPolicy = (input) => {
|
|
1186
|
+
const fromAdapter = pickPolicy(input.adapterPolicy);
|
|
1186
1187
|
const method = input.methodConfig ?? {};
|
|
1187
1188
|
const fromMethod = {
|
|
1188
1189
|
...pickPolicy(method),
|
|
@@ -1191,6 +1192,7 @@ const resolvePaymentPolicy = (input) => {
|
|
|
1191
1192
|
const fromPayment = pickPolicy(input.paymentConfig?.runtime);
|
|
1192
1193
|
return {
|
|
1193
1194
|
...DEFAULT_PAYMENT_POLICY,
|
|
1195
|
+
...fromAdapter,
|
|
1194
1196
|
...fromMethod,
|
|
1195
1197
|
...fromPayment
|
|
1196
1198
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fire-spark/payments",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"description": "Fire Spark payments contract: adapters, errors, amounts and policy",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"big.js": "6.2.1",
|
|
21
|
-
"@fire-spark/types": "^0.7.
|
|
21
|
+
"@fire-spark/types": "^0.7.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@types/big.js": "6.2.2",
|