@stancer/stancer 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/dist/address/api-endpoint.d.ts +20 -0
  3. package/dist/address/api-endpoint.d.ts.map +1 -0
  4. package/dist/address/api-endpoint.js +28 -0
  5. package/dist/address/api-endpoint.js.map +1 -0
  6. package/dist/address/model.d.ts +35 -0
  7. package/dist/address/model.d.ts.map +1 -0
  8. package/dist/address/model.js +63 -0
  9. package/dist/address/model.js.map +1 -0
  10. package/dist/address/repository.d.ts +7 -0
  11. package/dist/address/repository.d.ts.map +1 -0
  12. package/dist/address/repository.js +14 -0
  13. package/dist/address/repository.js.map +1 -0
  14. package/dist/address/validator.d.ts +4 -0
  15. package/dist/address/validator.d.ts.map +1 -0
  16. package/dist/address/validator.js +32 -0
  17. package/dist/address/validator.js.map +1 -0
  18. package/dist/api-endpoint/abstract-api-endpoint.d.ts +46 -0
  19. package/dist/api-endpoint/abstract-api-endpoint.d.ts.map +1 -0
  20. package/dist/api-endpoint/abstract-api-endpoint.js +220 -0
  21. package/dist/api-endpoint/abstract-api-endpoint.js.map +1 -0
  22. package/dist/api-endpoint/configuration.d.ts +34 -0
  23. package/dist/api-endpoint/configuration.d.ts.map +1 -0
  24. package/dist/api-endpoint/configuration.js +99 -0
  25. package/dist/api-endpoint/configuration.js.map +1 -0
  26. package/dist/api-endpoint/http/fetch-http-client.d.ts +3 -0
  27. package/dist/api-endpoint/http/fetch-http-client.d.ts.map +1 -0
  28. package/dist/api-endpoint/http/fetch-http-client.js +28 -0
  29. package/dist/api-endpoint/http/fetch-http-client.js.map +1 -0
  30. package/dist/api-endpoint/http/http.d.ts +18 -0
  31. package/dist/api-endpoint/http/http.d.ts.map +1 -0
  32. package/dist/api-endpoint/http/http.js +47 -0
  33. package/dist/api-endpoint/http/http.js.map +1 -0
  34. package/dist/api-endpoint/http/index.d.ts +3 -0
  35. package/dist/api-endpoint/http/index.d.ts.map +1 -0
  36. package/dist/api-endpoint/http/index.js +3 -0
  37. package/dist/api-endpoint/http/index.js.map +1 -0
  38. package/dist/api-endpoint/version.d.ts +5 -0
  39. package/dist/api-endpoint/version.d.ts.map +1 -0
  40. package/dist/api-endpoint/version.js +6 -0
  41. package/dist/api-endpoint/version.js.map +1 -0
  42. package/dist/card/api-endpoint.d.ts +28 -0
  43. package/dist/card/api-endpoint.d.ts.map +1 -0
  44. package/dist/card/api-endpoint.js +37 -0
  45. package/dist/card/api-endpoint.js.map +1 -0
  46. package/dist/card/enum/funding.d.ts +3 -0
  47. package/dist/card/enum/funding.d.ts.map +1 -0
  48. package/dist/card/enum/funding.js +10 -0
  49. package/dist/card/enum/funding.js.map +1 -0
  50. package/dist/card/enum/nature.d.ts +3 -0
  51. package/dist/card/enum/nature.d.ts.map +1 -0
  52. package/dist/card/enum/nature.js +6 -0
  53. package/dist/card/enum/nature.js.map +1 -0
  54. package/dist/card/enum/network.d.ts +5 -0
  55. package/dist/card/enum/network.d.ts.map +1 -0
  56. package/dist/card/enum/network.js +12 -0
  57. package/dist/card/enum/network.js.map +1 -0
  58. package/dist/card/model.d.ts +55 -0
  59. package/dist/card/model.d.ts.map +1 -0
  60. package/dist/card/model.js +90 -0
  61. package/dist/card/model.js.map +1 -0
  62. package/dist/card/repository.d.ts +7 -0
  63. package/dist/card/repository.d.ts.map +1 -0
  64. package/dist/card/repository.js +10 -0
  65. package/dist/card/repository.js.map +1 -0
  66. package/dist/card/validator.d.ts +8 -0
  67. package/dist/card/validator.d.ts.map +1 -0
  68. package/dist/card/validator.js +71 -0
  69. package/dist/card/validator.js.map +1 -0
  70. package/dist/core/abstract-model.d.ts +51 -0
  71. package/dist/core/abstract-model.d.ts.map +1 -0
  72. package/dist/core/abstract-model.js +93 -0
  73. package/dist/core/abstract-model.js.map +1 -0
  74. package/dist/core/abstract-repository.d.ts +86 -0
  75. package/dist/core/abstract-repository.d.ts.map +1 -0
  76. package/dist/core/abstract-repository.js +97 -0
  77. package/dist/core/abstract-repository.js.map +1 -0
  78. package/dist/core/common/branded-type.d.ts +6 -0
  79. package/dist/core/common/branded-type.d.ts.map +1 -0
  80. package/dist/core/common/branded-type.js +9 -0
  81. package/dist/core/common/branded-type.js.map +1 -0
  82. package/dist/core/common/handler/date-handler.d.ts +5 -0
  83. package/dist/core/common/handler/date-handler.d.ts.map +1 -0
  84. package/dist/core/common/handler/date-handler.js +23 -0
  85. package/dist/core/common/handler/date-handler.js.map +1 -0
  86. package/dist/core/common/handler/enum-handler.d.ts +3 -0
  87. package/dist/core/common/handler/enum-handler.d.ts.map +1 -0
  88. package/dist/core/common/handler/enum-handler.js +14 -0
  89. package/dist/core/common/handler/enum-handler.js.map +1 -0
  90. package/dist/core/common/handler/handler.d.ts +24 -0
  91. package/dist/core/common/handler/handler.d.ts.map +1 -0
  92. package/dist/core/common/handler/handler.js +33 -0
  93. package/dist/core/common/handler/handler.js.map +1 -0
  94. package/dist/core/common/handler/id-handler.d.ts +4 -0
  95. package/dist/core/common/handler/id-handler.d.ts.map +1 -0
  96. package/dist/core/common/handler/id-handler.js +21 -0
  97. package/dist/core/common/handler/id-handler.js.map +1 -0
  98. package/dist/core/common/id-validator.d.ts +10 -0
  99. package/dist/core/common/id-validator.d.ts.map +1 -0
  100. package/dist/core/common/id-validator.js +17 -0
  101. package/dist/core/common/id-validator.js.map +1 -0
  102. package/dist/core/common/mutation-tracked-object.d.ts +8 -0
  103. package/dist/core/common/mutation-tracked-object.d.ts.map +1 -0
  104. package/dist/core/common/mutation-tracked-object.js +38 -0
  105. package/dist/core/common/mutation-tracked-object.js.map +1 -0
  106. package/dist/core/endpoint-interface.d.ts +38 -0
  107. package/dist/core/endpoint-interface.d.ts.map +1 -0
  108. package/dist/core/endpoint-interface.js +2 -0
  109. package/dist/core/endpoint-interface.js.map +1 -0
  110. package/dist/core/error/base-error.d.ts +3 -0
  111. package/dist/core/error/base-error.d.ts.map +1 -0
  112. package/dist/core/error/base-error.js +3 -0
  113. package/dist/core/error/base-error.js.map +1 -0
  114. package/dist/core/error/endpoint/api/api-conflict-error.d.ts +5 -0
  115. package/dist/core/error/endpoint/api/api-conflict-error.d.ts.map +1 -0
  116. package/dist/core/error/endpoint/api/api-conflict-error.js +7 -0
  117. package/dist/core/error/endpoint/api/api-conflict-error.js.map +1 -0
  118. package/dist/core/error/endpoint/api/api-error.d.ts +6 -0
  119. package/dist/core/error/endpoint/api/api-error.d.ts.map +1 -0
  120. package/dist/core/error/endpoint/api/api-error.js +9 -0
  121. package/dist/core/error/endpoint/api/api-error.js.map +1 -0
  122. package/dist/core/error/endpoint/api/api-not-found-error.d.ts +5 -0
  123. package/dist/core/error/endpoint/api/api-not-found-error.d.ts.map +1 -0
  124. package/dist/core/error/endpoint/api/api-not-found-error.js +7 -0
  125. package/dist/core/error/endpoint/api/api-not-found-error.js.map +1 -0
  126. package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts +5 -0
  127. package/dist/core/error/endpoint/api/api-unauthorized-error.d.ts.map +1 -0
  128. package/dist/core/error/endpoint/api/api-unauthorized-error.js +7 -0
  129. package/dist/core/error/endpoint/api/api-unauthorized-error.js.map +1 -0
  130. package/dist/core/error/endpoint/api/api-unknown-error.d.ts +5 -0
  131. package/dist/core/error/endpoint/api/api-unknown-error.d.ts.map +1 -0
  132. package/dist/core/error/endpoint/api/api-unknown-error.js +7 -0
  133. package/dist/core/error/endpoint/api/api-unknown-error.js.map +1 -0
  134. package/dist/core/error/endpoint/api/api-validation-error.d.ts +11 -0
  135. package/dist/core/error/endpoint/api/api-validation-error.d.ts.map +1 -0
  136. package/dist/core/error/endpoint/api/api-validation-error.js +9 -0
  137. package/dist/core/error/endpoint/api/api-validation-error.js.map +1 -0
  138. package/dist/core/error/endpoint/api/index.d.ts +7 -0
  139. package/dist/core/error/endpoint/api/index.d.ts.map +1 -0
  140. package/dist/core/error/endpoint/api/index.js +7 -0
  141. package/dist/core/error/endpoint/api/index.js.map +1 -0
  142. package/dist/core/error/endpoint/route-inaccessible-error.d.ts +5 -0
  143. package/dist/core/error/endpoint/route-inaccessible-error.d.ts.map +1 -0
  144. package/dist/core/error/endpoint/route-inaccessible-error.js +8 -0
  145. package/dist/core/error/endpoint/route-inaccessible-error.js.map +1 -0
  146. package/dist/core/error/unpopulated-error.d.ts +4 -0
  147. package/dist/core/error/unpopulated-error.d.ts.map +1 -0
  148. package/dist/core/error/unpopulated-error.js +4 -0
  149. package/dist/core/error/unpopulated-error.js.map +1 -0
  150. package/dist/core/error/unsendable-error.d.ts +4 -0
  151. package/dist/core/error/unsendable-error.d.ts.map +1 -0
  152. package/dist/core/error/unsendable-error.js +4 -0
  153. package/dist/core/error/unsendable-error.js.map +1 -0
  154. package/dist/core/error/validation-error.d.ts +4 -0
  155. package/dist/core/error/validation-error.d.ts.map +1 -0
  156. package/dist/core/error/validation-error.js +4 -0
  157. package/dist/core/error/validation-error.js.map +1 -0
  158. package/dist/core/validator.d.ts +63 -0
  159. package/dist/core/validator.d.ts.map +1 -0
  160. package/dist/core/validator.js +73 -0
  161. package/dist/core/validator.js.map +1 -0
  162. package/dist/customer/api-endpoint.d.ts +21 -0
  163. package/dist/customer/api-endpoint.d.ts.map +1 -0
  164. package/dist/customer/api-endpoint.js +27 -0
  165. package/dist/customer/api-endpoint.js.map +1 -0
  166. package/dist/customer/model.d.ts +39 -0
  167. package/dist/customer/model.d.ts.map +1 -0
  168. package/dist/customer/model.js +73 -0
  169. package/dist/customer/model.js.map +1 -0
  170. package/dist/customer/repository.d.ts +7 -0
  171. package/dist/customer/repository.d.ts.map +1 -0
  172. package/dist/customer/repository.js +10 -0
  173. package/dist/customer/repository.js.map +1 -0
  174. package/dist/customer/validator.d.ts +4 -0
  175. package/dist/customer/validator.d.ts.map +1 -0
  176. package/dist/customer/validator.js +23 -0
  177. package/dist/customer/validator.js.map +1 -0
  178. package/dist/main.d.ts +2 -0
  179. package/dist/main.d.ts.map +1 -0
  180. package/dist/main.js +2 -0
  181. package/dist/main.js.map +1 -0
  182. package/dist/payment/api-endpoint.d.ts +51 -0
  183. package/dist/payment/api-endpoint.d.ts.map +1 -0
  184. package/dist/payment/api-endpoint.js +110 -0
  185. package/dist/payment/api-endpoint.js.map +1 -0
  186. package/dist/payment/enum/currency.d.ts +3 -0
  187. package/dist/payment/enum/currency.d.ts.map +1 -0
  188. package/dist/payment/enum/currency.js +13 -0
  189. package/dist/payment/enum/currency.js.map +1 -0
  190. package/dist/payment/enum/method.d.ts +3 -0
  191. package/dist/payment/enum/method.d.ts.map +1 -0
  192. package/dist/payment/enum/method.js +2 -0
  193. package/dist/payment/enum/method.js.map +1 -0
  194. package/dist/payment/enum/status.d.ts +4 -0
  195. package/dist/payment/enum/status.d.ts.map +1 -0
  196. package/dist/payment/enum/status.js +19 -0
  197. package/dist/payment/enum/status.js.map +1 -0
  198. package/dist/payment/model.d.ts +135 -0
  199. package/dist/payment/model.d.ts.map +1 -0
  200. package/dist/payment/model.js +232 -0
  201. package/dist/payment/model.js.map +1 -0
  202. package/dist/payment/repository.d.ts +17 -0
  203. package/dist/payment/repository.d.ts.map +1 -0
  204. package/dist/payment/repository.js +56 -0
  205. package/dist/payment/repository.js.map +1 -0
  206. package/dist/payment/validator.d.ts +16 -0
  207. package/dist/payment/validator.d.ts.map +1 -0
  208. package/dist/payment/validator.js +81 -0
  209. package/dist/payment/validator.js.map +1 -0
  210. package/dist/payment-intent/api-endpoint.d.ts +48 -0
  211. package/dist/payment-intent/api-endpoint.d.ts.map +1 -0
  212. package/dist/payment-intent/api-endpoint.js +94 -0
  213. package/dist/payment-intent/api-endpoint.js.map +1 -0
  214. package/dist/payment-intent/enum/status.d.ts +5 -0
  215. package/dist/payment-intent/enum/status.d.ts.map +1 -0
  216. package/dist/payment-intent/enum/status.js +20 -0
  217. package/dist/payment-intent/enum/status.js.map +1 -0
  218. package/dist/payment-intent/enum/threeds.d.ts +3 -0
  219. package/dist/payment-intent/enum/threeds.d.ts.map +1 -0
  220. package/dist/payment-intent/enum/threeds.js +2 -0
  221. package/dist/payment-intent/enum/threeds.js.map +1 -0
  222. package/dist/payment-intent/model.d.ts +90 -0
  223. package/dist/payment-intent/model.d.ts.map +1 -0
  224. package/dist/payment-intent/model.js +177 -0
  225. package/dist/payment-intent/model.js.map +1 -0
  226. package/dist/payment-intent/repository.d.ts +13 -0
  227. package/dist/payment-intent/repository.d.ts.map +1 -0
  228. package/dist/payment-intent/repository.js +65 -0
  229. package/dist/payment-intent/repository.js.map +1 -0
  230. package/dist/payment-intent/validator.d.ts +4 -0
  231. package/dist/payment-intent/validator.d.ts.map +1 -0
  232. package/dist/payment-intent/validator.js +38 -0
  233. package/dist/payment-intent/validator.js.map +1 -0
  234. package/dist/payout/model.d.ts +7 -0
  235. package/dist/payout/model.d.ts.map +1 -0
  236. package/dist/payout/model.js +6 -0
  237. package/dist/payout/model.js.map +1 -0
  238. package/dist/refund/api-endpoint.d.ts +22 -0
  239. package/dist/refund/api-endpoint.d.ts.map +1 -0
  240. package/dist/refund/api-endpoint.js +32 -0
  241. package/dist/refund/api-endpoint.js.map +1 -0
  242. package/dist/refund/enum/refund-status.d.ts +3 -0
  243. package/dist/refund/enum/refund-status.d.ts.map +1 -0
  244. package/dist/refund/enum/refund-status.js +10 -0
  245. package/dist/refund/enum/refund-status.js.map +1 -0
  246. package/dist/refund/model.d.ts +38 -0
  247. package/dist/refund/model.d.ts.map +1 -0
  248. package/dist/refund/model.js +51 -0
  249. package/dist/refund/model.js.map +1 -0
  250. package/dist/refund/repository.d.ts +7 -0
  251. package/dist/refund/repository.d.ts.map +1 -0
  252. package/dist/refund/repository.js +10 -0
  253. package/dist/refund/repository.js.map +1 -0
  254. package/dist/refund/validator.d.ts +4 -0
  255. package/dist/refund/validator.d.ts.map +1 -0
  256. package/dist/refund/validator.js +41 -0
  257. package/dist/refund/validator.js.map +1 -0
  258. package/dist/sepa/api-endpoint.d.ts +19 -0
  259. package/dist/sepa/api-endpoint.d.ts.map +1 -0
  260. package/dist/sepa/api-endpoint.js +25 -0
  261. package/dist/sepa/api-endpoint.js.map +1 -0
  262. package/dist/sepa/model.d.ts +32 -0
  263. package/dist/sepa/model.d.ts.map +1 -0
  264. package/dist/sepa/model.js +53 -0
  265. package/dist/sepa/model.js.map +1 -0
  266. package/dist/sepa/repository.d.ts +7 -0
  267. package/dist/sepa/repository.d.ts.map +1 -0
  268. package/dist/sepa/repository.js +10 -0
  269. package/dist/sepa/repository.js.map +1 -0
  270. package/dist/sepa/validator.d.ts +8 -0
  271. package/dist/sepa/validator.d.ts.map +1 -0
  272. package/dist/sepa/validator.js +47 -0
  273. package/dist/sepa/validator.js.map +1 -0
  274. package/package.json +1 -1
  275. package/reports/base.css +362 -0
  276. package/reports/block-navigation.js +75 -0
  277. package/reports/cobertura-coverage.xml +18 -0
  278. package/reports/favicon.png +0 -0
  279. package/reports/index.html +177 -0
  280. package/reports/junit.xml +25 -0
  281. package/reports/prettify.css +101 -0
  282. package/reports/prettify.js +955 -0
  283. package/reports/sort-arrow-sprite.png +0 -0
  284. package/reports/sorter.js +205 -0
  285. package/.editorconfig +0 -14
  286. package/.gitlab-ci.yml +0 -159
  287. package/.prettierignore +0 -3
  288. package/eslint.config.js +0 -14
  289. package/pnpm-workspace.yaml +0 -19
  290. package/prettier.config.js +0 -3
  291. package/tsconfig.json +0 -50
  292. package/vitest.config.ts +0 -20
