@peable.to/contracts 0.4.0 → 1.0.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.
Files changed (316) hide show
  1. package/dist/cjs/common/address.js +81 -0
  2. package/dist/cjs/common/envelopes.js +101 -0
  3. package/dist/cjs/common/objects.js +85 -0
  4. package/dist/cjs/common/params.js +211 -0
  5. package/dist/cjs/common/primitives.js +39 -0
  6. package/dist/cjs/contributions.js +22 -0
  7. package/dist/cjs/index.js +40 -137
  8. package/dist/cjs/openapi/document.js +297 -0
  9. package/dist/cjs/openapi/index.js +7 -0
  10. package/dist/cjs/openapi/webhooks.js +17 -0
  11. package/dist/cjs/resources/billingEngine/billingPortal.js +237 -0
  12. package/dist/cjs/resources/billingEngine/creditNotes.js +189 -0
  13. package/dist/cjs/resources/billingEngine/customerBalanceTransactions.js +90 -0
  14. package/dist/cjs/resources/billingEngine/index.js +43 -0
  15. package/dist/cjs/resources/billingEngine/invoiceItems.js +155 -0
  16. package/dist/cjs/resources/billingEngine/invoices.js +509 -0
  17. package/dist/cjs/resources/billingEngine/params.js +43 -0
  18. package/dist/cjs/resources/billingEngine/public.js +326 -0
  19. package/dist/cjs/resources/billingEngine/subscriptions.js +476 -0
  20. package/dist/cjs/resources/catalog/billing.js +755 -0
  21. package/dist/cjs/resources/catalog/billingSettings.js +131 -0
  22. package/dist/cjs/resources/catalog/coupons.js +222 -0
  23. package/dist/cjs/resources/catalog/entitlements.js +257 -0
  24. package/dist/cjs/resources/catalog/index.js +58 -0
  25. package/dist/cjs/resources/catalog/meters.js +279 -0
  26. package/dist/cjs/resources/catalog/prices.js +423 -0
  27. package/dist/cjs/resources/catalog/products.js +228 -0
  28. package/dist/cjs/resources/catalog/promotionCodes.js +174 -0
  29. package/dist/cjs/resources/catalog/shared.js +75 -0
  30. package/dist/cjs/resources/catalog/testClocks.js +127 -0
  31. package/dist/cjs/resources/checkout/checkoutSessions.js +582 -0
  32. package/dist/cjs/resources/checkout/contributions.js +172 -0
  33. package/dist/cjs/resources/checkout/files.js +133 -0
  34. package/dist/cjs/resources/checkout/index.js +57 -0
  35. package/dist/cjs/resources/checkout/merchants.js +290 -0
  36. package/dist/cjs/resources/checkout/paymentLinks.js +330 -0
  37. package/dist/cjs/resources/checkout/paymentMethodConfigurations.js +262 -0
  38. package/dist/cjs/resources/checkout/shared.js +368 -0
  39. package/dist/cjs/resources/connect/account.js +332 -0
  40. package/dist/cjs/resources/connect/applicationFees.js +113 -0
  41. package/dist/cjs/resources/connect/balance.js +212 -0
  42. package/dist/cjs/resources/connect/connectedAccounts.js +260 -0
  43. package/dist/cjs/resources/connect/index.js +51 -0
  44. package/dist/cjs/resources/connect/onboarding.js +82 -0
  45. package/dist/cjs/resources/connect/payouts.js +196 -0
  46. package/dist/cjs/resources/connect/reporting.js +235 -0
  47. package/dist/cjs/resources/connect/requestLogs.js +110 -0
  48. package/dist/cjs/resources/connect/transfers.js +227 -0
  49. package/dist/cjs/resources/core/customers.js +194 -0
  50. package/dist/cjs/resources/core/index.js +23 -0
  51. package/dist/cjs/resources/core/paymentMethods.js +134 -0
  52. package/dist/cjs/resources/events/events.js +357 -0
  53. package/dist/cjs/resources/events/index.js +29 -0
  54. package/dist/cjs/resources/events/webhookDeliveries.js +93 -0
  55. package/dist/cjs/resources/events/webhookEndpoints.js +215 -0
  56. package/dist/cjs/resources/payments/charges.js +157 -0
  57. package/dist/cjs/resources/payments/disputes.js +204 -0
  58. package/dist/cjs/resources/payments/index.js +41 -0
  59. package/dist/cjs/resources/payments/paymentIntents.js +529 -0
  60. package/dist/cjs/resources/payments/refunds.js +245 -0
  61. package/dist/cjs/resources/payments/setupIntents.js +158 -0
  62. package/dist/cjs/resources/payments/social.js +182 -0
  63. package/dist/cjs/resources/payments/testHelpers.js +39 -0
  64. package/dist/cjs/resources/tax/assessments.js +217 -0
  65. package/dist/cjs/resources/tax/businessProfile.js +99 -0
  66. package/dist/cjs/resources/tax/calculations.js +176 -0
  67. package/dist/cjs/resources/tax/capabilities.js +42 -0
  68. package/dist/cjs/resources/tax/codes.js +37 -0
  69. package/dist/cjs/resources/tax/complianceActions.js +56 -0
  70. package/dist/cjs/resources/tax/deadlines.js +59 -0
  71. package/dist/cjs/resources/tax/documents.js +128 -0
  72. package/dist/cjs/resources/tax/index.js +80 -0
  73. package/dist/cjs/resources/tax/locationEvidence.js +131 -0
  74. package/dist/cjs/resources/tax/operatingLocations.js +98 -0
  75. package/dist/cjs/resources/tax/products.js +67 -0
  76. package/dist/cjs/resources/tax/registrationDeclarations.js +124 -0
  77. package/dist/cjs/resources/tax/registrations.js +82 -0
  78. package/dist/cjs/resources/tax/reports.js +92 -0
  79. package/dist/cjs/resources/tax/reviewItems.js +116 -0
  80. package/dist/cjs/resources/tax/ruleSet.js +68 -0
  81. package/dist/cjs/resources/tax/salesDestinations.js +94 -0
  82. package/dist/cjs/resources/tax/settings.js +104 -0
  83. package/dist/cjs/resources/tax/shared.js +62 -0
  84. package/dist/cjs/resources/tax/transactions.js +102 -0
  85. package/dist/cjs/route.js +22 -0
  86. package/dist/cjs/routes.js +31 -0
  87. package/dist/cjs/vocabulary/billingPortal.js +15 -0
  88. package/dist/cjs/vocabulary/catalog.js +110 -0
  89. package/dist/cjs/vocabulary/checkout.js +53 -0
  90. package/dist/cjs/vocabulary/connect.js +95 -0
  91. package/dist/cjs/vocabulary/errors.js +174 -0
  92. package/dist/cjs/vocabulary/events.js +176 -0
  93. package/dist/cjs/vocabulary/files.js +44 -0
  94. package/dist/cjs/vocabulary/index.js +37 -0
  95. package/dist/cjs/vocabulary/invoices.js +52 -0
  96. package/dist/cjs/vocabulary/lists.js +22 -0
  97. package/dist/cjs/vocabulary/merchants.js +23 -0
  98. package/dist/cjs/vocabulary/money.js +104 -0
  99. package/dist/cjs/vocabulary/paymentMethodConfigurations.js +36 -0
  100. package/dist/cjs/vocabulary/payments.js +195 -0
  101. package/dist/cjs/vocabulary/reporting.js +27 -0
  102. package/dist/cjs/vocabulary/subscriptions.js +60 -0
  103. package/dist/cjs/vocabulary/tax.js +237 -0
  104. package/dist/cjs/vocabulary/version.js +12 -0
  105. package/dist/esm/common/address.js +76 -0
  106. package/dist/esm/common/envelopes.js +95 -0
  107. package/dist/esm/common/objects.js +74 -0
  108. package/dist/esm/common/params.js +203 -0
  109. package/dist/esm/common/primitives.js +35 -0
  110. package/dist/esm/contributions.js +5 -0
  111. package/dist/esm/index.js +26 -134
  112. package/dist/esm/openapi/document.js +294 -0
  113. package/dist/esm/openapi/index.js +2 -0
  114. package/dist/esm/openapi/webhooks.js +14 -0
  115. package/dist/esm/resources/billingEngine/billingPortal.js +234 -0
  116. package/dist/esm/resources/billingEngine/creditNotes.js +186 -0
  117. package/dist/esm/resources/billingEngine/customerBalanceTransactions.js +87 -0
  118. package/dist/esm/resources/billingEngine/index.js +26 -0
  119. package/dist/esm/resources/billingEngine/invoiceItems.js +152 -0
  120. package/dist/esm/resources/billingEngine/invoices.js +506 -0
  121. package/dist/esm/resources/billingEngine/params.js +39 -0
  122. package/dist/esm/resources/billingEngine/public.js +323 -0
  123. package/dist/esm/resources/billingEngine/subscriptions.js +473 -0
  124. package/dist/esm/resources/catalog/billing.js +752 -0
  125. package/dist/esm/resources/catalog/billingSettings.js +128 -0
  126. package/dist/esm/resources/catalog/coupons.js +219 -0
  127. package/dist/esm/resources/catalog/entitlements.js +254 -0
  128. package/dist/esm/resources/catalog/index.js +38 -0
  129. package/dist/esm/resources/catalog/meters.js +276 -0
  130. package/dist/esm/resources/catalog/prices.js +419 -0
  131. package/dist/esm/resources/catalog/products.js +225 -0
  132. package/dist/esm/resources/catalog/promotionCodes.js +171 -0
  133. package/dist/esm/resources/catalog/shared.js +67 -0
  134. package/dist/esm/resources/catalog/testClocks.js +124 -0
  135. package/dist/esm/resources/checkout/checkoutSessions.js +579 -0
  136. package/dist/esm/resources/checkout/contributions.js +167 -0
  137. package/dist/esm/resources/checkout/files.js +130 -0
  138. package/dist/esm/resources/checkout/index.js +25 -0
  139. package/dist/esm/resources/checkout/merchants.js +287 -0
  140. package/dist/esm/resources/checkout/paymentLinks.js +327 -0
  141. package/dist/esm/resources/checkout/paymentMethodConfigurations.js +259 -0
  142. package/dist/esm/resources/checkout/shared.js +363 -0
  143. package/dist/esm/resources/connect/account.js +329 -0
  144. package/dist/esm/resources/connect/applicationFees.js +110 -0
  145. package/dist/esm/resources/connect/balance.js +209 -0
  146. package/dist/esm/resources/connect/connectedAccounts.js +257 -0
  147. package/dist/esm/resources/connect/index.js +34 -0
  148. package/dist/esm/resources/connect/onboarding.js +79 -0
  149. package/dist/esm/resources/connect/payouts.js +193 -0
  150. package/dist/esm/resources/connect/reporting.js +232 -0
  151. package/dist/esm/resources/connect/requestLogs.js +107 -0
  152. package/dist/esm/resources/connect/transfers.js +224 -0
  153. package/dist/esm/resources/core/customers.js +191 -0
  154. package/dist/esm/resources/core/index.js +6 -0
  155. package/dist/esm/resources/core/paymentMethods.js +131 -0
  156. package/dist/esm/resources/events/events.js +353 -0
  157. package/dist/esm/resources/events/index.js +12 -0
  158. package/dist/esm/resources/events/webhookDeliveries.js +90 -0
  159. package/dist/esm/resources/events/webhookEndpoints.js +212 -0
  160. package/dist/esm/resources/payments/charges.js +154 -0
  161. package/dist/esm/resources/payments/disputes.js +201 -0
  162. package/dist/esm/resources/payments/index.js +24 -0
  163. package/dist/esm/resources/payments/paymentIntents.js +526 -0
  164. package/dist/esm/resources/payments/refunds.js +242 -0
  165. package/dist/esm/resources/payments/setupIntents.js +155 -0
  166. package/dist/esm/resources/payments/social.js +179 -0
  167. package/dist/esm/resources/payments/testHelpers.js +36 -0
  168. package/dist/esm/resources/tax/assessments.js +214 -0
  169. package/dist/esm/resources/tax/businessProfile.js +96 -0
  170. package/dist/esm/resources/tax/calculations.js +173 -0
  171. package/dist/esm/resources/tax/capabilities.js +39 -0
  172. package/dist/esm/resources/tax/codes.js +34 -0
  173. package/dist/esm/resources/tax/complianceActions.js +53 -0
  174. package/dist/esm/resources/tax/deadlines.js +56 -0
  175. package/dist/esm/resources/tax/documents.js +125 -0
  176. package/dist/esm/resources/tax/index.js +63 -0
  177. package/dist/esm/resources/tax/locationEvidence.js +128 -0
  178. package/dist/esm/resources/tax/operatingLocations.js +95 -0
  179. package/dist/esm/resources/tax/products.js +64 -0
  180. package/dist/esm/resources/tax/registrationDeclarations.js +121 -0
  181. package/dist/esm/resources/tax/registrations.js +79 -0
  182. package/dist/esm/resources/tax/reports.js +89 -0
  183. package/dist/esm/resources/tax/reviewItems.js +113 -0
  184. package/dist/esm/resources/tax/ruleSet.js +65 -0
  185. package/dist/esm/resources/tax/salesDestinations.js +91 -0
  186. package/dist/esm/resources/tax/settings.js +101 -0
  187. package/dist/esm/resources/tax/shared.js +58 -0
  188. package/dist/esm/resources/tax/transactions.js +99 -0
  189. package/dist/esm/route.js +16 -0
  190. package/dist/esm/routes.js +27 -0
  191. package/dist/esm/vocabulary/billingPortal.js +12 -0
  192. package/dist/esm/vocabulary/catalog.js +106 -0
  193. package/dist/esm/vocabulary/checkout.js +50 -0
  194. package/dist/esm/vocabulary/connect.js +92 -0
  195. package/dist/esm/vocabulary/errors.js +169 -0
  196. package/dist/esm/vocabulary/events.js +173 -0
  197. package/dist/esm/vocabulary/files.js +41 -0
  198. package/dist/esm/vocabulary/index.js +21 -0
  199. package/dist/esm/vocabulary/invoices.js +49 -0
  200. package/dist/esm/vocabulary/lists.js +19 -0
  201. package/dist/esm/vocabulary/merchants.js +20 -0
  202. package/dist/esm/vocabulary/money.js +98 -0
  203. package/dist/esm/vocabulary/paymentMethodConfigurations.js +33 -0
  204. package/dist/esm/vocabulary/payments.js +192 -0
  205. package/dist/esm/vocabulary/reporting.js +24 -0
  206. package/dist/esm/vocabulary/subscriptions.js +57 -0
  207. package/dist/esm/vocabulary/tax.js +233 -0
  208. package/dist/esm/vocabulary/version.js +9 -0
  209. package/dist/types/common/address.d.ts +62 -0
  210. package/dist/types/common/envelopes.d.ts +88 -0
  211. package/dist/types/common/objects.d.ts +107 -0
  212. package/dist/types/common/params.d.ts +156 -0
  213. package/dist/types/common/primitives.d.ts +56 -0
  214. package/dist/types/contributions.d.ts +1 -0
  215. package/dist/types/index.d.ts +16 -171
  216. package/dist/types/openapi/document.d.ts +16 -0
  217. package/dist/types/openapi/index.d.ts +2 -0
  218. package/dist/types/openapi/webhooks.d.ts +15 -0
  219. package/dist/types/resources/billingEngine/billingPortal.d.ts +742 -0
  220. package/dist/types/resources/billingEngine/creditNotes.d.ts +655 -0
  221. package/dist/types/resources/billingEngine/customerBalanceTransactions.d.ts +282 -0
  222. package/dist/types/resources/billingEngine/index.d.ts +6071 -0
  223. package/dist/types/resources/billingEngine/invoiceItems.d.ts +502 -0
  224. package/dist/types/resources/billingEngine/invoices.d.ts +2547 -0
  225. package/dist/types/resources/billingEngine/params.d.ts +51 -0
  226. package/dist/types/resources/billingEngine/public.d.ts +1860 -0
  227. package/dist/types/resources/billingEngine/subscriptions.d.ts +1519 -0
  228. package/dist/types/resources/catalog/billing.d.ts +1723 -0
  229. package/dist/types/resources/catalog/billingSettings.d.ts +160 -0
  230. package/dist/types/resources/catalog/coupons.d.ts +403 -0
  231. package/dist/types/resources/catalog/entitlements.d.ts +422 -0
  232. package/dist/types/resources/catalog/index.d.ts +3155 -0
  233. package/dist/types/resources/catalog/meters.d.ts +474 -0
  234. package/dist/types/resources/catalog/prices.d.ts +1091 -0
  235. package/dist/types/resources/catalog/products.d.ts +430 -0
  236. package/dist/types/resources/catalog/promotionCodes.d.ts +369 -0
  237. package/dist/types/resources/catalog/shared.d.ts +34 -0
  238. package/dist/types/resources/catalog/testClocks.d.ts +220 -0
  239. package/dist/types/resources/checkout/checkoutSessions.d.ts +3207 -0
  240. package/dist/types/resources/checkout/contributions.d.ts +375 -0
  241. package/dist/types/resources/checkout/files.d.ts +280 -0
  242. package/dist/types/resources/checkout/index.d.ts +5678 -0
  243. package/dist/types/resources/checkout/merchants.d.ts +395 -0
  244. package/dist/types/resources/checkout/paymentLinks.d.ts +1728 -0
  245. package/dist/types/resources/checkout/paymentMethodConfigurations.d.ts +2104 -0
  246. package/dist/types/resources/checkout/shared.d.ts +419 -0
  247. package/dist/types/resources/connect/account.d.ts +483 -0
  248. package/dist/types/resources/connect/applicationFees.d.ts +198 -0
  249. package/dist/types/resources/connect/balance.d.ts +399 -0
  250. package/dist/types/resources/connect/connectedAccounts.d.ts +494 -0
  251. package/dist/types/resources/connect/index.d.ts +2094 -0
  252. package/dist/types/resources/connect/onboarding.d.ts +95 -0
  253. package/dist/types/resources/connect/payouts.d.ts +527 -0
  254. package/dist/types/resources/connect/reporting.d.ts +506 -0
  255. package/dist/types/resources/connect/requestLogs.d.ts +236 -0
  256. package/dist/types/resources/connect/transfers.d.ts +436 -0
  257. package/dist/types/resources/core/customers.d.ts +619 -0
  258. package/dist/types/resources/core/index.d.ts +679 -0
  259. package/dist/types/resources/core/paymentMethods.d.ts +336 -0
  260. package/dist/types/resources/events/events.d.ts +731 -0
  261. package/dist/types/resources/events/index.d.ts +1727 -0
  262. package/dist/types/resources/events/webhookDeliveries.d.ts +436 -0
  263. package/dist/types/resources/events/webhookEndpoints.d.ts +1502 -0
  264. package/dist/types/resources/payments/charges.d.ts +390 -0
  265. package/dist/types/resources/payments/disputes.d.ts +822 -0
  266. package/dist/types/resources/payments/index.d.ts +3517 -0
  267. package/dist/types/resources/payments/paymentIntents.d.ts +2080 -0
  268. package/dist/types/resources/payments/refunds.d.ts +684 -0
  269. package/dist/types/resources/payments/setupIntents.d.ts +391 -0
  270. package/dist/types/resources/payments/social.d.ts +266 -0
  271. package/dist/types/resources/payments/testHelpers.d.ts +178 -0
  272. package/dist/types/resources/tax/assessments.d.ts +787 -0
  273. package/dist/types/resources/tax/businessProfile.d.ts +134 -0
  274. package/dist/types/resources/tax/calculations.d.ts +261 -0
  275. package/dist/types/resources/tax/capabilities.d.ts +81 -0
  276. package/dist/types/resources/tax/codes.d.ts +29 -0
  277. package/dist/types/resources/tax/complianceActions.d.ts +97 -0
  278. package/dist/types/resources/tax/deadlines.d.ts +133 -0
  279. package/dist/types/resources/tax/documents.d.ts +257 -0
  280. package/dist/types/resources/tax/index.d.ts +1946 -0
  281. package/dist/types/resources/tax/locationEvidence.d.ts +246 -0
  282. package/dist/types/resources/tax/operatingLocations.d.ts +170 -0
  283. package/dist/types/resources/tax/products.d.ts +68 -0
  284. package/dist/types/resources/tax/registrationDeclarations.d.ts +270 -0
  285. package/dist/types/resources/tax/registrations.d.ts +103 -0
  286. package/dist/types/resources/tax/reports.d.ts +129 -0
  287. package/dist/types/resources/tax/reviewItems.d.ts +226 -0
  288. package/dist/types/resources/tax/ruleSet.d.ts +219 -0
  289. package/dist/types/resources/tax/salesDestinations.d.ts +158 -0
  290. package/dist/types/resources/tax/settings.d.ts +122 -0
  291. package/dist/types/resources/tax/shared.d.ts +43 -0
  292. package/dist/types/resources/tax/transactions.d.ts +404 -0
  293. package/dist/types/route.d.ts +86 -0
  294. package/dist/types/routes.d.ts +23 -0
  295. package/dist/types/vocabulary/billingPortal.d.ts +15 -0
  296. package/dist/types/vocabulary/catalog.d.ts +97 -0
  297. package/dist/types/vocabulary/checkout.d.ts +49 -0
  298. package/dist/types/vocabulary/connect.d.ts +62 -0
  299. package/dist/types/vocabulary/errors.d.ts +145 -0
  300. package/dist/types/vocabulary/events.d.ts +171 -0
  301. package/dist/types/vocabulary/files.d.ts +30 -0
  302. package/dist/types/vocabulary/index.d.ts +17 -0
  303. package/dist/types/vocabulary/invoices.d.ts +39 -0
  304. package/dist/types/vocabulary/lists.d.ts +9 -0
  305. package/dist/types/vocabulary/merchants.d.ts +9 -0
  306. package/dist/types/vocabulary/money.d.ts +59 -0
  307. package/dist/types/vocabulary/paymentMethodConfigurations.d.ts +22 -0
  308. package/dist/types/vocabulary/payments.d.ts +117 -0
  309. package/dist/types/vocabulary/reporting.d.ts +18 -0
  310. package/dist/types/vocabulary/subscriptions.d.ts +45 -0
  311. package/dist/types/vocabulary/tax.d.ts +163 -0
  312. package/dist/types/vocabulary/version.d.ts +10 -0
  313. package/package.json +51 -11
  314. package/dist/cjs/openapi.js +0 -165
  315. package/dist/esm/openapi.js +0 -161
  316. package/dist/types/openapi.d.ts +0 -148
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.refundRoutes = exports.paymentIntentRefundListSchema = exports.listPaymentIntentRefundsQuery = exports.listRefundsQuery = exports.cancelRefundParams = exports.updateRefundParams = exports.createRefundParams = exports.settlementSchema = exports.refundSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const envelopes_1 = require("../../common/envelopes");
6
+ const objects_1 = require("../../common/objects");
7
+ const params_1 = require("../../common/params");
8
+ const primitives_1 = require("../../common/primitives");
9
+ const route_1 = require("../../route");
10
+ const money_1 = require("../../vocabulary/money");
11
+ const payments_1 = require("../../vocabulary/payments");
12
+ /**
13
+ * Refunds (`re_…`) and a payment's settlement figures. The provider's own
14
+ * refund id never appears: a merchant integrates against Peable and never
15
+ * learns which acquirer sat behind it (ADR 0001 D3).
16
+ */
17
+ exports.refundSchema = (0, objects_1.defineObject)('refund', 'Refund', zod_1.z
18
+ .object({
19
+ id: zod_1.z.string(),
20
+ object: zod_1.z.literal('refund'),
21
+ livemode: primitives_1.livemode,
22
+ external_ref: primitives_1.nullableString.describe("YOUR id for this refund (its idempotency); `null` on a refund imported from the provider (`origin: 'provider'`)."),
23
+ origin: zod_1.z
24
+ .enum(payments_1.REFUND_ORIGINS)
25
+ .describe('`provider`: it appeared at the acquirer (a dashboard refund, a dispute resolved) and was imported.'),
26
+ payment_intent: (0, objects_1.expandable)('payment_intent', 'The refunded payment (`pi_…`), or the PaymentIntent with `expand[]=payment_intent`.'),
27
+ amount: primitives_1.amount,
28
+ currency: primitives_1.currency,
29
+ status: zod_1.z
30
+ .enum(payments_1.REFUND_STATUSES)
31
+ .describe("The MONEY's own lifecycle: a bank can reject a refund days later (`failed`); `canceled` only through `POST /v1/refunds/{id}/cancel`."),
32
+ reason: zod_1.z.enum(payments_1.REFUND_REASONS).nullable(),
33
+ failure_code: primitives_1.nullableString.describe("The provider's machine-readable reason, when it failed."),
34
+ metadata: primitives_1.metadata,
35
+ created: primitives_1.unixSeconds,
36
+ updated_at: primitives_1.unixSeconds,
37
+ })
38
+ .strict(), {
39
+ examples: [
40
+ {
41
+ id: 're_0193b8f2c1a87d3e9f4a',
42
+ object: 'refund',
43
+ livemode: false,
44
+ external_ref: 'order_6735_refund_1',
45
+ origin: 'merchant',
46
+ payment_intent: 'pi_0193b8f2c1a87d3e9f4a',
47
+ amount: '1000',
48
+ currency: 'EUR',
49
+ status: 'succeeded',
50
+ reason: 'requested_by_customer',
51
+ failure_code: null,
52
+ metadata: {},
53
+ created: 1793750400,
54
+ updated_at: 1793750460,
55
+ },
56
+ ],
57
+ });
58
+ /**
59
+ * What a payment actually came to, as the PROVIDER reports it. Every figure is
60
+ * nullable and that is the contract: "the fee was zero" and "the fee is not
61
+ * known yet" are different facts, and `status` says which produced the nulls.
62
+ * It reports what the provider took; it attributes that cost to nobody.
63
+ */
64
+ exports.settlementSchema = (0, objects_1.defineObject)('settlement', 'Settlement', zod_1.z
65
+ .object({
66
+ object: zod_1.z.literal('settlement'),
67
+ livemode: primitives_1.livemode,
68
+ payment_intent: (0, objects_1.expandable)('payment_intent', 'The `pi_…` this describes, or the PaymentIntent with `expand[]=payment_intent`.'),
69
+ status: zod_1.z
70
+ .enum(payments_1.SETTLEMENT_STATUSES)
71
+ .describe('`available`: settled, the figures are final; `pending`: not final yet; `unknown`: there is none to read — **not zero**.'),
72
+ gross: primitives_1.amount.nullable().describe('Base units of `currency`.'),
73
+ fee: primitives_1.amount.nullable(),
74
+ net: primitives_1.signedAmount.nullable(),
75
+ currency: primitives_1.nullableString.describe("The SETTLEMENT currency (uppercase ISO 4217), which may differ from the payment's."),
76
+ available_on: primitives_1.unixSeconds.nullable().describe('When the funds become available.'),
77
+ exchange_rate: zod_1.z
78
+ .number()
79
+ .nullable()
80
+ .describe('Present only when a conversion happened. `null` is not a rate of 1.'),
81
+ })
82
+ .strict());
83
+ exports.createRefundParams = zod_1.z
84
+ .object({
85
+ payment_intent: zod_1.z.string().min(1).describe('The `pi_…` being refunded.'),
86
+ external_ref: zod_1.z
87
+ .string()
88
+ .min(1)
89
+ .max(255)
90
+ .describe('YOUR id for this refund. The idempotency: the same ref answers the same refund.'),
91
+ // A zero refund is refused separately: `'0'` is a canonical integer string,
92
+ // and a zero refund would consume the merchant's `external_ref` so the REAL
93
+ // refund for that order could never be created afterwards.
94
+ amount: zod_1.z
95
+ .string()
96
+ .refine(money_1.isBaseUnitString, 'amount must be a canonical integer string in minor units')
97
+ .refine((value) => value !== '0', 'a refund of 0 is not a refund')
98
+ .describe('Base units, as a canonical integer string. Zero is refused.'),
99
+ reason: zod_1.z.enum(payments_1.REFUND_REASONS).optional(),
100
+ metadata: params_1.metadataCreateParam.optional(),
101
+ refund_application_fee: zod_1.z
102
+ .boolean()
103
+ .optional()
104
+ .describe("Also refund Orbit's application fee, in proportion (a destination charge)."),
105
+ reverse_transfer: zod_1.z
106
+ .boolean()
107
+ .optional()
108
+ .describe('Also reverse the transfer to the destination account, in proportion.'),
109
+ })
110
+ .strict();
111
+ /** The merchant's own bookkeeping on a refund: `metadata`, a patch. */
112
+ exports.updateRefundParams = zod_1.z.object({ metadata: params_1.metadataUpdateParam.optional() }).strict();
113
+ exports.cancelRefundParams = zod_1.z.object({}).strict();
114
+ exports.listRefundsQuery = (0, params_1.listQuery)({
115
+ payment_intent: params_1.idParam.optional().describe("Only this payment's refunds (`pi_…`)."),
116
+ });
117
+ /** The per-payment sub-list: the payment is in the path. */
118
+ exports.listPaymentIntentRefundsQuery = (0, params_1.listQuery)({});
119
+ /**
120
+ * A payment's refunds, with what is still refundable beside the envelope — the
121
+ * figure every merchant would otherwise compute by summing the list, and get
122
+ * wrong by counting a `pending` or `failed` refund.
123
+ */
124
+ exports.paymentIntentRefundListSchema = (0, envelopes_1.listOf)(exports.refundSchema).extend({
125
+ remaining_refundable: primitives_1.amount.describe('What can still be refunded on this payment, in base units. The same on every page.'),
126
+ });
127
+ const refundId = { id: 'The refund (`re_…`).' };
128
+ const intentId = { intentId: 'The payment intent (`pi_…`).' };
129
+ exports.refundRoutes = [
130
+ (0, route_1.defineRoute)({
131
+ operationId: 'createRefund',
132
+ method: 'post',
133
+ path: '/v1/refunds',
134
+ tag: 'Refunds',
135
+ summary: 'Create a refund',
136
+ description: '`external_ref` decides whether money moves twice: a retry with the same ref answers the refund it made (200) whatever is still refundable.',
137
+ auth: 'service',
138
+ scope: 'payments:write',
139
+ idempotent: true,
140
+ body: exports.createRefundParams,
141
+ response: exports.refundSchema,
142
+ status: 201,
143
+ sdk: 'refunds.create',
144
+ }),
145
+ (0, route_1.defineRoute)({
146
+ operationId: 'listRefunds',
147
+ method: 'get',
148
+ path: '/v1/refunds',
149
+ tag: 'Refunds',
150
+ summary: 'List refunds',
151
+ description: "Every refund of the merchant, or of one payment — including those made outside Peable (`origin: 'provider'`).",
152
+ auth: 'service',
153
+ scope: 'payments:read',
154
+ query: exports.listRefundsQuery,
155
+ response: (0, envelopes_1.listOf)(exports.refundSchema),
156
+ sdk: 'refunds.list',
157
+ expandable: 'refund',
158
+ }),
159
+ (0, route_1.defineRoute)({
160
+ operationId: 'retrieveRefund',
161
+ method: 'get',
162
+ path: '/v1/refunds/{id}',
163
+ tag: 'Refunds',
164
+ summary: 'Retrieve a refund',
165
+ auth: 'service',
166
+ scope: 'payments:read',
167
+ params: refundId,
168
+ query: params_1.expandOnlyQuery,
169
+ response: exports.refundSchema,
170
+ sdk: 'refunds.retrieve',
171
+ expandable: 'refund',
172
+ }),
173
+ (0, route_1.defineRoute)({
174
+ operationId: 'updateRefund',
175
+ method: 'post',
176
+ path: '/v1/refunds/{id}',
177
+ tag: 'Refunds',
178
+ summary: 'Update a refund',
179
+ auth: 'service',
180
+ scope: 'payments:write',
181
+ idempotent: true,
182
+ params: refundId,
183
+ body: exports.updateRefundParams,
184
+ response: exports.refundSchema,
185
+ sdk: 'refunds.update',
186
+ }),
187
+ (0, route_1.defineRoute)({
188
+ operationId: 'cancelRefund',
189
+ method: 'post',
190
+ path: '/v1/refunds/{id}/cancel',
191
+ tag: 'Refunds',
192
+ summary: 'Cancel a refund',
193
+ description: 'Only while the provider still holds it; otherwise 400 `refund_not_cancelable`.',
194
+ auth: 'service',
195
+ scope: 'payments:write',
196
+ idempotent: true,
197
+ params: refundId,
198
+ body: exports.cancelRefundParams,
199
+ response: exports.refundSchema,
200
+ sdk: 'refunds.cancel',
201
+ }),
202
+ (0, route_1.defineRoute)({
203
+ operationId: 'listPaymentIntentRefunds',
204
+ method: 'get',
205
+ path: '/v1/payment_intents/{intentId}/refunds',
206
+ tag: 'Refunds',
207
+ summary: "List a payment's refunds",
208
+ auth: 'service',
209
+ scope: 'payments:read',
210
+ params: intentId,
211
+ query: exports.listPaymentIntentRefundsQuery,
212
+ response: exports.paymentIntentRefundListSchema,
213
+ sdk: 'refunds.listForPaymentIntent',
214
+ expandable: 'refund',
215
+ }),
216
+ (0, route_1.defineRoute)({
217
+ operationId: 'retrievePaymentIntentSettlement',
218
+ method: 'get',
219
+ path: '/v1/payment_intents/{intentId}/settlement',
220
+ tag: 'Refunds',
221
+ summary: "Retrieve a payment's settlement",
222
+ description: 'Gross, fee and net, read live from the provider. A missing figure is `null` with a `status`, never `0`.',
223
+ auth: 'service',
224
+ scope: 'payments:read',
225
+ params: intentId,
226
+ query: params_1.expandOnlyQuery,
227
+ response: exports.settlementSchema,
228
+ sdk: 'refunds.settlement',
229
+ expandable: 'settlement',
230
+ }),
231
+ (0, route_1.defineRoute)({
232
+ operationId: 'searchRefunds',
233
+ method: 'get',
234
+ path: '/v1/refunds/search',
235
+ tag: 'Refunds',
236
+ summary: 'Search refunds',
237
+ description: "Stripe's query language over `amount`, `currency`, `status`, `reason`, `payment_intent`, `created` and `metadata['key']`.",
238
+ auth: 'service',
239
+ scope: 'payments:read',
240
+ query: params_1.searchQuery,
241
+ response: (0, envelopes_1.searchResultOf)(exports.refundSchema),
242
+ sdk: 'refunds.search',
243
+ expandable: 'refund',
244
+ }),
245
+ ];
@@ -0,0 +1,158 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupIntentRoutes = exports.retrieveSetupIntentQuery = exports.listSetupIntentsQuery = exports.cancelSetupIntentParams = exports.createSetupIntentParams = exports.setupIntentSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const envelopes_1 = require("../../common/envelopes");
6
+ const objects_1 = require("../../common/objects");
7
+ const params_1 = require("../../common/params");
8
+ const primitives_1 = require("../../common/primitives");
9
+ const route_1 = require("../../route");
10
+ const payments_1 = require("../../vocabulary/payments");
11
+ const paymentIntents_1 = require("./paymentIntents");
12
+ /**
13
+ * SetupIntents (`seti_…`) — saving a card for later without charging it
14
+ * (ADR 0016, ADR 0019). The provider SetupIntent is an internal binding; its
15
+ * success is what creates the Peable `pm_…`, attached to the customer.
16
+ */
17
+ exports.setupIntentSchema = (0, objects_1.defineObject)('setup_intent', 'SetupIntent', zod_1.z
18
+ .object({
19
+ id: zod_1.z.string(),
20
+ object: zod_1.z.literal('setup_intent'),
21
+ livemode: primitives_1.livemode,
22
+ status: zod_1.z.enum(payments_1.SETUP_INTENT_STATUSES),
23
+ usage: zod_1.z.enum(payments_1.SETUP_INTENT_USAGES),
24
+ payment_method_types: zod_1.z.tuple([zod_1.z.literal('card')]),
25
+ customer: (0, objects_1.expandable)('customer', '`cus_…`, or the Customer with `expand[]=customer`.').nullable(),
26
+ payment_method: (0, objects_1.expandable)('payment_method', 'The `pm_…` it saved, once `succeeded`, or the PaymentMethod with `expand[]=payment_method`.').nullable(),
27
+ client_secret: zod_1.z
28
+ .string()
29
+ .describe("Possession of it lets the payer's browser confirm this SetupIntent."),
30
+ next_action: zod_1.z
31
+ .object({ type: zod_1.z.literal('use_peable_sdk') })
32
+ .strict()
33
+ .nullable(),
34
+ last_setup_error: paymentIntents_1.paymentErrorSchema.nullable(),
35
+ cancellation_reason: zod_1.z.enum(payments_1.SETUP_INTENT_CANCELLATION_REASONS).nullable(),
36
+ description: primitives_1.nullableString,
37
+ metadata: primitives_1.metadata,
38
+ created: primitives_1.unixSeconds,
39
+ })
40
+ .strict(), {
41
+ examples: [
42
+ {
43
+ id: 'seti_0193b8f2c1a87d3e9f4a',
44
+ object: 'setup_intent',
45
+ livemode: false,
46
+ status: 'requires_payment_method',
47
+ usage: 'off_session',
48
+ payment_method_types: ['card'],
49
+ customer: 'cus_0193b8f2c1a87d3e9f4a',
50
+ payment_method: null,
51
+ client_secret: 'seti_0193b8f2c1a87d3e9f4a_secret_9a1b2c',
52
+ next_action: null,
53
+ last_setup_error: null,
54
+ cancellation_reason: null,
55
+ description: null,
56
+ metadata: {},
57
+ created: 1793750400,
58
+ },
59
+ ],
60
+ });
61
+ exports.createSetupIntentParams = zod_1.z
62
+ .object({
63
+ customer: params_1.idParam
64
+ .optional()
65
+ .describe('The customer (`cus_…`) the card is saved to. Required: a `pm_…` is born attached.'),
66
+ usage: zod_1.z.enum(payments_1.SETUP_INTENT_USAGES).optional().describe('Defaults to `off_session`.'),
67
+ payment_method_types: zod_1.z.tuple([zod_1.z.literal('card')]).optional(),
68
+ description: zod_1.z.string().max(1000).optional(),
69
+ metadata: params_1.metadataCreateParam.optional(),
70
+ expand: params_1.expandParam.optional(),
71
+ })
72
+ .strict();
73
+ exports.cancelSetupIntentParams = zod_1.z
74
+ .object({
75
+ cancellation_reason: zod_1.z.enum(payments_1.SETUP_INTENT_CANCELLATION_REASONS).optional(),
76
+ expand: params_1.expandParam.optional(),
77
+ })
78
+ .strict();
79
+ exports.listSetupIntentsQuery = (0, params_1.listQuery)({
80
+ customer: params_1.idParam.optional().describe("Only this customer's setup intents (`cus_…`)."),
81
+ });
82
+ /** A merchant retrieve takes `expand[]`; the payer's takes `client_secret` and nothing to expand. */
83
+ exports.retrieveSetupIntentQuery = (0, params_1.retrieveQuery)({ client_secret: paymentIntents_1.clientSecretParam });
84
+ const setupIntentId = { id: 'The setup intent (`seti_…`).' };
85
+ exports.setupIntentRoutes = [
86
+ (0, route_1.defineRoute)({
87
+ operationId: 'createSetupIntent',
88
+ method: 'post',
89
+ path: '/v1/setup_intents',
90
+ tag: 'Setup intents',
91
+ summary: 'Create a setup intent',
92
+ auth: 'service',
93
+ scope: 'payments:write',
94
+ idempotent: true,
95
+ body: exports.createSetupIntentParams,
96
+ response: exports.setupIntentSchema,
97
+ status: 201,
98
+ sdk: 'setupIntents.create',
99
+ expandable: 'setup_intent',
100
+ }),
101
+ (0, route_1.defineRoute)({
102
+ operationId: 'listSetupIntents',
103
+ method: 'get',
104
+ path: '/v1/setup_intents',
105
+ tag: 'Setup intents',
106
+ summary: 'List setup intents',
107
+ auth: 'service',
108
+ scope: 'payments:read',
109
+ query: exports.listSetupIntentsQuery,
110
+ response: (0, envelopes_1.listOf)(exports.setupIntentSchema),
111
+ sdk: 'setupIntents.list',
112
+ expandable: 'setup_intent',
113
+ }),
114
+ (0, route_1.defineRoute)({
115
+ operationId: 'retrieveSetupIntent',
116
+ method: 'get',
117
+ path: '/v1/setup_intents/{id}',
118
+ tag: 'Setup intents',
119
+ summary: 'Retrieve a setup intent',
120
+ description: 'With the merchant credential: reconciled with the provider when not terminal, expandable. Without one, the PAYER reads the row as stored with its `client_secret` (the `X-Peable-Client-Secret` header, or the query).',
121
+ auth: 'service',
122
+ scope: 'payments:read',
123
+ params: setupIntentId,
124
+ query: exports.retrieveSetupIntentQuery,
125
+ response: exports.setupIntentSchema,
126
+ sdk: 'setupIntents.retrieve',
127
+ expandable: 'setup_intent',
128
+ }),
129
+ (0, route_1.defineRoute)({
130
+ operationId: 'cancelSetupIntent',
131
+ method: 'post',
132
+ path: '/v1/setup_intents/{id}/cancel',
133
+ tag: 'Setup intents',
134
+ summary: 'Cancel a setup intent',
135
+ auth: 'service',
136
+ scope: 'payments:write',
137
+ idempotent: true,
138
+ params: setupIntentId,
139
+ body: exports.cancelSetupIntentParams,
140
+ response: exports.setupIntentSchema,
141
+ sdk: 'setupIntents.cancel',
142
+ expandable: 'setup_intent',
143
+ }),
144
+ (0, route_1.defineRoute)({
145
+ operationId: 'retrieveSetupIntentClientAction',
146
+ method: 'post',
147
+ path: '/v1/setup_intents/{id}/client_action',
148
+ tag: 'Setup intents',
149
+ summary: "Retrieve a setup intent's client action",
150
+ description: "The provider credential the payer's client confirms the SetupIntent with — read fresh, `Cache-Control: no-store`, never on the object. The merchant credential, or the payer's `client_secret` (`X-Peable-Client-Secret`). A succeeded or canceled setup intent answers 409.",
151
+ auth: 'service',
152
+ scope: 'payments:read',
153
+ params: setupIntentId,
154
+ query: paymentIntents_1.clientSecretQuery,
155
+ response: paymentIntents_1.clientActionSchema,
156
+ sdk: 'setupIntents.clientAction',
157
+ }),
158
+ ];
@@ -0,0 +1,182 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.socialRoutes = exports.enrichSchema = exports.enrichParams = exports.socialPaymentsSchema = exports.socialPaymentSchema = exports.socialPaymentsQuery = exports.socialReceiveCursorSchema = exports.socialReceiveCursorQuery = exports.socialNextAddressSchema = exports.socialNextAddressParams = exports.socialPaymentSourceParams = exports.enrichmentResultSchema = exports.socialPaymentSourceSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const objects_1 = require("../../common/objects");
6
+ const primitives_1 = require("../../common/primitives");
7
+ const route_1 = require("../../route");
8
+ const payments_1 = require("../../vocabulary/payments");
9
+ /**
10
+ * Social payments (pay a person by `@username`) and transaction enrichment —
11
+ * the wallet's routes, called with the person's own Oxy session. Display-only
12
+ * context throughout: nothing here decides where money goes; the address comes
13
+ * from the recipient's identity key and their reservation cursor.
14
+ */
15
+ /**
16
+ * Display-only context for one social payment: which app the payer was in, and
17
+ * that app's own opaque id for what it was for (a Mention post, say). Peable
18
+ * never parses, resolves or links `ref`; it stores a string and hands the same
19
+ * string back.
20
+ */
21
+ exports.socialPaymentSourceSchema = (0, objects_1.defineComponent)('SocialPaymentSource', zod_1.z
22
+ .object({
23
+ app: zod_1.z.string().describe("The calling app's slug, e.g. `mention`."),
24
+ ref: zod_1.z
25
+ .string()
26
+ .optional()
27
+ .describe("That app's own opaque id for what the payment was for; absent when it named none."),
28
+ })
29
+ .strict());
30
+ /**
31
+ * Display-only counterparty identity for one address, as `POST /v1/enrich`
32
+ * resolves it. A failed or partial resolution degrades to `{ kind: 'unknown' }`.
33
+ */
34
+ exports.enrichmentResultSchema = (0, objects_1.defineComponent)('EnrichmentResult', zod_1.z
35
+ .object({
36
+ kind: zod_1.z.enum(payments_1.ENRICHMENT_KINDS),
37
+ display_name: zod_1.z
38
+ .string()
39
+ .optional()
40
+ .describe("The merchant's name, or the user's display name (else handle)."),
41
+ avatar_file_id: zod_1.z
42
+ .string()
43
+ .optional()
44
+ .describe('A bare Oxy file id — render through the media chokepoint, never as a URL.'),
45
+ username: zod_1.z.string().optional().describe("`kind: 'user'` only."),
46
+ description: zod_1.z.string().optional().describe("`kind: 'merchant'` only."),
47
+ })
48
+ .strict());
49
+ /**
50
+ * `.strict()` is load-bearing: `{ app, postId }` — the obvious misspelling of
51
+ * `ref` — would otherwise reserve an address and record a context missing the
52
+ * only part the recipient cares about, with a 200. `ref` is validated for SHAPE
53
+ * (printable non-space ASCII) and never for meaning, so it cannot become a
54
+ * free-text memo the gateway stores on behalf of two users.
55
+ */
56
+ exports.socialPaymentSourceParams = zod_1.z
57
+ .object({
58
+ app: zod_1.z
59
+ .string()
60
+ .min(1)
61
+ .max(payments_1.SOCIAL_SOURCE_APP_MAX_LENGTH)
62
+ .regex(/^[a-z0-9][a-z0-9._-]*$/, 'source.app must be a lowercase app slug'),
63
+ ref: zod_1.z
64
+ .string()
65
+ .min(1)
66
+ .max(payments_1.SOCIAL_SOURCE_REF_MAX_LENGTH)
67
+ .regex(/^[\x21-\x7e]+$/, 'source.ref must be an opaque id, without spaces')
68
+ .optional(),
69
+ })
70
+ .strict();
71
+ /** `source` is OPTIONAL and stays that way: most person-to-person payments are for nothing in particular. */
72
+ exports.socialNextAddressParams = zod_1.z
73
+ .object({
74
+ network: primitives_1.network,
75
+ source: exports.socialPaymentSourceParams.optional(),
76
+ })
77
+ .strict();
78
+ exports.socialNextAddressSchema = (0, objects_1.defineComponent)('SocialNextAddress', zod_1.z
79
+ .object({
80
+ address: zod_1.z.string().describe("A fresh single-use address of the recipient's."),
81
+ index: zod_1.z.number().int().nonnegative().describe('Its social-receive derivation index.'),
82
+ })
83
+ .strict());
84
+ const networkQuery = zod_1.z.object({ network: primitives_1.network });
85
+ exports.socialReceiveCursorQuery = networkQuery;
86
+ /**
87
+ * Lets the caller's device resync its watch window: every `next_address`
88
+ * advances a monotonic index whether or not it is ever paid, so a burst of
89
+ * reservations can outrun a device that widens only on payment. Watch
90
+ * `0..reserved_through + gap`.
91
+ */
92
+ exports.socialReceiveCursorSchema = (0, objects_1.defineComponent)('SocialReceiveCursor', zod_1.z
93
+ .object({
94
+ reserved_through: zod_1.z
95
+ .number()
96
+ .int()
97
+ .nonnegative()
98
+ .describe('The highest social-receive index ever reserved for the caller on this network; `0` when none was.'),
99
+ identity_public_key: zod_1.z
100
+ .string()
101
+ .nullable()
102
+ .describe('The identity public key (hex) those addresses derive from; `null` exactly when no address was ever reserved.'),
103
+ })
104
+ .strict());
105
+ exports.socialPaymentsQuery = networkQuery;
106
+ /**
107
+ * One social payment as the CALLER saw it — the address-free view, and the
108
+ * only history a surface without a key can ask for. Carries NO amount: the
109
+ * attribution records which address was minted, not what was paid; the amount
110
+ * is on-chain at `address`.
111
+ */
112
+ exports.socialPaymentSchema = (0, objects_1.defineComponent)('SocialPayment', zod_1.z
113
+ .object({
114
+ address: zod_1.z
115
+ .string()
116
+ .describe('The single-use social-receive address minted for this payment.'),
117
+ direction: zod_1.z.enum(payments_1.SOCIAL_PAYMENT_DIRECTIONS),
118
+ counterparty: exports.enrichmentResultSchema.describe("The other party; `{ kind: 'unknown' }` when the identity lookup failed."),
119
+ source: exports.socialPaymentSourceSchema
120
+ .optional()
121
+ .describe('What it was for, as the paying app named it; absent when it named nothing.'),
122
+ created: primitives_1.unixSeconds.describe('When the address was minted.'),
123
+ })
124
+ .strict());
125
+ exports.socialPaymentsSchema = (0, objects_1.defineComponent)('SocialPayments', zod_1.z.object({ payments: zod_1.z.array(exports.socialPaymentSchema).describe('Newest first.') }).strict());
126
+ exports.enrichParams = zod_1.z
127
+ .object({
128
+ addresses: zod_1.z.array(zod_1.z.string().min(1)).min(1).max(payments_1.ENRICH_MAX_ADDRESSES),
129
+ })
130
+ .strict();
131
+ exports.enrichSchema = (0, objects_1.defineComponent)('Enrichment', zod_1.z
132
+ .object({
133
+ data: zod_1.z
134
+ .record(zod_1.z.string(), exports.enrichmentResultSchema)
135
+ .describe('Every address asked for → who is behind it.'),
136
+ })
137
+ .strict());
138
+ exports.socialRoutes = [
139
+ (0, route_1.defineRoute)({
140
+ operationId: 'reserveSocialAddress',
141
+ method: 'post',
142
+ path: '/v1/social/{username}/next_address',
143
+ tag: 'Social payments',
144
+ summary: 'Reserve an address to pay a person',
145
+ description: "A fresh address of the recipient's, derived from their Oxy identity key. Limited per (sender, recipient) pair; a recipient without an identity answers 409 `keyless_recipient`; paying yourself is refused.",
146
+ auth: 'user',
147
+ params: { username: 'The recipient’s Oxy username.' },
148
+ body: exports.socialNextAddressParams,
149
+ response: exports.socialNextAddressSchema,
150
+ }),
151
+ (0, route_1.defineRoute)({
152
+ operationId: 'retrieveSocialReceiveCursor',
153
+ method: 'get',
154
+ path: '/v1/social/me/cursor',
155
+ tag: 'Social payments',
156
+ summary: "Retrieve the caller's receive cursor",
157
+ auth: 'user',
158
+ query: exports.socialReceiveCursorQuery,
159
+ response: exports.socialReceiveCursorSchema,
160
+ }),
161
+ (0, route_1.defineRoute)({
162
+ operationId: 'listSocialPayments',
163
+ method: 'get',
164
+ path: '/v1/social/me/payments',
165
+ tag: 'Social payments',
166
+ summary: "List the caller's social payments",
167
+ auth: 'user',
168
+ query: exports.socialPaymentsQuery,
169
+ response: exports.socialPaymentsSchema,
170
+ }),
171
+ (0, route_1.defineRoute)({
172
+ operationId: 'enrichAddresses',
173
+ method: 'post',
174
+ path: '/v1/enrich',
175
+ tag: 'Social payments',
176
+ summary: 'Resolve who is behind addresses',
177
+ description: 'Display-only counterparty identity for the caller’s own payments; never affects custody.',
178
+ auth: 'user',
179
+ body: exports.enrichParams,
180
+ response: exports.enrichSchema,
181
+ }),
182
+ ];
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.paymentIntentTestHelperRoutes = exports.simulateFaircoinPaymentParams = void 0;
4
+ const zod_1 = require("zod");
5
+ const route_1 = require("../../route");
6
+ const payments_1 = require("../../vocabulary/payments");
7
+ const paymentIntents_1 = require("./paymentIntents");
8
+ /**
9
+ * Test helpers for payment intents — test mode only. They drive a test-mode
10
+ * payment through the SAME state machine a real one moves through, with the
11
+ * same events and webhooks, so an integration is exercised end to end without
12
+ * a wallet.
13
+ */
14
+ exports.simulateFaircoinPaymentParams = zod_1.z
15
+ .object({
16
+ outcome: zod_1.z
17
+ .enum(payments_1.SIMULATED_FAIRCOIN_OUTCOMES)
18
+ .optional()
19
+ .describe('`settled` (the default): paid in full, seen and confirmed. `underpaid`: less than the amount arrived.'),
20
+ })
21
+ .strict();
22
+ exports.paymentIntentTestHelperRoutes = [
23
+ (0, route_1.defineRoute)({
24
+ operationId: 'simulateFaircoinPayment',
25
+ method: 'post',
26
+ path: '/v1/test_helpers/payment_intents/{id}/simulate_faircoin_payment',
27
+ tag: 'Test helpers',
28
+ summary: 'Simulate a FairCoin payment',
29
+ description: 'Pretend the payer broadcast and the chain confirmed (or underpaid) a FairCoin payment in `requires_action`. A live credential is refused with 403 `test_mode_only`.',
30
+ auth: 'service',
31
+ scope: 'payments:write',
32
+ idempotent: true,
33
+ testModeOnly: true,
34
+ params: { id: 'The payment intent (`pi_…`).' },
35
+ body: exports.simulateFaircoinPaymentParams,
36
+ response: paymentIntents_1.paymentIntentSchema,
37
+ sdk: 'testHelpers.paymentIntents.simulateFaircoinPayment',
38
+ }),
39
+ ];