@fun-xyz/fiat-contract 0.22.0 → 0.22.1

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 CHANGED
@@ -127,7 +127,7 @@ three kinds:
127
127
  | --- | --- | --- |
128
128
  | `observe` | `checkout`, and `credentials` (`customerId`, `accessToken`) once the SDK has them | writes nothing new |
129
129
  | `kyc` | `checkout`, `credentials`, `values` keyed by `KycFieldId` (no form id) | drops values MoonPay no longer asks for |
130
- | `order` | `orderId`, `transactionId?`, `quotedAmount` | returns the recorded order |
130
+ | `order` | `orderId`, `transactionId?`, `quotedAmount`, `geo?` (the checkout's) | returns the recorded order |
131
131
 
132
132
  `observe` and `kyc` answer a `MoonPayStepResponse`, which says what the backend needs next:
133
133
 
@@ -142,7 +142,9 @@ three kinds:
142
142
 
143
143
  `order` runs after every charge attempt, a failed one too, and answers a `MoonPayOrderResponse`.
144
144
  `transactionId` is optional because a failed charge may have none; without it the backend records the
145
- failed charges MoonPay lists for `orderId`. `quotedAmount` is the fiat amount the quote showed. A
145
+ failed charges MoonPay lists for `orderId`. `quotedAmount` is the fiat amount the quote showed.
146
+ `geo` is the same object `observe` sends in `checkout`; the order records its `alpha2` as its
147
+ country, and no country without it. A
146
148
  failed charge answers `DONE` with the order in `FAILED`, and the client requotes for a new `orderId`.
147
149
  After a failed charge with no `transactionId`, the client caps its `PENDING` polls.
148
150
 
@@ -6,4 +6,4 @@ var MOONPAY_ENDPOINTS = {
6
6
  export {
7
7
  MOONPAY_ENDPOINTS
8
8
  };
9
- //# sourceMappingURL=chunk-SJ7V3YOM.mjs.map
9
+ //# sourceMappingURL=chunk-I63WALQK.mjs.map
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "0.22.0";
2
+ var version = "0.22.1";
3
3
 
4
4
  // src/table.ts
5
5
  var TABLE_VERSION = version;
@@ -514,4 +514,4 @@ export {
514
514
  tableEntry,
515
515
  isTerminal
516
516
  };
517
- //# sourceMappingURL=chunk-7OUDI3JX.mjs.map
517
+ //# sourceMappingURL=chunk-PP6S7FSJ.mjs.map
package/dist/index.js CHANGED
@@ -1067,7 +1067,7 @@ var $stepResponse = import_zod.z.union([$providerBoundStepResponse, $blockedStep
1067
1067
  var FiatStepResponseSchema = $stepResponse;
1068
1068
 
1069
1069
  // package.json
1070
- var version = "0.22.0";
1070
+ var version = "0.22.1";
1071
1071
 
1072
1072
  // src/table.ts
1073
1073
  var TABLE_VERSION = version;
@@ -2681,11 +2681,12 @@ var FIAT_CURRENCY_CODES2 = Object.keys(FIAT_CURRENCY_NAMES);
2681
2681
  var obj2 = (shape) => import_zod2.z.object(shape).strict();
2682
2682
  var $nonEmpty = import_zod2.z.string().refine((value) => value.trim().length > 0, "must not be blank");
2683
2683
  var hasUniqueIds2 = (ids) => new Set(ids).size === ids.length;
2684
+ var $geo = obj2({ alpha2: import_zod2.z.string().regex(/^[A-Z]{2}$/), region: $nonEmpty.optional(), ip: $nonEmpty.optional() });
2684
2685
  var $checkout = obj2({
2685
2686
  amount: FiatAmountSchema,
2686
2687
  destination: obj2({ asset: $nonEmpty, network: $nonEmpty }),
2687
2688
  paymentMethod: import_zod2.z.literal("apple_pay"),
2688
- geo: obj2({ alpha2: import_zod2.z.string().regex(/^[A-Z]{2}$/), region: $nonEmpty.optional(), ip: $nonEmpty.optional() })
2689
+ geo: $geo
2689
2690
  });
2690
2691
  var MoonPayCheckoutSchema = $checkout;
2691
2692
  var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
@@ -2698,7 +2699,13 @@ var $intentRequest = import_zod2.z.discriminatedUnion("kind", [
2698
2699
  credentials: $credentials,
2699
2700
  values: import_zod2.z.record(KycFieldIdSchema, import_zod2.z.string()).refine((values) => Object.keys(values).length > 0, "values must not be empty")
2700
2701
  }),
2701
- obj2({ kind: import_zod2.z.literal("order"), orderId: $nonEmpty, transactionId: $nonEmpty.optional(), quotedAmount: FiatAmountSchema })
2702
+ obj2({
2703
+ kind: import_zod2.z.literal("order"),
2704
+ orderId: $nonEmpty,
2705
+ transactionId: $nonEmpty.optional(),
2706
+ quotedAmount: FiatAmountSchema,
2707
+ geo: $geo.optional()
2708
+ })
2702
2709
  ]);
2703
2710
  var MoonPayIntentRequestSchema = $intentRequest;
2704
2711
  var $quoteInput = obj2({
package/dist/index.mjs CHANGED
@@ -12,10 +12,10 @@ import {
12
12
  tableEntry,
13
13
  unofferedEndpoints,
14
14
  unreachableStates
15
- } from "./chunk-7OUDI3JX.mjs";
15
+ } from "./chunk-PP6S7FSJ.mjs";
16
16
  import {
17
17
  MOONPAY_ENDPOINTS
18
- } from "./chunk-SJ7V3YOM.mjs";
18
+ } from "./chunk-I63WALQK.mjs";
19
19
  import {
20
20
  FIAT_TERMS_ENDPOINT,
21
21
  FUN_KYC_CONSENT_DOCUMENTS,
@@ -2021,11 +2021,12 @@ var FIAT_CURRENCY_CODES2 = Object.keys(FIAT_CURRENCY_NAMES);
2021
2021
  var obj2 = (shape) => z2.object(shape).strict();
2022
2022
  var $nonEmpty = z2.string().refine((value) => value.trim().length > 0, "must not be blank");
2023
2023
  var hasUniqueIds2 = (ids) => new Set(ids).size === ids.length;
2024
+ var $geo = obj2({ alpha2: z2.string().regex(/^[A-Z]{2}$/), region: $nonEmpty.optional(), ip: $nonEmpty.optional() });
2024
2025
  var $checkout = obj2({
2025
2026
  amount: FiatAmountSchema,
2026
2027
  destination: obj2({ asset: $nonEmpty, network: $nonEmpty }),
2027
2028
  paymentMethod: z2.literal("apple_pay"),
2028
- geo: obj2({ alpha2: z2.string().regex(/^[A-Z]{2}$/), region: $nonEmpty.optional(), ip: $nonEmpty.optional() })
2029
+ geo: $geo
2029
2030
  });
2030
2031
  var MoonPayCheckoutSchema = $checkout;
2031
2032
  var $credentials = obj2({ customerId: $nonEmpty, accessToken: $nonEmpty });
@@ -2038,7 +2039,13 @@ var $intentRequest = z2.discriminatedUnion("kind", [
2038
2039
  credentials: $credentials,
2039
2040
  values: z2.record(KycFieldIdSchema, z2.string()).refine((values) => Object.keys(values).length > 0, "values must not be empty")
2040
2041
  }),
2041
- obj2({ kind: z2.literal("order"), orderId: $nonEmpty, transactionId: $nonEmpty.optional(), quotedAmount: FiatAmountSchema })
2042
+ obj2({
2043
+ kind: z2.literal("order"),
2044
+ orderId: $nonEmpty,
2045
+ transactionId: $nonEmpty.optional(),
2046
+ quotedAmount: FiatAmountSchema,
2047
+ geo: $geo.optional()
2048
+ })
2042
2049
  ]);
2043
2050
  var MoonPayIntentRequestSchema = $intentRequest;
2044
2051
  var $quoteInput = obj2({
@@ -60,13 +60,15 @@ export type MoonPayIntentRequest =
60
60
  /**
61
61
  * After every charge attempt, a failed one too. `transactionId` is from the Apple Pay event when it
62
62
  * has one; without it the backend records the failed charges MoonPay lists for `orderId`.
63
- * `quotedAmount` is the fiat amount the buyer saw on the quote.
63
+ * `quotedAmount` is the fiat amount the buyer saw on the quote. `geo` is the checkout's, as sent on
64
+ * `observe`; the order records its `alpha2`, and no country when it is absent.
64
65
  */
65
66
  | {
66
67
  kind: 'order';
67
68
  orderId: string;
68
69
  transactionId?: string;
69
70
  quotedAmount: FiatAmount;
71
+ geo?: MoonPayCheckout['geo'];
70
72
  };
71
73
  export type MoonPayIntentKind = MoonPayIntentRequest['kind'];
72
74
  /**
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  MOONPAY_ENDPOINTS
3
- } from "../chunk-SJ7V3YOM.mjs";
3
+ } from "../chunk-I63WALQK.mjs";
4
4
  export {
5
5
  MOONPAY_ENDPOINTS
6
6
  };
package/dist/table.js CHANGED
@@ -36,7 +36,7 @@ __export(table_exports, {
36
36
  module.exports = __toCommonJS(table_exports);
37
37
 
38
38
  // package.json
39
- var version = "0.22.0";
39
+ var version = "0.22.1";
40
40
 
41
41
  // src/table.ts
42
42
  var TABLE_VERSION = version;
package/dist/table.mjs CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  tableEntry,
12
12
  unofferedEndpoints,
13
13
  unreachableStates
14
- } from "./chunk-7OUDI3JX.mjs";
14
+ } from "./chunk-PP6S7FSJ.mjs";
15
15
  export {
16
16
  DOCUMENTED_ENDPOINTS,
17
17
  STATE_KEYS,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fun-xyz/fiat-contract",
3
- "version": "0.22.0",
3
+ "version": "0.22.1",
4
4
  "description": "Published conformance contract for Fun's headless fiat onramp: FlowState/Transition types, zod schemas, the transition table as data, recorded fixtures, assertion helpers.",
5
5
  "license": "MIT",
6
6
  "repository": {