@peable.to/contracts 0.3.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 -97
  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 -94
  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 -134
  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 -138
  315. package/dist/esm/openapi.js +0 -134
  316. package/dist/types/openapi.d.ts +0 -145
@@ -0,0 +1,167 @@
1
+ import { z } from 'zod';
2
+ import { listOf } from '../../common/envelopes.js';
3
+ import { defineComponent } from '../../common/objects.js';
4
+ import { listQuery } from '../../common/params.js';
5
+ import { defineRoute } from '../../route.js';
6
+ import { MERCHANT_ENVIRONMENTS } from '../../vocabulary/merchants.js';
7
+ /**
8
+ * Organization contributions — an Oxy organization's FairCoin collection,
9
+ * managed by its members with their Oxy USER session (never a merchant service
10
+ * token). A contribution is a payment link whose one line is the contribution
11
+ * itself: a fixed amount, or one the payer chooses.
12
+ *
13
+ * Zod-light on purpose: `@peable.to/contracts/contributions` re-exports this
14
+ * module for the hosted checkout and Orbit, which must not construct every
15
+ * schema of the API.
16
+ */
17
+ const FAIR_UNITS_PER_COIN = 100000000n;
18
+ /** A FairCoin base-unit amount a contribution can carry: positive, within a JS-safe integer. */
19
+ export const contributionAmountSchema = z
20
+ .string()
21
+ .regex(/^[1-9][0-9]{0,15}$/)
22
+ .refine((v) => /^[1-9][0-9]{0,15}$/.test(v) && BigInt(v) <= 9007199254740991n, 'Enter a positive FairCoin base-unit amount within the supported range');
23
+ /** Every instant on the wire is integer Unix seconds (ADR 0014 D1). */
24
+ const unixSecondsSchema = z.number().int().nonnegative();
25
+ export const contributionDetailsSchema = defineComponent('ContributionDetails', z
26
+ .object({
27
+ organization_id: z.string().min(1).max(200).describe('The Oxy organization collecting.'),
28
+ purpose: z.string().trim().min(1).max(500),
29
+ amount_mode: z
30
+ .enum(['fixed', 'free'])
31
+ .describe('`fixed`: the link names the amount; `free`: the payer chooses it.'),
32
+ expires_at: unixSecondsSchema.nullable(),
33
+ })
34
+ .strict());
35
+ export const createContributionSchema = z
36
+ .object({
37
+ purpose: contributionDetailsSchema.shape.purpose,
38
+ amount_mode: contributionDetailsSchema.shape.amount_mode,
39
+ amount: contributionAmountSchema.optional(),
40
+ currency: z.literal('FAIR'),
41
+ expires_at: unixSecondsSchema.nullable().optional(),
42
+ })
43
+ .strict()
44
+ .refine((v) => (v.amount_mode === 'free' ? v.amount === undefined : v.amount !== undefined), 'Fixed contributions require an amount; free contributions omit it');
45
+ /** A contribution link, as its members manage it. */
46
+ export const contributionLinkSchema = defineComponent('ContributionLink', z
47
+ .object({
48
+ id: z.string(),
49
+ object: z.literal('payment_link'),
50
+ amount: z.string().describe('FAIR base units; `"0"` when the payer chooses.'),
51
+ currency: z.literal('FAIR'),
52
+ network: z.enum(['mainnet', 'testnet']),
53
+ active: z.boolean(),
54
+ url: z.url().describe('The hosted link to share.'),
55
+ contribution: contributionDetailsSchema,
56
+ created: unixSecondsSchema,
57
+ })
58
+ .strict());
59
+ export const contributionListSchema = listOf(contributionLinkSchema);
60
+ /** A payment made through a contribution link. Non-custodial: Peable cannot refund it. */
61
+ export const contributionCollectionSchema = defineComponent('ContributionCollection', z
62
+ .object({
63
+ id: z.string(),
64
+ object: z.literal('payment_intent'),
65
+ amount: z.string(),
66
+ currency: z.literal('FAIR'),
67
+ status: z.string(),
68
+ created: unixSecondsSchema,
69
+ refund_capability: z.literal('unsupported_non_custodial'),
70
+ refunds: z.array(z
71
+ .object({
72
+ id: z.string(),
73
+ object: z.literal('refund'),
74
+ amount: z.string(),
75
+ status: z.string(),
76
+ created: unixSecondsSchema,
77
+ })
78
+ .strict()),
79
+ })
80
+ .strict());
81
+ export const contributionCollectionListSchema = listOf(contributionCollectionSchema);
82
+ /** The environment the Test/Live toggle selects: the application's merchant in it is the scope. */
83
+ const environmentParam = z
84
+ .enum(MERCHANT_ENVIRONMENTS)
85
+ .describe("Which of the application's merchants: its Test/Live toggle.");
86
+ /** The query of every contribution write: the environment and nothing else. */
87
+ export const contributionScopeQuerySchema = z.object({ environment: environmentParam }).strict();
88
+ /**
89
+ * Paging a contribution list: the list parameters every list accepts
90
+ * (`link_…` cursors for links, `pi_…` for collections) plus the environment.
91
+ */
92
+ export const contributionPageQuerySchema = listQuery({ environment: environmentParam });
93
+ /** What a payer may say when starting a free contribution's checkout. */
94
+ export const contributionMintSchema = z
95
+ .object({ amount: contributionAmountSchema.optional() })
96
+ .strict();
97
+ /** A contribution start's `Idempotency-Key`: a UUID the page writes before the request. */
98
+ export const contributionOperationKeySchema = z.uuid();
99
+ export const contributionPatchSchema = z.object({ active: z.boolean() }).strict();
100
+ /** `"1.25"` FAIR → `"125000000"` base units, with exact integer arithmetic. */
101
+ export function decimalContributionAmount(value) {
102
+ if (!/^(0|[1-9][0-9]{0,7})(\.[0-9]{1,8})?$/.test(value))
103
+ throw new Error('Enter a FAIR amount with at most eight decimals');
104
+ const [whole = '0', fraction = ''] = value.split('.');
105
+ return contributionAmountSchema.parse((BigInt(whole) * FAIR_UNITS_PER_COIN + BigInt(fraction.padEnd(8, '0'))).toString());
106
+ }
107
+ /** Base units → the shortest exact FAIR decimal. */
108
+ export function formatContributionAmount(value) {
109
+ const units = BigInt(value);
110
+ const fraction = (units % FAIR_UNITS_PER_COIN).toString().padStart(8, '0').replace(/0+$/, '');
111
+ return (units / FAIR_UNITS_PER_COIN).toString() + (fraction ? `.${fraction}` : '');
112
+ }
113
+ const scopeParams = {
114
+ organizationId: 'The Oxy organization.',
115
+ applicationId: "The organization's Oxy application whose merchant collects.",
116
+ };
117
+ const root = '/v1/organizations/{organizationId}/applications/{applicationId}/contributions';
118
+ export const contributionRoutes = [
119
+ defineRoute({
120
+ operationId: 'createContribution',
121
+ method: 'post',
122
+ path: root,
123
+ tag: 'Contributions',
124
+ summary: 'Create a contribution link',
125
+ description: 'Requires a UUID `Idempotency-Key` header: the operation key, so a retry after a lost answer returns the same link.',
126
+ auth: 'user',
127
+ params: scopeParams,
128
+ query: contributionScopeQuerySchema,
129
+ body: createContributionSchema,
130
+ response: contributionLinkSchema,
131
+ status: 201,
132
+ }),
133
+ defineRoute({
134
+ operationId: 'listContributions',
135
+ method: 'get',
136
+ path: root,
137
+ tag: 'Contributions',
138
+ summary: "List an organization's contribution links",
139
+ auth: 'user',
140
+ params: scopeParams,
141
+ query: contributionPageQuerySchema,
142
+ response: contributionListSchema,
143
+ }),
144
+ defineRoute({
145
+ operationId: 'updateContribution',
146
+ method: 'post',
147
+ path: `${root}/{id}`,
148
+ tag: 'Contributions',
149
+ summary: 'Enable or disable a contribution link',
150
+ auth: 'user',
151
+ params: { ...scopeParams, id: 'The contribution link (`link_…`).' },
152
+ query: contributionScopeQuerySchema,
153
+ body: contributionPatchSchema,
154
+ response: contributionLinkSchema,
155
+ }),
156
+ defineRoute({
157
+ operationId: 'listContributionCollections',
158
+ method: 'get',
159
+ path: `${root}/{id}/collections`,
160
+ tag: 'Contributions',
161
+ summary: 'List the payments made through a contribution link',
162
+ auth: 'user',
163
+ params: { ...scopeParams, id: 'The contribution link (`link_…`).' },
164
+ query: contributionPageQuerySchema,
165
+ response: contributionCollectionListSchema,
166
+ }),
167
+ ];
@@ -0,0 +1,130 @@
1
+ import { z } from 'zod';
2
+ import { listOf } from '../../common/envelopes.js';
3
+ import { defineObject } from '../../common/objects.js';
4
+ import { emptyQuery, expandOnlyQuery, listQuery } from '../../common/params.js';
5
+ import { livemode, unixSeconds } from '../../common/primitives.js';
6
+ import { defineRoute } from '../../route.js';
7
+ import { FILE_PURPOSES, FILE_STATUSES, FILE_TYPES, FILE_UPLOAD_PURPOSES, } from '../../vocabulary/files.js';
8
+ /**
9
+ * Files (`file_…`) — bytes a merchant gives Orbit for one stated purpose
10
+ * (ADR 0016: Orbit owns the object; the storage is Oxy Files, a binding that
11
+ * never reaches the wire). Stripe's Files API, with Oxy Files underneath.
12
+ */
13
+ export const fileSchema = defineObject('file', 'File', z
14
+ .object({
15
+ id: z.string(),
16
+ object: z.literal('file'),
17
+ livemode,
18
+ purpose: z.enum(FILE_PURPOSES),
19
+ filename: z
20
+ .string()
21
+ .nullable()
22
+ .describe('The name it was uploaded with, if it had a printable one.'),
23
+ size: z.number().int().nonnegative().describe('Bytes.'),
24
+ type: z.enum(FILE_TYPES),
25
+ status: z.enum(FILE_STATUSES),
26
+ url: z
27
+ .string()
28
+ .nullable()
29
+ .describe('Where the bytes can be read while the file is `available`: a public URL for a `business_logo`, `GET /v1/files/{id}/contents` for a `finance_report_run`. `null` for every other purpose — evidence and identity documents are never addressable by URL.'),
30
+ created: unixSeconds,
31
+ })
32
+ .strict(), {
33
+ examples: [
34
+ {
35
+ id: 'file_0193b8f2c1a87d3e9f4a',
36
+ object: 'file',
37
+ livemode: false,
38
+ purpose: 'business_logo',
39
+ filename: 'logo.png',
40
+ size: 18432,
41
+ type: 'png',
42
+ status: 'available',
43
+ url: 'https://cloud.oxy.so/assets/0193b8f2c1a87d3e9f4b',
44
+ created: 1793750400,
45
+ },
46
+ ],
47
+ });
48
+ /**
49
+ * `POST /v1/files` as `multipart/form-data`: a `purpose` field and a `file`
50
+ * part. The gateway reads the form itself, bounded by the largest purpose's
51
+ * ceiling, and checks each part with these schemas.
52
+ */
53
+ export const createFileUploadParams = z
54
+ .object({
55
+ purpose: z.enum(FILE_UPLOAD_PURPOSES, {
56
+ error: `purpose must be one of ${FILE_UPLOAD_PURPOSES.join(', ')}`,
57
+ }),
58
+ file: z.file({ error: 'file is required' }).describe('The bytes, with their filename.'),
59
+ })
60
+ .strict();
61
+ /**
62
+ * `POST /v1/files` as JSON: an Oxy file the caller already owns (their
63
+ * application's, or an account they are or act for). Its ownership is checked
64
+ * once, here, and never again.
65
+ */
66
+ export const createFileFromOxyParams = z
67
+ .object({
68
+ purpose: z.enum(FILE_UPLOAD_PURPOSES),
69
+ oxy_file: z.string().min(1).max(128).describe('The Oxy file id.'),
70
+ })
71
+ .strict();
72
+ export const listFilesQuery = listQuery({ purpose: z.enum(FILE_PURPOSES).optional() });
73
+ export const fileRoutes = [
74
+ defineRoute({
75
+ operationId: 'createFile',
76
+ method: 'post',
77
+ path: '/v1/files',
78
+ tag: 'Files',
79
+ summary: 'Upload a file',
80
+ description: 'The bytes as `multipart/form-data` (`purpose`, `file`), or — as JSON — `{ purpose, oxy_file }` to import an Oxy file you own. The type is recognised from the bytes, never from a `Content-Type`; each purpose has its own formats and size ceiling.',
81
+ auth: 'service',
82
+ scope: 'payments:write',
83
+ idempotent: true,
84
+ body: createFileUploadParams,
85
+ bodyEncoding: 'multipart',
86
+ response: fileSchema,
87
+ sdk: 'files.create',
88
+ }),
89
+ defineRoute({
90
+ operationId: 'listFiles',
91
+ method: 'get',
92
+ path: '/v1/files',
93
+ tag: 'Files',
94
+ summary: 'List files',
95
+ auth: 'service',
96
+ scope: 'payments:read',
97
+ query: listFilesQuery,
98
+ response: listOf(fileSchema),
99
+ sdk: 'files.list',
100
+ expandable: 'file',
101
+ }),
102
+ defineRoute({
103
+ operationId: 'retrieveFile',
104
+ method: 'get',
105
+ path: '/v1/files/{id}',
106
+ tag: 'Files',
107
+ summary: 'Retrieve a file',
108
+ auth: 'service',
109
+ scope: 'payments:read',
110
+ params: { id: 'The file (`file_…`).' },
111
+ query: expandOnlyQuery,
112
+ response: fileSchema,
113
+ sdk: 'files.retrieve',
114
+ expandable: 'file',
115
+ }),
116
+ defineRoute({
117
+ operationId: 'retrieveFileContents',
118
+ method: 'get',
119
+ path: '/v1/files/{id}/contents',
120
+ tag: 'Files',
121
+ summary: "Download a file's contents",
122
+ description: "The bytes of a file you read back — a report run's CSV — as an attachment. Any other purpose answers 404: evidence and identity documents leave Peable only to their provider.",
123
+ auth: 'service',
124
+ scope: 'payments:read',
125
+ params: { id: 'The file (`file_…`).' },
126
+ query: emptyQuery,
127
+ response: { kind: 'binary', contentType: 'text/csv' },
128
+ sdk: 'files.contents',
129
+ }),
130
+ ];
@@ -0,0 +1,25 @@
1
+ import { checkoutSessionRoutes } from './checkoutSessions.js';
2
+ import { contributionRoutes } from './contributions.js';
3
+ import { fileRoutes } from './files.js';
4
+ import { merchantRoutes } from './merchants.js';
5
+ import { paymentLinkRoutes } from './paymentLinks.js';
6
+ import { paymentMethodConfigurationRoutes } from './paymentMethodConfigurations.js';
7
+ export * from './checkoutSessions.js';
8
+ export * from './contributions.js';
9
+ export * from './files.js';
10
+ export * from './merchants.js';
11
+ export * from './paymentLinks.js';
12
+ export * from './paymentMethodConfigurations.js';
13
+ // The shared building blocks' public half: the sub-objects sessions and links
14
+ // return, and what a backend needs to store a parsed request. The rest of
15
+ // `./shared` (rail, locale, URL and amount params) stays internal to checkout.
16
+ export { adjustableBoundsOf, checkoutAdjustableQuantitySchema, checkoutAutomaticTaxSchema, checkoutBrandingSchema, checkoutConsentCollectionSchema, checkoutConsentSchema, checkoutCustomerDetailsSchema, checkoutCustomFieldSchema, checkoutDiscountSchema, checkoutLineItemSchema, checkoutShippingDetailsSchema, checkoutTaxIdSchema, checkoutTotalDetailsSchema, customFieldsParam, merchantDisplaySchema, } from './shared.js';
17
+ /** Checkout, payment links, the merchant and its branding, files and contributions. */
18
+ export const checkoutRoutes = [
19
+ ...checkoutSessionRoutes,
20
+ ...paymentLinkRoutes,
21
+ ...paymentMethodConfigurationRoutes,
22
+ ...merchantRoutes,
23
+ ...fileRoutes,
24
+ ...contributionRoutes,
25
+ ];
@@ -0,0 +1,287 @@
1
+ import { z } from 'zod';
2
+ import { defineObject } from '../../common/objects.js';
3
+ import { livemode, network, unixSeconds } from '../../common/primitives.js';
4
+ import { defineRoute } from '../../route.js';
5
+ import { BRANDING_BORDER_STYLES, BRANDING_FONTS, MERCHANT_ENVIRONMENTS, } from '../../vocabulary/merchants.js';
6
+ /**
7
+ * The merchant (`merch_…`) — one per Oxy application and environment — with
8
+ * its branding and customer-email settings. `next_derivation_index` is never
9
+ * on the wire: it is an internal derivation counter with no meaning to an
10
+ * integration. Where events go is not a merchant field: it is the
11
+ * `webhook_endpoint` resource.
12
+ */
13
+ export const merchantSchema = defineObject('merchant', 'Merchant', z
14
+ .object({
15
+ id: z.string(),
16
+ object: z.literal('merchant'),
17
+ livemode: livemode.describe('`true` for a `production` merchant (ADR 0017).'),
18
+ oxy_app_id: z.string().describe('The Oxy application this merchant belongs to.'),
19
+ environment: z.enum(MERCHANT_ENVIRONMENTS),
20
+ network: network
21
+ .nullable()
22
+ .describe('The FairCoin chain this merchant accepts on; `null` on a card-only merchant. Nullable together with `xpub`.'),
23
+ xpub: z
24
+ .string()
25
+ .nullable()
26
+ .describe('The watch-only account key receive addresses derive from; `null` on a card-only merchant.'),
27
+ required_confirmations: z.number().int().positive(),
28
+ display_name: z
29
+ .string()
30
+ .optional()
31
+ .describe('Payer-facing name. Absent when unset: payer surfaces substitute a fallback.'),
32
+ avatar_file_id: z
33
+ .string()
34
+ .optional()
35
+ .describe('The square identity image: a bare Oxy file id. Absent again once Oxy reports the file deleted or taken down.'),
36
+ business_logo: z
37
+ .string()
38
+ .optional()
39
+ .describe('The wide wordmark payer surfaces show: a `file_…` of purpose `business_logo`.'),
40
+ description: z.string().optional(),
41
+ created: unixSeconds,
42
+ updated_at: unixSeconds,
43
+ })
44
+ .strict(), {
45
+ examples: [
46
+ {
47
+ id: 'merch_0193b8f2c1a87d3e9f4a',
48
+ object: 'merchant',
49
+ livemode: false,
50
+ oxy_app_id: 'app_0193b8f2c1a87d3e9f4b',
51
+ environment: 'development',
52
+ network: 'testnet',
53
+ xpub: 'tpubDC5FSnBiZDMmhiuCmWAYsLwgLYrrT9rAqvTySfuCCrgsWz8wxMXUS9Tb9iVMvcRbvFcAHGkMD5Kx8koh4GquNGNTfohfk7pgjhaPCdXpoba',
54
+ required_confirmations: 6,
55
+ display_name: 'Jenny’s Plants',
56
+ created: 1793750400,
57
+ updated_at: 1793750400,
58
+ },
59
+ ],
60
+ });
61
+ // The branding columns are bare `text()` with no CHECK, so these bounds are
62
+ // the ONLY thing between a merchant and an unbounded write. `display_name` is
63
+ // rendered in a payer's transaction history and on the checkout chip, so it is
64
+ // held to a chip-sized length rather than a paragraph.
65
+ const displayName = z.string().min(1).max(64);
66
+ const avatarFileId = z.string().min(1).max(128);
67
+ const merchantDescription = z.string().min(1).max(512);
68
+ /**
69
+ * `POST /v1/merchants`. The FairCoin half is OPTIONAL — both `network` and
70
+ * `xpub`, or neither: a card-only merchant supplies no key for a chain it
71
+ * never intends to use.
72
+ */
73
+ export const registerMerchantParams = z
74
+ .object({
75
+ network: network.optional(),
76
+ xpub: z
77
+ .string()
78
+ .min(1)
79
+ .optional()
80
+ .describe('A watch-only account xpub. A private extended key is refused.'),
81
+ required_confirmations: z.number().int().positive().optional(),
82
+ display_name: displayName.optional(),
83
+ avatar_file_id: avatarFileId.optional(),
84
+ description: merchantDescription.optional(),
85
+ })
86
+ .strict()
87
+ .refine((body) => (body.network === undefined) === (body.xpub === undefined), {
88
+ message: 'accepting FairCoin needs both a network and a watch-only xpub, or neither — ' +
89
+ 'omit both to register a card-only merchant',
90
+ });
91
+ /**
92
+ * `POST /v1/merchants/me`. `null` clears a field. The key, network and
93
+ * environment never change: addresses already derived from the key, and the
94
+ * test/live firewall, depend on them.
95
+ */
96
+ export const updateMerchantParams = z
97
+ .object({
98
+ required_confirmations: z.number().int().positive().optional(),
99
+ display_name: displayName.nullable().optional(),
100
+ avatar_file_id: avatarFileId.nullable().optional(),
101
+ business_logo: z
102
+ .string()
103
+ .min(1)
104
+ .max(255)
105
+ .nullable()
106
+ .optional()
107
+ .describe('A `file_…` of purpose `business_logo` — set on an update, never at registration.'),
108
+ description: merchantDescription.nullable().optional(),
109
+ })
110
+ .strict();
111
+ // ---- Branding ----------------------------------------------------------------
112
+ /** A merchant's branding: what its hosted checkout, embedded checkout and receipts look like. */
113
+ export const merchantBrandingSchema = defineObject('branding_settings', 'BrandingSettings', z
114
+ .object({
115
+ object: z.literal('branding_settings'),
116
+ livemode,
117
+ use_avatar_as_icon: z
118
+ .boolean()
119
+ .describe('Show the merchant avatar (`avatar_file_id`) as the square icon.'),
120
+ logo: z
121
+ .string()
122
+ .nullable()
123
+ .describe('The wide logo: a `file_…` of purpose `business_logo`, or `null` — the same field as `POST /v1/merchants/me {business_logo}`.'),
124
+ primary_color: z.string().nullable().describe('`#rrggbb`; `null` for Peable’s default.'),
125
+ accent_color: z.string().nullable(),
126
+ font: z.enum(BRANDING_FONTS).nullable(),
127
+ border_style: z.enum(BRANDING_BORDER_STYLES).nullable(),
128
+ terms_of_service_url: z
129
+ .string()
130
+ .nullable()
131
+ .describe('Your terms (`https://`). Required before a session or link can ask for terms acceptance.'),
132
+ updated_at: unixSeconds.nullable(),
133
+ })
134
+ .strict());
135
+ /** `#rgb` or `#rrggbb`, any case — stored as lowercase `#rrggbb`. */
136
+ const colorParam = z
137
+ .string()
138
+ .regex(/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, 'must be a #rrggbb colour')
139
+ .transform((value) => {
140
+ const hex = value.slice(1).toLowerCase();
141
+ return `#${hex.length === 3 ? [...hex].map((c) => c + c).join('') : hex}`;
142
+ });
143
+ const httpsUrlParam = z
144
+ .string()
145
+ .max(2048)
146
+ .regex(/^https:\/\/\S+$/, 'must be an https URL');
147
+ export const updateMerchantBrandingParams = z
148
+ .object({
149
+ use_avatar_as_icon: z.boolean().optional(),
150
+ logo: z
151
+ .string()
152
+ .min(1)
153
+ .max(255)
154
+ .nullable()
155
+ .optional()
156
+ .describe('A `file_…` of purpose `business_logo`; `null` removes it.'),
157
+ primary_color: colorParam
158
+ .nullable()
159
+ .optional()
160
+ .describe('`#rrggbb` (any case; stored lowercase), `null` for Peable’s default.'),
161
+ accent_color: colorParam.nullable().optional(),
162
+ font: z.enum(BRANDING_FONTS).nullable().optional(),
163
+ border_style: z.enum(BRANDING_BORDER_STYLES).nullable().optional(),
164
+ terms_of_service_url: httpsUrlParam.nullable().optional(),
165
+ })
166
+ .strict();
167
+ /** Which customer emails Peable sends for this merchant. */
168
+ export const merchantEmailSettingsSchema = defineObject('email_settings', 'EmailSettings', z
169
+ .object({
170
+ object: z.literal('email_settings'),
171
+ livemode,
172
+ payment_receipts: z
173
+ .boolean()
174
+ .describe('A receipt when a payment succeeds and has a `receipt_email` (or a collected one).'),
175
+ refund_notices: z.boolean().describe('A notice when a refund succeeds.'),
176
+ checkout_confirmations: z
177
+ .boolean()
178
+ .describe('A confirmation when a checkout session completes.'),
179
+ support_email: z
180
+ .string()
181
+ .nullable()
182
+ .describe('The reply-to address shown on emails, or `null` for none.'),
183
+ updated_at: unixSeconds.nullable(),
184
+ })
185
+ .strict());
186
+ export const updateMerchantEmailSettingsParams = z
187
+ .object({
188
+ payment_receipts: z.boolean().optional(),
189
+ refund_notices: z.boolean().optional(),
190
+ checkout_confirmations: z.boolean().optional(),
191
+ support_email: z
192
+ .string()
193
+ .trim()
194
+ .max(254)
195
+ .email('must be an email address')
196
+ .nullable()
197
+ .optional(),
198
+ })
199
+ .strict();
200
+ export const merchantRoutes = [
201
+ defineRoute({
202
+ operationId: 'registerMerchant',
203
+ method: 'post',
204
+ path: '/v1/merchants',
205
+ tag: 'Merchants',
206
+ summary: 'Register the merchant',
207
+ description: "Registers the calling application's merchant in the credential's environment. A non-production credential can register a testnet merchant only. A second registration for the same application and environment answers 409. Outside the generic idempotency layer: the merchant is the scope it keys on.",
208
+ auth: 'service',
209
+ scope: 'payments:write',
210
+ body: registerMerchantParams,
211
+ response: merchantSchema,
212
+ status: 201,
213
+ sdk: 'merchants.register',
214
+ }),
215
+ defineRoute({
216
+ operationId: 'retrieveMerchant',
217
+ method: 'get',
218
+ path: '/v1/merchants/me',
219
+ tag: 'Merchants',
220
+ summary: 'Retrieve your merchant',
221
+ auth: 'service',
222
+ scope: 'payments:read',
223
+ response: merchantSchema,
224
+ sdk: 'merchants.retrieve',
225
+ }),
226
+ defineRoute({
227
+ operationId: 'updateMerchant',
228
+ method: 'post',
229
+ path: '/v1/merchants/me',
230
+ tag: 'Merchants',
231
+ summary: 'Update your merchant',
232
+ auth: 'service',
233
+ scope: 'payments:write',
234
+ idempotent: true,
235
+ body: updateMerchantParams,
236
+ response: merchantSchema,
237
+ sdk: 'merchants.update',
238
+ }),
239
+ defineRoute({
240
+ operationId: 'retrieveBrandingSettings',
241
+ method: 'get',
242
+ path: '/v1/merchants/me/branding',
243
+ tag: 'Merchants',
244
+ summary: 'Retrieve your branding',
245
+ auth: 'service',
246
+ scope: 'payments:read',
247
+ response: merchantBrandingSchema,
248
+ sdk: 'merchants.branding.retrieve',
249
+ }),
250
+ defineRoute({
251
+ operationId: 'updateBrandingSettings',
252
+ method: 'post',
253
+ path: '/v1/merchants/me/branding',
254
+ tag: 'Merchants',
255
+ summary: 'Update your branding',
256
+ auth: 'service',
257
+ scope: 'payments:write',
258
+ idempotent: true,
259
+ body: updateMerchantBrandingParams,
260
+ response: merchantBrandingSchema,
261
+ sdk: 'merchants.branding.update',
262
+ }),
263
+ defineRoute({
264
+ operationId: 'retrieveEmailSettings',
265
+ method: 'get',
266
+ path: '/v1/merchants/me/email_settings',
267
+ tag: 'Merchants',
268
+ summary: 'Retrieve your customer email settings',
269
+ auth: 'service',
270
+ scope: 'payments:read',
271
+ response: merchantEmailSettingsSchema,
272
+ sdk: 'merchants.emailSettings.retrieve',
273
+ }),
274
+ defineRoute({
275
+ operationId: 'updateEmailSettings',
276
+ method: 'post',
277
+ path: '/v1/merchants/me/email_settings',
278
+ tag: 'Merchants',
279
+ summary: 'Update your customer email settings',
280
+ auth: 'service',
281
+ scope: 'payments:write',
282
+ idempotent: true,
283
+ body: updateMerchantEmailSettingsParams,
284
+ response: merchantEmailSettingsSchema,
285
+ sdk: 'merchants.emailSettings.update',
286
+ }),
287
+ ];