@peable.to/contracts 1.1.0 → 1.2.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.
@@ -16,7 +16,7 @@ exports.isBaseUnitString = isBaseUnitString;
16
16
  * chain rail, and on the card rail the fiat set the provider settles for the
17
17
  * payment methods Orbit offers (cards, wallets, SEPA Debit, iDEAL, Bancontact,
18
18
  * EPS). A local method narrows it further per payment
19
- * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfiguration.ts`).
19
+ * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfigurations.ts`).
20
20
  *
21
21
  * A closed set, and the database mirrors it as a CHECK
22
22
  * (`db/schema/valueSets.ts`). ADR 0001 D4: the scale of an amount is a property
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  // Payment method breadth on the card rail (`pmc_…`, `pmd_…`). Zod-free.
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.PAYMENT_METHOD_UNAVAILABLE_REASONS = exports.PAYMENT_METHOD_CONFIGURATION_TYPES = void 0;
4
+ exports.PAYMENT_METHOD_CURRENCIES = exports.PAYMENT_METHOD_UNAVAILABLE_REASONS = exports.PAYMENT_METHOD_CONFIGURATION_TYPES = void 0;
5
+ const money_1 = require("./money");
5
6
  /**
6
7
  * The methods a configuration can turn on.
7
8
  *
@@ -34,3 +35,18 @@ exports.PAYMENT_METHOD_UNAVAILABLE_REASONS = [
34
35
  'provider_unsupported',
35
36
  'requires_card',
36
37
  ];
38
+ /**
39
+ * The currencies each method can take a payment in. A method is offered on a
40
+ * payment only when its currency is listed — so iDEAL never appears on a USD
41
+ * payment, and a payer is never shown a method that would fail.
42
+ */
43
+ exports.PAYMENT_METHOD_CURRENCIES = Object.freeze({
44
+ card: money_1.FIAT_CURRENCY_CODES,
45
+ apple_pay: money_1.FIAT_CURRENCY_CODES,
46
+ google_pay: money_1.FIAT_CURRENCY_CODES,
47
+ sepa_debit: ['EUR'],
48
+ ideal: ['EUR'],
49
+ bancontact: ['EUR'],
50
+ eps: ['EUR'],
51
+ bizum: ['EUR'],
52
+ });
@@ -10,7 +10,7 @@
10
10
  * chain rail, and on the card rail the fiat set the provider settles for the
11
11
  * payment methods Orbit offers (cards, wallets, SEPA Debit, iDEAL, Bancontact,
12
12
  * EPS). A local method narrows it further per payment
13
- * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfiguration.ts`).
13
+ * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfigurations.ts`).
14
14
  *
15
15
  * A closed set, and the database mirrors it as a CHECK
16
16
  * (`db/schema/valueSets.ts`). ADR 0001 D4: the scale of an amount is a property
@@ -1,4 +1,5 @@
1
1
  // Payment method breadth on the card rail (`pmc_…`, `pmd_…`). Zod-free.
2
+ import { FIAT_CURRENCY_CODES } from './money.js';
2
3
  /**
3
4
  * The methods a configuration can turn on.
4
5
  *
@@ -31,3 +32,18 @@ export const PAYMENT_METHOD_UNAVAILABLE_REASONS = [
31
32
  'provider_unsupported',
32
33
  'requires_card',
33
34
  ];
35
+ /**
36
+ * The currencies each method can take a payment in. A method is offered on a
37
+ * payment only when its currency is listed — so iDEAL never appears on a USD
38
+ * payment, and a payer is never shown a method that would fail.
39
+ */
40
+ export const PAYMENT_METHOD_CURRENCIES = Object.freeze({
41
+ card: FIAT_CURRENCY_CODES,
42
+ apple_pay: FIAT_CURRENCY_CODES,
43
+ google_pay: FIAT_CURRENCY_CODES,
44
+ sepa_debit: ['EUR'],
45
+ ideal: ['EUR'],
46
+ bancontact: ['EUR'],
47
+ eps: ['EUR'],
48
+ bizum: ['EUR'],
49
+ });
@@ -3,7 +3,7 @@
3
3
  * chain rail, and on the card rail the fiat set the provider settles for the
4
4
  * payment methods Orbit offers (cards, wallets, SEPA Debit, iDEAL, Bancontact,
5
5
  * EPS). A local method narrows it further per payment
6
- * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfiguration.ts`).
6
+ * (`PAYMENT_METHOD_CURRENCIES` in `paymentMethodConfigurations.ts`).
7
7
  *
8
8
  * A closed set, and the database mirrors it as a CHECK
9
9
  * (`db/schema/valueSets.ts`). ADR 0001 D4: the scale of an amount is a property
@@ -1,3 +1,4 @@
1
+ import { type FiatCurrencyCode } from './money';
1
2
  /**
2
3
  * The methods a configuration can turn on.
3
4
  *
@@ -20,3 +21,9 @@ export type PaymentMethodConfigurationType = (typeof PAYMENT_METHOD_CONFIGURATIO
20
21
  */
21
22
  export declare const PAYMENT_METHOD_UNAVAILABLE_REASONS: readonly ["provider_unsupported", "requires_card"];
22
23
  export type PaymentMethodUnavailableReason = (typeof PAYMENT_METHOD_UNAVAILABLE_REASONS)[number];
24
+ /**
25
+ * The currencies each method can take a payment in. A method is offered on a
26
+ * payment only when its currency is listed — so iDEAL never appears on a USD
27
+ * payment, and a payer is never shown a method that would fail.
28
+ */
29
+ export declare const PAYMENT_METHOD_CURRENCIES: Readonly<Record<PaymentMethodConfigurationType, readonly FiatCurrencyCode[]>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peable.to/contracts",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "The Peable wire, declared once: Zod contracts of every public route, the OpenAPI 3.1 generator and the closed value sets (ADR 0014 D5).",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -36,6 +36,18 @@
36
36
  },
37
37
  "default": "./dist/esm/vocabulary/index.js"
38
38
  },
39
+ "./vocabulary/*": {
40
+ "react-native": "./dist/esm/vocabulary/*.js",
41
+ "import": {
42
+ "types": "./dist/types/vocabulary/*.d.ts",
43
+ "default": "./dist/esm/vocabulary/*.js"
44
+ },
45
+ "require": {
46
+ "types": "./dist/types/vocabulary/*.d.ts",
47
+ "default": "./dist/cjs/vocabulary/*.js"
48
+ },
49
+ "default": "./dist/esm/vocabulary/*.js"
50
+ },
39
51
  "./contributions": {
40
52
  "react-native": "./dist/esm/contributions.js",
41
53
  "import": {
@@ -106,6 +118,9 @@
106
118
  "vocabulary": [
107
119
  "./dist/types/vocabulary/index.d.ts"
108
120
  ],
121
+ "vocabulary/*": [
122
+ "./dist/types/vocabulary/*.d.ts"
123
+ ],
109
124
  "contributions": [
110
125
  "./dist/types/contributions.d.ts"
111
126
  ],