@@ -0,0 +1,3 @@
1
+ export declare const ThreeDSEnum: readonly ['required', 'none'];
2
+ export type ThreeDS = (typeof ThreeDSEnum)[number];
3
+ //# sourceMappingURL=threeds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threeds.d.ts","sourceRoot":"","sources":["../../../src/payment-intent/enum/threeds.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,YAAI,UAAU,EAAE,MAAM,CAAU,CAAC;AACzD,MAAM,MAAM,OAAO,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const ThreeDSEnum = ['required', 'none'];
2
+ //# sourceMappingURL=threeds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"threeds.js","sourceRoot":"","sources":["../../../src/payment-intent/enum/threeds.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,UAAU,EAAE,MAAM,CAAU,CAAC"}
@@ -0,0 +1,90 @@
1
+ import { AbstractModel, type ModelData } from '#core/abstract-model.js';
2
+ import type { IdValue } from '#core/common/branded-type.js';
3
+ import type { Currency } from '#payment/enum/currency.js';
4
+ import type { Method } from '#payment/enum/method.js';
5
+ import type { IdPayment, PaymentAmount, PaymentModel } from '#payment/model.js';
6
+ import type { RefundModel } from '#refund/model.js';
7
+ import type { IdAddress } from '../address/model.js';
8
+ import type { IdCard } from '../card/model.js';
9
+ import type { IdCustomer } from '../customer/model.js';
10
+ import type { IdSepa } from '../sepa/model.js';
11
+ import { type PaymentIntentStatus } from './enum/status.js';
12
+ import type { ThreeDS } from './enum/threeds.js';
13
+ export type IdPaymentIntent = IdValue<`pi_${string}`>;
14
+ export declare const idPaymentIntent: (id: string) => IdPaymentIntent;
15
+ export interface PaymentIntentData extends ModelData {
16
+ id: IdPaymentIntent;
17
+ amount: PaymentAmount;
18
+ billingAddress: IdAddress;
19
+ card: IdCard;
20
+ capture: true;
21
+ currency: Currency;
22
+ customer: IdCustomer;
23
+ dateSettlement: Temporal.PlainDate;
24
+ description: string;
25
+ payment: IdPayment;
26
+ metadata: string;
27
+ methodsAllowed: Method[];
28
+ orderId: string;
29
+ origin: string;
30
+ returnUrl: string;
31
+ sepa: IdSepa;
32
+ shippingAddress: IdAddress;
33
+ status: PaymentIntentStatus;
34
+ threeds: ThreeDS;
35
+ url: string;
36
+ uniqueId: string;
37
+ }
38
+ export declare class PaymentIntentModel extends AbstractModel<PaymentIntentData> {
39
+ static regex: RegExp;
40
+ private _paymentPopulated;
41
+ private _refundPopulated;
42
+ private _refundedAmount;
43
+ private _payments;
44
+ private _refunds;
45
+ isFailed(): boolean | undefined;
46
+ isNotFailed(): boolean;
47
+ isNotSuccess(): boolean;
48
+ isPaymentPopulated(): boolean;
49
+ isRefundPopulated(): boolean;
50
+ isSuccess(): boolean | undefined;
51
+ populatePayments(payments: PaymentModel[]): void;
52
+ populateRefunds(refunds: RefundModel[]): void;
53
+ get amount(): PaymentAmount | undefined;
54
+ get billingAddress(): IdAddress | undefined;
55
+ get card(): IdCard | undefined;
56
+ get currency(): "aud" | "cad" | "chf" | "dkk" | "eur" | "gbp" | "nok" | "pln" | "sek" | "usd" | undefined;
57
+ get customer(): IdCustomer | undefined;
58
+ get dateSettlement(): Temporal.PlainDate | undefined;
59
+ get description(): string | undefined;
60
+ get methodsAllowed(): ("card" | "sepa")[] | undefined;
61
+ get orderId(): string | undefined;
62
+ get origin(): string | undefined;
63
+ get payments(): PaymentModel[];
64
+ get refundableAmount(): number;
65
+ get refundedAmount(): number;
66
+ get refunds(): RefundModel[];
67
+ get returnUrl(): string | undefined;
68
+ get sepa(): IdSepa | undefined;
69
+ get shippingAddress(): IdAddress | undefined;
70
+ get status(): "authorized" | "canceled" | "captured" | "processing" | "require_authentication" | "require_authorization" | "require_payment_method" | "unpaid" | undefined;
71
+ get threeDS(): "none" | "required" | undefined;
72
+ get uniqueId(): string | undefined;
73
+ get url(): string | undefined;
74
+ setAmount(amount: PaymentAmount): this;
75
+ setBillingAddress(address: IdAddress): this;
76
+ setCard(card: IdCard): this;
77
+ setCapture(capture: boolean): this;
78
+ setCurrency(currency: Currency): this;
79
+ setCustomer(customer: IdCustomer): this;
80
+ setDateSettlement(dateSettlement: Temporal.PlainDate): this;
81
+ setDescription(description: string): this;
82
+ setMethodsAllowed(methodsAllowed: Method[]): this;
83
+ setMetadata(metadata: string): this;
84
+ setOrderId(orderId: string): this;
85
+ setReturnUrl(returnUrl: string): this;
86
+ setSepa(sepa: IdSepa): this;
87
+ setShippingAddress(shippingAddress: IdAddress): this;
88
+ setUniqueId(uniqueId: string): this;
89
+ }
90
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/payment-intent/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAChF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,mBAAmB,EAAyD,MAAM,kBAAkB,CAAC;AACnH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEjD,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,MAAM,EAAE,CAAC,CAAC;AACtD,eAAO,MAAM,eAAe,OAAQ,MAAM,oBAA8D,CAAC;AAEzG,MAAM,WAAW,iBAAkB,SAAQ,SAAS;IAClD,EAAE,EAAE,eAAe,CAAC;IACpB,MAAM,EAAE,aAAa,CAAC;IACtB,cAAc,EAAE,SAAS,CAAC;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,IAAI,CAAC;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,E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B;IAED,IAAI,cAAc,WAKjB;IAED,IAAI,OAAO,kBAEV;IAED,IAAI,SAAS,uBAEZ;IAED,IAAI,IAAI,uBAEP;IAED,IAAI,eAAe,0BAElB;IAED,IAAI,MAAM,iKAET;IAED,IAAI,OAAO,oCAEV;IAED,IAAI,QAAQ,uBAEX;IAED,IAAI,GAAG,uBAEN;IAMD,SAAS,CAAC,MAAM,EAAE,aAAa,QAG9B;IAED,iBAAiB,CAAC,OAAO,EAAE,SAAS,QAGnC;IAED,OAAO,CAAC,IAAI,EAAE,MAAM,QAGnB;IAED,UAAU,CAAC,OAAO,EAAE,OAAO,QAK1B;IAED,WAAW,CAAC,QAAQ,EAAE,QAAQ,QAG7B;IAED,WAAW,CAAC,QAAQ,EAAE,UAAU,QAG/B;IAED,iBAAiB,CAAC,cAAc,EAAE,QAAQ,CAAC,SAAS,QAGnD;IAED,cAAc,CAAC,WAAW,EAAE,MAAM,QAGjC;IAED,iBAAiB,CAAC,cAAc,EAAE,MAAM,EAAE,QAGzC;IAED,WAAW,CAAC,QAAQ,EAAE,MAAM,QAG3B;IAED,UAAU,CAAC,OAAO,EAAE,MAAM,QAGzB;IAED,YAAY,CAAC,SAAS,EAAE,MAAM,QAG7B;IAED,OAAO,CAAC,IAAI,EAAE,MAAM,QAGnB;IAED,kBAAkB,CAAC,eAAe,EAAE,SAAS,QAG5C;IAED,WAAW,CAAC,QAAQ,EAAE,MAAM,QAG3B;CAGF"}
@@ -0,0 +1,177 @@
1
+ import { AbstractModel } from '#core/abstract-model.js';
2
+ import { validateID } from '#core/common/id-validator.js';
3
+ import { StancerError } from '#core/error/base-error.js';
4
+ import { failedPaymentIntentStatus, succeedPaymentIntentStatus } from './enum/status.js';
5
+ export const idPaymentIntent = (id) => validateID(id, PaymentIntentModel.regex);
6
+ export class PaymentIntentModel extends AbstractModel {
7
+ static regex = /^pi_[a-zA-Z0-9]{24}$/;
8
+ _paymentPopulated = false;
9
+ _refundPopulated = false;
10
+ _refundedAmount = 0;
11
+ _payments = [];
12
+ _refunds = [];
13
+ //#region Methods
14
+ isFailed() {
15
+ return this.status && failedPaymentIntentStatus.includes(this.status);
16
+ }
17
+ isNotFailed() {
18
+ return !this.isFailed();
19
+ }
20
+ isNotSuccess() {
21
+ return !this.isSuccess();
22
+ }
23
+ isPaymentPopulated() {
24
+ return this._paymentPopulated;
25
+ }
26
+ isRefundPopulated() {
27
+ return this._refundPopulated;
28
+ }
29
+ isSuccess() {
30
+ return this.status && succeedPaymentIntentStatus.includes(this.status);
31
+ }
32
+ populatePayments(payments) {
33
+ this._paymentPopulated = true;
34
+ this._payments = payments;
35
+ }
36
+ populateRefunds(refunds) {
37
+ this._refundPopulated = true;
38
+ this._refundedAmount = refunds.reduce((prev, curr) => prev + (curr.amount ?? 0), 0);
39
+ this._refunds = refunds;
40
+ }
41
+ //#endregion
42
+ //#region Getters
43
+ get amount() {
44
+ return this._data.amount;
45
+ }
46
+ get billingAddress() {
47
+ return this._data.billingAddress;
48
+ }
49
+ get card() {
50
+ return this._data.card;
51
+ }
52
+ get currency() {
53
+ return this._data.currency;
54
+ }
55
+ get customer() {
56
+ return this._data.customer;
57
+ }
58
+ get dateSettlement() {
59
+ return this._data.dateSettlement;
60
+ }
61
+ get description() {
62
+ return this._data.description;
63
+ }
64
+ get methodsAllowed() {
65
+ return this._data.methodsAllowed;
66
+ }
67
+ get orderId() {
68
+ return this._data.orderId;
69
+ }
70
+ get origin() {
71
+ return this._data.origin;
72
+ }
73
+ get payments() {
74
+ return this._payments;
75
+ }
76
+ get refundableAmount() {
77
+ if (!this.amount || !this.id) {
78
+ throw new StancerError('Refunds must be populated before accessing refundableAmount.');
79
+ }
80
+ return this.amount - this.refundedAmount;
81
+ }
82
+ get refundedAmount() {
83
+ if (!this.isRefundPopulated()) {
84
+ throw new StancerError('Refunds must be populated before accessing refundedAmount.');
85
+ }
86
+ return this._refundedAmount;
87
+ }
88
+ get refunds() {
89
+ return this._refunds;
90
+ }
91
+ get returnUrl() {
92
+ return this._data.returnUrl;
93
+ }
94
+ get sepa() {
95
+ return this._data.sepa;
96
+ }
97
+ get shippingAddress() {
98
+ return this._data.shippingAddress;
99
+ }
100
+ get status() {
101
+ return this._data.status;
102
+ }
103
+ get threeDS() {
104
+ return this._data.threeds;
105
+ }
106
+ get uniqueId() {
107
+ return this._data.uniqueId;
108
+ }
109
+ get url() {
110
+ return this._data.url;
111
+ }
112
+ //#endregion
113
+ //#region Setters
114
+ setAmount(amount) {
115
+ this._data.amount = amount;
116
+ return this;
117
+ }
118
+ setBillingAddress(address) {
119
+ this._data.billingAddress = address;
120
+ return this;
121
+ }
122
+ setCard(card) {
123
+ this._data.card = card;
124
+ return this;
125
+ }
126
+ setCapture(capture) {
127
+ if (capture === true) {
128
+ this._data.capture = capture;
129
+ }
130
+ return this;
131
+ }
132
+ setCurrency(currency) {
133
+ this._data.currency = currency;
134
+ return this;
135
+ }
136
+ setCustomer(customer) {
137
+ this._data.customer = customer;
138
+ return this;
139
+ }
140
+ setDateSettlement(dateSettlement) {
141
+ this._data.dateSettlement = dateSettlement;
142
+ return this;
143
+ }
144
+ setDescription(description) {
145
+ this._data.description = description;
146
+ return this;
147
+ }
148
+ setMethodsAllowed(methodsAllowed) {
149
+ this._data.methodsAllowed = methodsAllowed;
150
+ return this;
151
+ }
152
+ setMetadata(metadata) {
153
+ this._data.metadata = metadata;
154
+ return this;
155
+ }
156
+ setOrderId(orderId) {
157
+ this._data.orderId = orderId;
158
+ return this;
159
+ }
160
+ setReturnUrl(returnUrl) {
161
+ this._data.returnUrl = returnUrl;
162
+ return this;
163
+ }
164
+ setSepa(sepa) {
165
+ this._data.sepa = sepa;
166
+ return this;
167
+ }
168
+ setShippingAddress(shippingAddress) {
169
+ this._data.shippingAddress = shippingAddress;
170
+ return this;
171
+ }
172
+ setUniqueId(uniqueId) {
173
+ this._data.uniqueId = uniqueId;
174
+ return this;
175
+ }
176
+ }
177
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3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SAAS,CAAC;QACjC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CAAC,IAAY;QAClB,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,kBAAkB,CAAC,eAA0B;QAC3C,IAAI,CAAC,KAAK,CAAC,eAAe,GAAG,eAAe,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,WAAW,CAAC,QAAgB;QAC1B,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;CAGF"}
@@ -0,0 +1,13 @@
1
+ import { AbstractRepository, type Repository } from '#core/abstract-repository.js';
2
+ import { type RefundAmount } from '#refund/model.js';
3
+ import { PaymentIntentApiEndpoint } from './api-endpoint.js';
4
+ import { type PaymentIntentData, PaymentIntentModel } from './model.js';
5
+ export declare class PaymentIntentRepository extends AbstractRepository<PaymentIntentData, PaymentIntentModel> implements Repository<PaymentIntentData, PaymentIntentModel> {
6
+ protected endpoint: PaymentIntentApiEndpoint;
7
+ constructor(endpoint?: PaymentIntentApiEndpoint);
8
+ capture(paymentIntent: PaymentIntentModel): Promise<void>;
9
+ getPayments(paymentIntent: PaymentIntentModel): Promise<import("../payment/model.js").PaymentModel[]>;
10
+ getRefunds(paymentIntent: PaymentIntentModel): Promise<import("#refund/model.js").RefundModel[]>;
11
+ refund(paymentIntent: PaymentIntentModel, amount?: RefundAmount): Promise<PaymentIntentModel>;
12
+ }
13
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.d.ts","sourceRoot":"","sources":["../../src/payment-intent/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,KAAK,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,KAAK,YAAY,EAAgB,MAAM,kBAAkB,CAAC;AAEnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,KAAK,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAGxE,qBAAa,uBACX,SAAQ,kBAAkB,CAAC,iBAAiB,EAAE,kBAAkB,CAChE,YAAW,UAAU,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;IAE5D,UAAmB,QAAQ,EAAE,wBAAwB,CAAC;IAEtD,YAAY,QAAQ,CAAC,EAAE,wBAAwB,EAQ9C;IAEY,OAAO,CAAC,aAAa,EAAE,kBAAkB,iBAUrD;IAEY,WAAW,CAAC,aAAa,EAAE,kBAAkB,yDAQzD;IAEY,UAAU,CAAC,aAAa,EAAE,kBAAkB,qDAQxD;IAEY,MAAM,CAAC,aAAa,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,YAAY,+BA2B3E;CACF"}
@@ -0,0 +1,65 @@
1
+ import { AbstractRepository } from '#core/abstract-repository.js';
2
+ import { StancerValidationError } from '#core/error/validation-error.js';
3
+ import { refundAmount } from '#refund/model.js';
4
+ import { PaymentIntentApiEndpoint } from './api-endpoint.js';
5
+ import { PaymentIntentModel } from './model.js';
6
+ import { PaymentIntentValidator } from './validator.js';
7
+ export class PaymentIntentRepository extends AbstractRepository {
8
+ endpoint;
9
+ constructor(endpoint) {
10
+ const PIendpoint = endpoint ?? new PaymentIntentApiEndpoint();
11
+ super({
12
+ endpoint: PIendpoint,
13
+ validator: PaymentIntentValidator,
14
+ model: PaymentIntentModel,
15
+ });
16
+ this.endpoint = PIendpoint;
17
+ }
18
+ async capture(paymentIntent) {
19
+ if (!paymentIntent.id) {
20
+ throw new StancerValidationError('PaymentIntent must be populated before calling capture method');
21
+ }
22
+ if (paymentIntent.status !== 'authorized') {
23
+ throw new StancerValidationError('PaymentIntent must be authorize to be captured');
24
+ }
25
+ await this.endpoint.capture(paymentIntent.id);
26
+ }
27
+ async getPayments(paymentIntent) {
28
+ if (paymentIntent.id === undefined) {
29
+ throw new StancerValidationError('PaymentIntent must be populated before calling getPayments method');
30
+ }
31
+ const payments = await this.endpoint.payments(paymentIntent.id);
32
+ paymentIntent.populatePayments(payments);
33
+ return payments;
34
+ }
35
+ async getRefunds(paymentIntent) {
36
+ if (paymentIntent.id === undefined) {
37
+ throw new StancerValidationError('PaymentIntent must be populated before calling getRefunds method');
38
+ }
39
+ const refunds = await this.endpoint.refunds(paymentIntent.id);
40
+ paymentIntent.populateRefunds(refunds);
41
+ return refunds;
42
+ }
43
+ async refund(paymentIntent, amount) {
44
+ if (!paymentIntent.amount || !paymentIntent.id) {
45
+ throw new StancerValidationError('PaymentIntent must be populated before calling refund method');
46
+ }
47
+ if (paymentIntent.isNotSuccess()) {
48
+ throw new StancerValidationError('PaymentIntent must be successful to be refunded');
49
+ }
50
+ if (!paymentIntent.isRefundPopulated()) {
51
+ await this.getRefunds(paymentIntent);
52
+ }
53
+ const refundingAmount = refundAmount(amount ?? paymentIntent.amount);
54
+ if (refundingAmount > paymentIntent.amount || refundingAmount > paymentIntent.refundableAmount) {
55
+ throw new StancerValidationError(`You are trying to refund ${refundingAmount} it's ${refundingAmount - paymentIntent.refundableAmount} more than possible ${paymentIntent.refundableAmount}.`);
56
+ }
57
+ if (paymentIntent.status !== 'captured' && Number(refundingAmount) !== Number(paymentIntent.amount)) {
58
+ throw new StancerValidationError(`You cannot partially refund a payment intent that isn't captured`);
59
+ }
60
+ const newData = await this.endpoint.refund(paymentIntent.id, refundingAmount);
61
+ paymentIntent.dataTrackMutations(newData);
62
+ return paymentIntent;
63
+ }
64
+ }
65
+ //# sourceMappingURL=repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.js","sourceRoot":"","sources":["../../src/payment-intent/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmB,MAAM,8BAA8B,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AACzE,OAAO,EAAqB,YAAY,EAAE,MAAM,kBA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AAC;QAED,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC;QAC9E,aAAa,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,aAAa,CAAC;IACvB,CAAC;CACF"}
@@ -0,0 +1,4 @@
1
+ import { type Validator } from '#core/validator.js';
2
+ import { type PaymentIntentData } from './model.js';
3
+ export declare const PaymentIntentValidator: Validator<PaymentIntentData>;
4
+ //# sourceMappingURL=validator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/payment-intent/validator.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,SAAS,EAKf,MAAM,oBAAoB,CAAC;AAW5B,OAAO,EAAwB,KAAK,iBAAiB,EAAsB,MAAM,YAAY,CAAC;AAE9F,eAAO,MAAM,sBAAsB,EAAE,SAAS,CAAC,iBAAiB,CAwB/D,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { IdValidator } from '#core/common/id-validator.js';
2
+ import { createdAtValidator, enumValidator, goldilocksValidator, plainDateValidator, } from '#core/validator.js';
3
+ import { CurrencyEnum } from '#payment/enum/currency.js';
4
+ import { PaymentModel } from '#payment/model.js';
5
+ import { amountValidator, captureValidator, methodsAllowedValidator } from '#payment/validator.js';
6
+ import { AddressModel } from '../address/model.js';
7
+ import { CardModel } from '../card/model.js';
8
+ import { CustomerModel } from '../customer/model.js';
9
+ import { SepaModel } from '../sepa/model.js';
10
+ import { PaymentIntentStatusEnum } from './enum/status.js';
11
+ import { ThreeDSEnum } from './enum/threeds.js';
12
+ import { PaymentIntentModel } from './model.js';
13
+ export const PaymentIntentValidator = {
14
+ id: IdValidator(PaymentIntentModel.regex),
15
+ amount: amountValidator,
16
+ billingAddress: IdValidator(AddressModel.regex),
17
+ card: IdValidator(CardModel.regex),
18
+ capture: captureValidator,
19
+ createdAt: createdAtValidator,
20
+ currency: enumValidator(CurrencyEnum),
21
+ customer: IdValidator(CustomerModel.regex),
22
+ dateSettlement: plainDateValidator('dateSettlement'),
23
+ deleted: true,
24
+ description: goldilocksValidator('description', { min: 1, max: 64 }),
25
+ metadata: true,
26
+ methodsAllowed: methodsAllowedValidator,
27
+ orderId: goldilocksValidator('orderId', { min: 1, max: 36 }),
28
+ origin: true,
29
+ payment: IdValidator(PaymentModel.regex),
30
+ returnUrl: goldilocksValidator('returnUrl', { min: 1, max: 2048 }),
31
+ sepa: IdValidator(SepaModel.regex),
32
+ shippingAddress: IdValidator(AddressModel.regex),
33
+ status: enumValidator(PaymentIntentStatusEnum, false),
34
+ threeds: enumValidator(ThreeDSEnum, false),
35
+ uniqueId: goldilocksValidator('uniqueId', { min: 1, max: 36 }),
36
+ url: goldilocksValidator('url', { min: 1, max: 2048 }),
37
+ };
38
+ //# sourceMappingURL=validator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validator.js","sourceRoot":"","sources":["../../src/payment-intent/validator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAEL,kBAAkB,EAClB,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAkB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAEnG,OAAO,EAAE,YAAY,EAAkB,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAe,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAmB,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAe,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,C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AC1C,QAAQ,EAAE,mBAAmB,CAAC,UAAU,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;IAC9D,GAAG,EAAE,mBAAmB,CAAC,KAAK,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;CACvD,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IdValue } from '#core/common/branded-type.js';
2
+ export type IdPayout = IdValue<`pout_${string}`>;
3
+ export declare const IdPayout: (id: string) => IdPayout;
4
+ export declare class PayoutModel {
5
+ static regex: RegExp;
6
+ }
7
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/payout/model.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,8BAA8B,CAAC;AAG5D,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,MAAM,EAAE,CAAC,CAAC;AACjD,eAAO,MAAM,QAAQ,OAAQ,MAAM,aAAgD,CAAC;AACpF,qBAAa,WAAW;IACtB,MAAM,CAAC,KAAK,SAA4B;CACzC"}
@@ -0,0 +1,6 @@
1
+ import { validateID } from '#core/common/id-validator.js';
2
+ export const IdPayout = (id) => validateID(id, PayoutModel.regex);
3
+ export class PayoutModel {
4
+ static regex = /^pout_[a-zA-Z0-9]{24}$/;
5
+ }
6
+ //# sourceMappingURL=model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/payout/model.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAG1D,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,UAAU,CAAW,EAAE,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AACpF,MAAM,OAAO,WAAW;IACtB,MAAM,CAAC,KAAK,GAAG,wBAAwB,CAAC;CACzC"}
@@ -0,0 +1,22 @@
1
+ import { ApiEndpoint } from '#api/abstract-api-endpoint.js';
2
+ import { type IdPayment } from '#payment/model.js';
3
+ import { type IdPaymentIntent } from '../payment-intent/model.js';
4
+ import { type IdPayout } from '../payout/model.js';
5
+ import { type IdRefund, type RefundAmount, type RefundData } from './model.js';
6
+ export declare class RefundApiEndpoint extends ApiEndpoint<RefundData> {
7
+ _handler: {
8
+ createdAt: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.Instant>;
9
+ deleted: import("#core/common/handler/handler.js").Handler<boolean>;
10
+ id: import("#core/common/handler/handler.js").Handler<IdRefund>;
11
+ amount: import("#core/common/handler/handler.js").Handler<RefundAmount>;
12
+ currency: import("#core/common/handler/handler.js").Handler<"aud" | "cad" | "chf" | "dkk" | "eur" | "gbp" | "nok" | "pln" | "sek" | "usd">;
13
+ dateBank: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.PlainDate>;
14
+ dateRefund: import("#core/common/handler/handler.js").Handler<import("temporal-polyfill").Temporal.PlainDate>;
15
+ payment: import("#core/common/handler/handler.js").Handler<IdPayment>;
16
+ paymentIntent: import("#core/common/handler/handler.js").Handler<IdPaymentIntent>;
17
+ payout: import("#core/common/handler/handler.js").Handler<IdPayout>;
18
+ status: import("#core/common/handler/handler.js").Handler<"awaiting_approval" | "failed" | "not_honored" | "payment_canceled" | "refund_sent" | "refunded" | "to_refund">;
19
+ };
20
+ constructor();
21
+ }
22
+ //# sourceMappingURL=api-endpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-endpoint.d.ts","sourceRoot":"","sources":["../../src/refund/api-endpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAe,MAAM,+BAA+B,CAAC;AAMzE,OAAO,EAAE,KAAK,SAAS,EAAgB,MAAM,mBAAmB,CAAC;AAEjE,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,KAAK,QAAQ,EAAe,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAe,MAAM,YAAY,CAAC;AAE5F,qBAAa,iBAAkB,SAAQ,WAAW,CAAC,UAAU,CAAC;IACrD,QAAQ;;;;;;;;;;;;MAWb;IACF,cAKC;CACF"}
@@ -0,0 +1,32 @@
1
+ import { ApiEndpoint, baseHandler } from '#api/abstract-api-endpoint.js';
2
+ import { RFC9557Handler } from '#core/common/handler/date-handler.js';
3
+ import { enumHandler } from '#core/common/handler/enum-handler.js';
4
+ import { defaultHandler } from '#core/common/handler/handler.js';
5
+ import { IdHandler } from '#core/common/handler/id-handler.js';
6
+ import { CurrencyEnum } from '#payment/enum/currency.js';
7
+ import { PaymentModel } from '#payment/model.js';
8
+ import { PaymentIntentModel } from '../payment-intent/model.js';
9
+ import { PayoutModel } from '../payout/model.js';
10
+ import { RefundStatusEnum } from './enum/refund-status.js';
11
+ import { RefundModel } from './model.js';
12
+ export class RefundApiEndpoint extends ApiEndpoint {
13
+ _handler = {
14
+ ...baseHandler('created'),
15
+ id: IdHandler(RefundModel.regex),
16
+ amount: defaultHandler('number', { postRequired: true }),
17
+ currency: enumHandler(CurrencyEnum, { postable: false }),
18
+ dateBank: RFC9557Handler({ postable: false, patchable: false }),
19
+ dateRefund: RFC9557Handler({ postable: false, patchable: false }),
20
+ payment: IdHandler(PaymentModel.regex, { postRequired: true }),
21
+ paymentIntent: IdHandler(PaymentIntentModel.regex, { postable: false, patchable: false }),
22
+ payout: IdHandler(PayoutModel.regex, { postable: false, patchable: false }),
23
+ status: enumHandler(RefundStatusEnum, { postable: false }),
24
+ };
25
+ constructor() {
26
+ super({
27
+ name: 'refunds',
28
+ patchable: false,
29
+ });
30
+ }
31
+ }
32
+ //# sourceMappingURL=api-endpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-endpoint.js","sourceRoot":"","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AAkB,kBAAkB,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QAC1G,MAAM,EAAE,SAAS,CAAW,WAAW,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;QACrF,MAAM,EAAE,WAAW,CAAC,gBAAgB,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;KAC3D,CAAC;IACF;QACE,KAAK,CAAC;YACJ,IAAI,EAAE,SAAS;YACf,SAAS,EAAE,KAAK;SACjB,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export declare const RefundStatusEnum: readonly ['to_refund', 'refund_sent', 'refunded', 'not_honored', 'payment_canceled', 'failed', 'awaiting_approval'];
2
+ export type RefundStatus = (typeof RefundStatusEnum)[number];
3
+ //# sourceMappingURL=refund-status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refund-status.d.ts","sourceRoot":"","sources":["../../../src/refund/enum/refund-status.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,YAC3B,WAAW,EACX,aAAa,EACb,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,mBAAmB,CACX,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ export const RefundStatusEnum = [
2
+ 'to_refund',
3
+ 'refund_sent',
4
+ 'refunded',
5
+ 'not_honored',
6
+ 'payment_canceled',
7
+ 'failed',
8
+ 'awaiting_approval',
9
+ ];
10
+ //# sourceMappingURL=refund-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refund-status.js","sourceRoot":"","sources":["../../../src/refund/enum/refund-status.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,WAAW;IACX,aAAa;IACb,UAAU;IACV,aAAa;IACb,kBAAkB;IAClB,QAAQ;IACR,mBAAmB;CACX,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { Temporal } from 'temporal-polyfill';
2
+ import { AbstractModel, type ModelType } from '#core/abstract-model.js';
3
+ import type { Branded, IdValue } from '#core/common/branded-type.js';
4
+ import type { Currency } from '#payment/enum/currency.js';
5
+ import type { IdPayment } from '#payment/model.js';
6
+ import type { IdPaymentIntent } from '../payment-intent/model.js';
7
+ import type { IdPayout } from '../payout/model.js';
8
+ import type { RefundStatus } from './enum/refund-status.js';
9
+ export type IdRefund = IdValue<`refd_${string}`>;
10
+ export declare const idRefund: (id: string) => IdRefund;
11
+ export type RefundAmount = Branded<number, 'refundAmount'>;
12
+ export declare const isRefundAmount: (value: number) => value is RefundAmount;
13
+ export declare const refundAmount: (value: number) => RefundAmount;
14
+ export interface RefundData extends ModelType {
15
+ id: IdRefund;
16
+ amount: RefundAmount;
17
+ currency: Currency;
18
+ dateBank: Temporal.PlainDate;
19
+ dateRefund: Temporal.PlainDate;
20
+ payment: IdPayment;
21
+ paymentIntent: IdPaymentIntent;
22
+ payout: IdPayout;
23
+ status: RefundStatus;
24
+ }
25
+ export declare class RefundModel extends AbstractModel<RefundData> {
26
+ static regex: RegExp;
27
+ get amount(): RefundAmount | undefined;
28
+ get currency(): "aud" | "cad" | "chf" | "dkk" | "eur" | "gbp" | "nok" | "pln" | "sek" | "usd" | undefined;
29
+ get dateBank(): Temporal.PlainDate | undefined;
30
+ get dateRefund(): Temporal.PlainDate | undefined;
31
+ get payment(): IdPayment | undefined;
32
+ get paymentIntent(): IdPaymentIntent | undefined;
33
+ get payout(): IdPayout | undefined;
34
+ get status(): "awaiting_approval" | "failed" | "not_honored" | "payment_canceled" | "refund_sent" | "refunded" | "to_refund" | undefined;
35
+ setAmount(value: RefundAmount): this;
36
+ setPayment(value: IdPayment): this;
37
+ }
38
+ //# sourceMappingURL=model.d.ts.map
@@ -0,0 +1 @@
1
+ {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