@endora-commerce/mod-payment-methods 0.100.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 (107) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +60 -0
  3. package/dist/admin/api/payment-methods-client.d.ts +65 -0
  4. package/dist/admin/api/payment-methods-client.d.ts.map +1 -0
  5. package/dist/admin/api/payment-methods-client.js +39 -0
  6. package/dist/admin/api/payment-methods-client.js.map +1 -0
  7. package/dist/admin/index.d.ts +35 -0
  8. package/dist/admin/index.d.ts.map +1 -0
  9. package/dist/admin/index.js +37 -0
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/admin/pages/PaymentMethodsPage.d.ts +9 -0
  12. package/dist/admin/pages/PaymentMethodsPage.d.ts.map +1 -0
  13. package/dist/admin/pages/PaymentMethodsPage.js +228 -0
  14. package/dist/admin/pages/PaymentMethodsPage.js.map +1 -0
  15. package/dist/admin/renderers/registry.d.ts +15 -0
  16. package/dist/admin/renderers/registry.d.ts.map +1 -0
  17. package/dist/admin/renderers/registry.js +18 -0
  18. package/dist/admin/renderers/registry.js.map +1 -0
  19. package/dist/backend/commands/payment-method.commands.d.ts +86 -0
  20. package/dist/backend/commands/payment-method.commands.d.ts.map +1 -0
  21. package/dist/backend/commands/payment-method.commands.js +168 -0
  22. package/dist/backend/commands/payment-method.commands.js.map +1 -0
  23. package/dist/backend/demo/reset.d.ts +13 -0
  24. package/dist/backend/demo/reset.d.ts.map +1 -0
  25. package/dist/backend/demo/reset.js +13 -0
  26. package/dist/backend/demo/reset.js.map +1 -0
  27. package/dist/backend/demo/rows.d.ts +31 -0
  28. package/dist/backend/demo/rows.d.ts.map +1 -0
  29. package/dist/backend/demo/rows.js +50 -0
  30. package/dist/backend/demo/rows.js.map +1 -0
  31. package/dist/backend/demo/seed.d.ts +17 -0
  32. package/dist/backend/demo/seed.d.ts.map +1 -0
  33. package/dist/backend/demo/seed.js +30 -0
  34. package/dist/backend/demo/seed.js.map +1 -0
  35. package/dist/backend/entities/payment-method.entity.d.ts +28 -0
  36. package/dist/backend/entities/payment-method.entity.d.ts.map +1 -0
  37. package/dist/backend/entities/payment-method.entity.js +93 -0
  38. package/dist/backend/entities/payment-method.entity.js.map +1 -0
  39. package/dist/backend/index.d.ts +103 -0
  40. package/dist/backend/index.d.ts.map +1 -0
  41. package/dist/backend/index.js +151 -0
  42. package/dist/backend/index.js.map +1 -0
  43. package/dist/backend/routes.d.ts +55 -0
  44. package/dist/backend/routes.d.ts.map +1 -0
  45. package/dist/backend/routes.js +226 -0
  46. package/dist/backend/routes.js.map +1 -0
  47. package/dist/backend/services/name-resolver.d.ts +12 -0
  48. package/dist/backend/services/name-resolver.d.ts.map +1 -0
  49. package/dist/backend/services/name-resolver.js +19 -0
  50. package/dist/backend/services/name-resolver.js.map +1 -0
  51. package/dist/backend/services/order-status-registry.port.d.ts +57 -0
  52. package/dist/backend/services/order-status-registry.port.d.ts.map +1 -0
  53. package/dist/backend/services/order-status-registry.port.js +53 -0
  54. package/dist/backend/services/order-status-registry.port.js.map +1 -0
  55. package/dist/backend/services/payment-adapter-registry.d.ts +79 -0
  56. package/dist/backend/services/payment-adapter-registry.d.ts.map +1 -0
  57. package/dist/backend/services/payment-adapter-registry.js +87 -0
  58. package/dist/backend/services/payment-adapter-registry.js.map +1 -0
  59. package/dist/backend/services/payment-method-eligibility.d.ts +24 -0
  60. package/dist/backend/services/payment-method-eligibility.d.ts.map +1 -0
  61. package/dist/backend/services/payment-method-eligibility.js +48 -0
  62. package/dist/backend/services/payment-method-eligibility.js.map +1 -0
  63. package/dist/backend/services/payment-method-read-port.d.ts +25 -0
  64. package/dist/backend/services/payment-method-read-port.d.ts.map +1 -0
  65. package/dist/backend/services/payment-method-read-port.js +57 -0
  66. package/dist/backend/services/payment-method-read-port.js.map +1 -0
  67. package/dist/backend/services/payment-method-reconciler.d.ts +97 -0
  68. package/dist/backend/services/payment-method-reconciler.d.ts.map +1 -0
  69. package/dist/backend/services/payment-method-reconciler.js +164 -0
  70. package/dist/backend/services/payment-method-reconciler.js.map +1 -0
  71. package/dist/backend/services/registry-singleton.d.ts +16 -0
  72. package/dist/backend/services/registry-singleton.d.ts.map +1 -0
  73. package/dist/backend/services/registry-singleton.js +17 -0
  74. package/dist/backend/services/registry-singleton.js.map +1 -0
  75. package/dist/install/index.d.ts +57 -0
  76. package/dist/install/index.d.ts.map +1 -0
  77. package/dist/install/index.js +57 -0
  78. package/dist/install/index.js.map +1 -0
  79. package/dist/manifest.d.ts +169 -0
  80. package/dist/manifest.d.ts.map +1 -0
  81. package/dist/manifest.js +145 -0
  82. package/dist/manifest.js.map +1 -0
  83. package/dist/migrations/20260611T140353_payment_methods_adapter.d.ts +32 -0
  84. package/dist/migrations/20260611T140353_payment_methods_adapter.d.ts.map +1 -0
  85. package/dist/migrations/20260611T140353_payment_methods_adapter.js +76 -0
  86. package/dist/migrations/20260611T140353_payment_methods_adapter.js.map +1 -0
  87. package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.d.ts +46 -0
  88. package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.d.ts.map +1 -0
  89. package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.js +54 -0
  90. package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.js.map +1 -0
  91. package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.d.ts +27 -0
  92. package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.d.ts.map +1 -0
  93. package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.js +44 -0
  94. package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.js.map +1 -0
  95. package/dist/migrations/index.d.ts +32 -0
  96. package/dist/migrations/index.d.ts.map +1 -0
  97. package/dist/migrations/index.js +36 -0
  98. package/dist/migrations/index.js.map +1 -0
  99. package/dist/ports/index.d.ts +157 -0
  100. package/dist/ports/index.d.ts.map +1 -0
  101. package/dist/ports/index.js +2 -0
  102. package/dist/ports/index.js.map +1 -0
  103. package/docs/payment_methods.md +146 -0
  104. package/i18n/en.json +5 -0
  105. package/i18n/pl.json +5 -0
  106. package/package.json +105 -0
  107. package/tailwind.css +14 -0
@@ -0,0 +1,86 @@
1
+ import { type PaymentMethodUpsert, type PaymentReadPort } from '@endora-commerce/contracts';
2
+ import type { Command } from '@endora-commerce/platform/commands';
3
+ import { PaymentMethod } from '../entities/payment-method.entity.js';
4
+ /**
5
+ * Payment-method configuration as Commands — issue #125, Principle XIII.
6
+ *
7
+ * Issue #122 gave these three writes an audit row through
8
+ * `recordAuditFromContext`, which is the lighter of the two sanctioned forms:
9
+ * the row lands, but the write never enters `CommandBus.run`, so it carries no
10
+ * command envelope and there is nowhere for an undo to attach. Which methods a
11
+ * shop offers, what each of them costs a buyer, and which order status a payment
12
+ * result moves an order to is exactly the configuration an operator wants back
13
+ * after a mis-edit, so the write belongs on the bus.
14
+ *
15
+ * **None of the three is `reversible`.** That flag marks the commands wired into
16
+ * feature 054's stored-revert undo (a `RevertRecord` set on a bulk-operation
17
+ * row), and these have no such surface — as `sales_channel.set_default` says for
18
+ * the same reason. The inverse of an edit is the same PUT carrying the previous
19
+ * values, which the audit row's `stateBefore` holds in full; the inverse of a
20
+ * delete is a create, and a delete is refused outright while any payment still
21
+ * references the method.
22
+ */
23
+ /** The audit projection of a payment method — configuration only, no secrets. */
24
+ export declare function paymentMethodAuditState(row: PaymentMethod): Record<string, unknown>;
25
+ export interface UpsertPaymentMethodInput {
26
+ readonly code: string;
27
+ readonly body: PaymentMethodUpsert;
28
+ /** Resolved by the caller from `body.adapter ?? body.kind`, and validated there. */
29
+ readonly adapter: string;
30
+ /**
31
+ * The id of the row carrying this code when the caller looked, or `null` for a
32
+ * creation. It decides the action name and the audited object id, both of
33
+ * which a Command fixes before it runs — so the transaction below refuses the
34
+ * one case that would make them wrong: a row that appeared in between.
35
+ */
36
+ readonly existingId: string | null;
37
+ }
38
+ export interface UpsertPaymentMethodResult {
39
+ readonly method: PaymentMethod;
40
+ /** True when the transaction created the row — the caller binds a new method to a channel. */
41
+ readonly created: boolean;
42
+ }
43
+ export declare function makeUpsertPaymentMethodCommand(input: UpsertPaymentMethodInput): Command<UpsertPaymentMethodResult>;
44
+ /**
45
+ * Availability, as its own Command — feature 076, D-82.
46
+ *
47
+ * Whether a method is offered to buyers used to be writable from five places:
48
+ * this module's upsert and the four gateway rule Commands, each under its own
49
+ * action name, three of which named a gateway. One action name is what makes
50
+ * "who turned this off, and when" one audit query.
51
+ *
52
+ * `before` / `after` are `{ status }` only, not the full
53
+ * {@link paymentMethodAuditState}: the operation changed one field and an audit
54
+ * diff that pretends otherwise is noise in the one report this Command exists
55
+ * to make readable.
56
+ *
57
+ * **Not `reversible`**, for the reason its three siblings above give: that flag
58
+ * marks the commands wired into feature 054's stored-revert undo, and this
59
+ * module has no such surface. The inverse is the same PATCH carrying the other
60
+ * value, which the audit row's `stateBefore` holds in full.
61
+ */
62
+ export declare function makeSetPaymentMethodStatusCommand(id: string, status: 'active' | 'inactive'): Command<PaymentMethod>;
63
+ /**
64
+ * What the delete-guard needs from `payments` (feature 034 FR-003, feature 075).
65
+ *
66
+ * Until the ledger drained, the guard was
67
+ * `select count(*) from "payments" where "payment_method_id" = ?` written here
68
+ * — another module's table read straight out of this module's Command, which
69
+ * compiles and returns rows and so crossed a boundary nothing could see until
70
+ * `check:module-boundary` learned to read SQL (D-87).
71
+ */
72
+ export interface PaymentMethodDeleteGuard {
73
+ /**
74
+ * The payment read model, or `null` when `payments` is not effectively
75
+ * present.
76
+ *
77
+ * An accessor rather than the port itself: `payments` is deactivatable, the
78
+ * answer changes while the process runs, and a port captured once would keep
79
+ * answering after an operator switched it off. The `null` is what the
80
+ * deactivation-consequence ledger renders — see this module's manifest
81
+ * `nonBindingDependencies`.
82
+ */
83
+ readonly paymentRead: () => PaymentReadPort | null;
84
+ }
85
+ export declare function makeDeletePaymentMethodCommand(id: string, guard: PaymentMethodDeleteGuard): Command<void>;
86
+ //# sourceMappingURL=payment-method.commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-method.commands.d.ts","sourceRoot":"","sources":["../../../src/backend/commands/payment-method.commands.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iFAAiF;AACjF,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAanF;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,oFAAoF;IACpF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,8FAA8F;IAC9F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,yBAAyB,CAAC,CAwDpC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iCAAiC,CAC/C,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,QAAQ,GAAG,UAAU,GAC5B,OAAO,CAAC,aAAa,CAAC,CAsBxB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;;;;;;;OASG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,eAAe,GAAG,IAAI,CAAC;CACpD;AAED,wBAAgB,8BAA8B,CAC5C,EAAE,EAAE,MAAM,EACV,KAAK,EAAE,wBAAwB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAsCf"}
@@ -0,0 +1,168 @@
1
+ import { randomUUID } from 'node:crypto';
2
+ import { ERROR_CODES, } from '@endora-commerce/contracts';
3
+ import { HttpError } from '@endora-commerce/platform/http';
4
+ import { PaymentMethod } from '../entities/payment-method.entity.js';
5
+ /**
6
+ * Payment-method configuration as Commands — issue #125, Principle XIII.
7
+ *
8
+ * Issue #122 gave these three writes an audit row through
9
+ * `recordAuditFromContext`, which is the lighter of the two sanctioned forms:
10
+ * the row lands, but the write never enters `CommandBus.run`, so it carries no
11
+ * command envelope and there is nowhere for an undo to attach. Which methods a
12
+ * shop offers, what each of them costs a buyer, and which order status a payment
13
+ * result moves an order to is exactly the configuration an operator wants back
14
+ * after a mis-edit, so the write belongs on the bus.
15
+ *
16
+ * **None of the three is `reversible`.** That flag marks the commands wired into
17
+ * feature 054's stored-revert undo (a `RevertRecord` set on a bulk-operation
18
+ * row), and these have no such surface — as `sales_channel.set_default` says for
19
+ * the same reason. The inverse of an edit is the same PUT carrying the previous
20
+ * values, which the audit row's `stateBefore` holds in full; the inverse of a
21
+ * delete is a create, and a delete is refused outright while any payment still
22
+ * references the method.
23
+ */
24
+ /** The audit projection of a payment method — configuration only, no secrets. */
25
+ export function paymentMethodAuditState(row) {
26
+ return {
27
+ id: row.id,
28
+ code: row.code,
29
+ name: row.name,
30
+ kind: row.kind,
31
+ adapter: row.adapter,
32
+ status: row.status,
33
+ additionalPrice: row.additionalPrice,
34
+ statusOnPending: row.statusOnPending,
35
+ statusOnSuccess: row.statusOnSuccess,
36
+ statusOnFailure: row.statusOnFailure,
37
+ };
38
+ }
39
+ export function makeUpsertPaymentMethodCommand(input) {
40
+ const { body } = input;
41
+ const id = input.existingId ?? randomUUID();
42
+ return {
43
+ action: input.existingId === null ? 'payment_method.create' : 'payment_method.update',
44
+ objectType: 'payment_method',
45
+ objectId: id,
46
+ run: async ({ em }) => {
47
+ let row = await em.findOne(PaymentMethod, { code: input.code });
48
+ if (row !== null && input.existingId === null) {
49
+ throw new HttpError(409, ERROR_CODES.VERSION_CONFLICT, `Payment method "${input.code}" was created by someone else. Reload and try again.`);
50
+ }
51
+ const before = row === null ? null : paymentMethodAuditState(row);
52
+ if (row) {
53
+ row.name = body.name;
54
+ row.kind = body.kind;
55
+ row.adapter = input.adapter;
56
+ if (body.status !== undefined)
57
+ row.status = body.status;
58
+ if (body.additionalPrice !== undefined)
59
+ row.additionalPrice = body.additionalPrice.toFixed(2);
60
+ if (body.statusOnPending !== undefined)
61
+ row.statusOnPending = body.statusOnPending;
62
+ if (body.statusOnSuccess !== undefined)
63
+ row.statusOnSuccess = body.statusOnSuccess;
64
+ if (body.statusOnFailure !== undefined)
65
+ row.statusOnFailure = body.statusOnFailure;
66
+ }
67
+ else {
68
+ row = em.create(PaymentMethod, {
69
+ id,
70
+ code: input.code,
71
+ name: body.name,
72
+ kind: body.kind,
73
+ adapter: input.adapter,
74
+ status: body.status ?? 'active',
75
+ additionalPrice: (body.additionalPrice ?? 0).toFixed(2),
76
+ statusOnPending: body.statusOnPending ?? 'new',
77
+ statusOnSuccess: body.statusOnSuccess ?? 'paid',
78
+ // Feature 085 (FR-003) — a declined payment holds the order, it does
79
+ // not end it. `on_hold` is a system status: it is reachable from every
80
+ // non-terminal status and reaches every status, and an operator can
81
+ // neither delete it nor remove those edges. Still a default, not a
82
+ // constraint (FR-004).
83
+ statusOnFailure: body.statusOnFailure ?? 'on_hold',
84
+ });
85
+ em.persist(row);
86
+ }
87
+ await em.flush();
88
+ return {
89
+ result: { method: row, created: before === null },
90
+ before,
91
+ after: paymentMethodAuditState(row),
92
+ };
93
+ },
94
+ };
95
+ }
96
+ /**
97
+ * Availability, as its own Command — feature 076, D-82.
98
+ *
99
+ * Whether a method is offered to buyers used to be writable from five places:
100
+ * this module's upsert and the four gateway rule Commands, each under its own
101
+ * action name, three of which named a gateway. One action name is what makes
102
+ * "who turned this off, and when" one audit query.
103
+ *
104
+ * `before` / `after` are `{ status }` only, not the full
105
+ * {@link paymentMethodAuditState}: the operation changed one field and an audit
106
+ * diff that pretends otherwise is noise in the one report this Command exists
107
+ * to make readable.
108
+ *
109
+ * **Not `reversible`**, for the reason its three siblings above give: that flag
110
+ * marks the commands wired into feature 054's stored-revert undo, and this
111
+ * module has no such surface. The inverse is the same PATCH carrying the other
112
+ * value, which the audit row's `stateBefore` holds in full.
113
+ */
114
+ export function makeSetPaymentMethodStatusCommand(id, status) {
115
+ return {
116
+ action: 'payment_method.set_status',
117
+ objectType: 'payment_method',
118
+ objectId: id,
119
+ run: async ({ em }) => {
120
+ const row = await em.findOne(PaymentMethod, { id });
121
+ if (!row) {
122
+ throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Payment method not found.');
123
+ }
124
+ // Setting the value it already holds is not a write, so it records no
125
+ // audit row: "no write ⇒ no audit row" is what makes the query above
126
+ // answer "who turned this off" rather than "who last opened the screen".
127
+ if (row.status === status) {
128
+ return { result: row, skipAudit: true };
129
+ }
130
+ const before = { status: row.status };
131
+ row.status = status;
132
+ await em.flush();
133
+ return { result: row, before, after: { status: row.status } };
134
+ },
135
+ };
136
+ }
137
+ export function makeDeletePaymentMethodCommand(id, guard) {
138
+ return {
139
+ action: 'payment_method.delete',
140
+ objectType: 'payment_method',
141
+ objectId: id,
142
+ run: async ({ em }) => {
143
+ const row = await em.findOne(PaymentMethod, { id });
144
+ if (!row) {
145
+ throw new HttpError(404, ERROR_CODES.NOT_FOUND, 'Payment method not found.');
146
+ }
147
+ const paymentRead = guard.paymentRead();
148
+ // Decided before the read, not caught after it: with `payments` off there
149
+ // is no way to tell whether an attempt still points at this method, and
150
+ // deleting on an unanswered question is exactly the orphan FR-003 exists
151
+ // to prevent. Refusing leaves the operator the reversible half — set the
152
+ // method inactive — and leaves every other payment-method write working.
153
+ if (paymentRead === null) {
154
+ throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, 'Cannot delete payment method: the payments module is switched off, so the payments ' +
155
+ 'that may reference it cannot be counted. Switch payments back on, or set this ' +
156
+ 'method\'s status to "inactive" instead.');
157
+ }
158
+ const referencing = await paymentRead.countByPaymentMethod(row.id);
159
+ if (referencing > 0) {
160
+ throw new HttpError(409, ERROR_CODES.VALIDATION_FAILED, `Cannot delete payment method: ${referencing} payment(s) reference it. Set status to "inactive" instead.`);
161
+ }
162
+ const before = paymentMethodAuditState(row);
163
+ await em.removeAndFlush(row);
164
+ return { result: undefined, before, after: null };
165
+ },
166
+ };
167
+ }
168
+ //# sourceMappingURL=payment-method.commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-method.commands.js","sourceRoot":"","sources":["../../../src/backend/commands/payment-method.commands.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACL,WAAW,GAGZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AAErE;;;;;;;;;;;;;;;;;;GAkBG;AAEH,iFAAiF;AACjF,MAAM,UAAU,uBAAuB,CAAC,GAAkB;IACxD,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,MAAM,EAAE,GAAG,CAAC,MAAM;QAClB,eAAe,EAAE,GAAG,CAAC,eAAe;QACpC,eAAe,EAAE,GAAG,CAAC,eAAe;QACpC,eAAe,EAAE,GAAG,CAAC,eAAe;QACpC,eAAe,EAAE,GAAG,CAAC,eAAe;KACrC,CAAC;AACJ,CAAC;AAsBD,MAAM,UAAU,8BAA8B,CAC5C,KAA+B;IAE/B,MAAM,E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AI,CAAC,GAAG,EAAE,CAAC;gBACT,MAAM,IAAI,SAAS,CAAC,GAAG,EAAE,WAAW,CAAC,SAAS,EAAE,2BAA2B,CAAC,CAAC;YAC/E,CAAC;YACD,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;YACxC,0EAA0E;YAC1E,wEAAwE;YACxE,yEAAyE;YACzE,yEAAyE;YACzE,yEAAyE;YACzE,IAAI,WAAW,KAAK,IAAI,EAAE,CAAC;gBACzB,MAAM,IAAI,SAAS,CACjB,GAAG,EACH,WAAW,CAAC,iBAAiB,EAC7B,qFAAqF;oBACnF,gFAAgF;oBAChF,yCAAyC,CAC5C,CAAC;YACJ,CAAC;YACD,MAAM,WAAW,GAAG,MAAM,WAAW,CAAC,oBAAoB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACnE,IAAI,WAAW,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,IAAI,SAAS,CACjB,GAAG,EACH,WAAW,CAAC,iBAAiB,EAC7B,iCAAiC,WAAW,6DAA6D,CAC1G,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,GAAG,uBAAuB,CAAC,GAAG,CAAC,CAAC;YAC5C,MAAM,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;YAC7B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;QACpD,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Withdraw `payment_methods`' demo data (feature 113, T220 — contract §2.5).
3
+ *
4
+ * By the fixed codes `seed` assigns. This replaces `payment_methods`' line in
5
+ * the host's 29-table `truncate … cascade`, and that line was the sharpest of
6
+ * the three: five gateway modules seed their own methods and their adapter
7
+ * rules from migrations, so a truncate of this table took fifteen rows nobody
8
+ * had asked to lose, plus every rule that referenced them through the cascade.
9
+ */
10
+ import type { DemoResetResult, ModuleDemoContext } from '@endora-commerce/contracts';
11
+ import type { ModuleContext } from '@endora-commerce/platform/kernel';
12
+ export declare function resetDemo(context: ModuleDemoContext<ModuleContext>): Promise<DemoResetResult>;
13
+ //# sourceMappingURL=reset.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset.d.ts","sourceRoot":"","sources":["../../../src/backend/demo/reset.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAStE,wBAAsB,SAAS,CAC7B,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,GACxC,OAAO,CAAC,eAAe,CAAC,CAS1B"}
@@ -0,0 +1,13 @@
1
+ import { PaymentMethod } from '../entities/payment-method.entity.js';
2
+ import { DEMO_PAYMENT_METHOD_CODES } from './rows.js';
3
+ export async function resetDemo(context) {
4
+ // command-coverage-ignore: the withdrawal half of the demo data above. Same
5
+ // entry point, same `mustBeNonProduction()` guard, same absence of an
6
+ // operator to attribute the write to (contract §2.7).
7
+ const em = context.ctx.cradle().emFactory();
8
+ const removed = await em.nativeDelete(PaymentMethod, {
9
+ code: { $in: [...DEMO_PAYMENT_METHOD_CODES] },
10
+ });
11
+ return { removed: [{ entity: 'PaymentMethod', count: removed }] };
12
+ }
13
+ //# sourceMappingURL=reset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../src/backend/demo/reset.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AAMtD,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,OAAyC;IAEzC,4EAA4E;IAC5E,sEAAsE;IACtE,sDAAsD;IACtD,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAA4B,CAAC,SAAS,EAAE,CAAC;IACtE,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,YAAY,CAAC,aAAa,EAAE;QACnD,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,GAAG,yBAAyB,CAAC,EAAE;KAC9C,CAAC,CAAC;IACH,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AACpE,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The payment methods this module's demo data creates (feature 113, T220).
3
+ *
4
+ * One place holding the data, imported by both bodies: `seed.ts` creates these
5
+ * rows and `reset.ts` withdraws exactly them, by the `code` they are keyed on
6
+ * (contract §2.5). The values are the host seed's verbatim; the frozen copy
7
+ * that was the parity comparison's reference side went with the corpus at
8
+ * T226, and `test/integration/demo/demo-shop.test.ts`' recorded delta is what
9
+ * holds them now.
10
+ *
11
+ * **The granted credit limit that goes with `credit_limit` is not here**, and
12
+ * it is not an omission: a grant is a row in `credit_limits` against a
13
+ * particular organisation, which is two modules' rows and therefore a
14
+ * composition step (§5.1), not this module's demo data. Until it moves it stays
15
+ * in the host residue beside the demo organisation it is granted to.
16
+ */
17
+ /** One demo payment method, in `PaymentMethod`'s own field names. */
18
+ export interface DemoPaymentMethodRow {
19
+ readonly code: string;
20
+ /** Per-language, covering every shipped language (contract §2.6). */
21
+ readonly name: Readonly<Record<string, string>>;
22
+ readonly kind: 'bank_transfer' | 'pickup' | 'credit_limit' | 'gateway';
23
+ readonly adapter: string;
24
+ readonly statusOnPending: string;
25
+ readonly statusOnSuccess: string;
26
+ readonly statusOnFailure: string;
27
+ }
28
+ export declare const DEMO_PAYMENT_METHOD_ROWS: readonly DemoPaymentMethodRow[];
29
+ /** The codes `reset` withdraws — derived from the rows, never a second list. */
30
+ export declare const DEMO_PAYMENT_METHOD_CODES: readonly string[];
31
+ //# sourceMappingURL=rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../../src/backend/demo/rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,qEAAqE;AACrE,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,qEAAqE;IACrE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,eAAe,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,eAAO,MAAM,wBAAwB,EAAE,SAAS,oBAAoB,EA8BnE,CAAC;AAEF,gFAAgF;AAChF,eAAO,MAAM,yBAAyB,EAAE,SAAS,MAAM,EAEtD,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The payment methods this module's demo data creates (feature 113, T220).
3
+ *
4
+ * One place holding the data, imported by both bodies: `seed.ts` creates these
5
+ * rows and `reset.ts` withdraws exactly them, by the `code` they are keyed on
6
+ * (contract §2.5). The values are the host seed's verbatim; the frozen copy
7
+ * that was the parity comparison's reference side went with the corpus at
8
+ * T226, and `test/integration/demo/demo-shop.test.ts`' recorded delta is what
9
+ * holds them now.
10
+ *
11
+ * **The granted credit limit that goes with `credit_limit` is not here**, and
12
+ * it is not an omission: a grant is a row in `credit_limits` against a
13
+ * particular organisation, which is two modules' rows and therefore a
14
+ * composition step (§5.1), not this module's demo data. Until it moves it stays
15
+ * in the host residue beside the demo organisation it is granted to.
16
+ */
17
+ export const DEMO_PAYMENT_METHOD_ROWS = [
18
+ {
19
+ code: 'bank_transfer',
20
+ name: { 'en-US': 'Bank transfer', 'pl-PL': 'Przelew bankowy' },
21
+ kind: 'bank_transfer',
22
+ adapter: 'bank_transfer',
23
+ statusOnPending: 'new',
24
+ statusOnSuccess: 'paid',
25
+ // Feature 085 (FR-003) — the shipped default; a declined payment holds the
26
+ // order rather than ending it.
27
+ statusOnFailure: 'on_hold',
28
+ },
29
+ {
30
+ // The platform's headline B2B payment path, seeded so a fresh dev
31
+ // environment shows it (feature 080, D5). `credit_limit` has been a
32
+ // first-class `paymentMethodKindSchema` member and a registered adapter all
33
+ // along, and checkout already offers it — but only when an operator has
34
+ // created the row, which no seed did, so the capability read as missing.
35
+ //
36
+ // `statusOnSuccess: 'paid'` is what a settled deferred payment means; the
37
+ // reservation itself is opened inside the placement transaction and the
38
+ // order waits in `new` until the proforma is settled.
39
+ code: 'credit_limit',
40
+ name: { 'en-US': 'Credit limit', 'pl-PL': 'Limit kupiecki' },
41
+ kind: 'credit_limit',
42
+ adapter: 'credit_limit',
43
+ statusOnPending: 'new',
44
+ statusOnSuccess: 'paid',
45
+ statusOnFailure: 'on_hold',
46
+ },
47
+ ];
48
+ /** The codes `reset` withdraws — derived from the rows, never a second list. */
49
+ export const DEMO_PAYMENT_METHOD_CODES = DEMO_PAYMENT_METHOD_ROWS.map((row) => row.code);
50
+ //# sourceMappingURL=rows.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rows.js","sourceRoot":"","sources":["../../../src/backend/demo/rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAcH,MAAM,CAAC,MAAM,wBAAwB,GAAoC;IACvE;QACE,IAAI,EAAE,eAAe;QACrB,IAAI,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,iBAAiB,EAAE;QAC9D,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE,eAAe;QACxB,eAAe,EAAE,KAAK;QACtB,eAAe,EAAE,MAAM;QACvB,2EAA2E;QAC3E,+BAA+B;QAC/B,eAAe,EAAE,SAAS;KAC3B;IACD;QACE,kEAAkE;QAClE,oEAAoE;QACpE,4EAA4E;QAC5E,wEAAwE;QACxE,yEAAyE;QACzE,EAAE;QACF,0EAA0E;QAC1E,wEAAwE;QACxE,sDAAsD;QACtD,IAAI,EAAE,cAAc;QACpB,IAAI,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,gBAAgB,EAAE;QAC5D,IAAI,EAAE,cAAc;QACpB,OAAO,EAAE,cAAc;QACvB,eAAe,EAAE,KAAK;QACtB,eAAe,EAAE,MAAM;QACvB,eAAe,EAAE,SAAS;KAC3B;CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,yBAAyB,GAAsB,wBAAwB,CAAC,GAAG,CACtF,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,CAClB,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * `payment_methods`' demo data (feature 113, T220 — contract §2).
3
+ *
4
+ * The two methods the demo shop checks out with, in the module that owns the
5
+ * table. It writes `payment_methods` and nothing else (§2.1), reads no other
6
+ * module's table and resolves no port (§2.2), so declaring it added no entry to
7
+ * this module's manifest `dependencies` (§2.3) — which matters here more than
8
+ * elsewhere: the `credit_limit` method's usefulness depends on a grant in
9
+ * `credit_limits`, and it would have been easy to reach for that module from
10
+ * this body. The grant is a composition step instead.
11
+ *
12
+ * Idempotent by an existence probe on the natural key (§2.4).
13
+ */
14
+ import type { DemoSeedResult, ModuleDemoContext } from '@endora-commerce/contracts';
15
+ import type { ModuleContext } from '@endora-commerce/platform/kernel';
16
+ export declare function seedDemo(context: ModuleDemoContext<ModuleContext>): Promise<DemoSeedResult>;
17
+ //# sourceMappingURL=seed.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.d.ts","sourceRoot":"","sources":["../../../src/backend/demo/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AACpF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAStE,wBAAsB,QAAQ,CAC5B,OAAO,EAAE,iBAAiB,CAAC,aAAa,CAAC,GACxC,OAAO,CAAC,cAAc,CAAC,CA2BzB"}
@@ -0,0 +1,30 @@
1
+ import { PaymentMethod } from '../entities/payment-method.entity.js';
2
+ import { DEMO_PAYMENT_METHOD_ROWS } from './rows.js';
3
+ export async function seedDemo(context) {
4
+ // command-coverage-ignore: demo data, reached only by `endora demo seed`,
5
+ // whose entry point calls `mustBeNonProduction()` as its first statement and
6
+ // outside every `try` (contract §2.7, §3.3). The guard is the enforcement:
7
+ // this write has no operator, no tenant and no audit reader.
8
+ const em = context.ctx.cradle().emFactory();
9
+ for (const row of DEMO_PAYMENT_METHOD_ROWS) {
10
+ const existing = await em.findOne(PaymentMethod, { code: row.code });
11
+ // Present already: left as it is — see `taxes`' body for why `seed` does
12
+ // not overwrite what an operator may have edited.
13
+ if (existing)
14
+ continue;
15
+ em.create(PaymentMethod, {
16
+ code: row.code,
17
+ name: { ...row.name },
18
+ kind: row.kind,
19
+ adapter: row.adapter,
20
+ statusOnPending: row.statusOnPending,
21
+ statusOnSuccess: row.statusOnSuccess,
22
+ statusOnFailure: row.statusOnFailure,
23
+ });
24
+ }
25
+ await em.flush();
26
+ return {
27
+ created: [{ entity: 'PaymentMethod', count: DEMO_PAYMENT_METHOD_ROWS.length }],
28
+ };
29
+ }
30
+ //# sourceMappingURL=seed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"seed.js","sourceRoot":"","sources":["../../../src/backend/demo/seed.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,aAAa,EAAE,MAAM,sCAAsC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAMrD,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,OAAyC;IAEzC,0EAA0E;IAC1E,6EAA6E;IAC7E,2EAA2E;IAC3E,6DAA6D;IAC7D,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAA4B,CAAC,SAAS,EAAE,CAAC;IAEtE,KAAK,MAAM,GAAG,IAAI,wBAAwB,EAAE,CAAC;QAC3C,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;QACrE,yEAAyE;QACzE,kDAAkD;QAClD,IAAI,QAAQ;YAAE,SAAS;QACvB,EAAE,CAAC,MAAM,CAAC,aAAa,EAAE;YACvB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,IAAI,EAAE,EAAE,GAAG,GAAG,CAAC,IAAI,EAAE;YACrB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,eAAe,EAAE,GAAG,CAAC,eAAe;SACrC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,EAAE,CAAC,KAAK,EAAE,CAAC;IAEjB,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,wBAAwB,CAAC,MAAM,EAAE,CAAC;KAC/E,CAAC;AACJ,CAAC"}
@@ -0,0 +1,28 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * PaymentMethod — kind discriminates the driver (bank_transfer, pickup,
4
+ * credit_limit, gateway). Drivers ship with US2/US6/US7 depending on which
5
+ * payment type they handle.
6
+ */
7
+ export declare class PaymentMethod {
8
+ [OptionalProps]?: 'id' | 'createdAt' | 'updatedAt' | 'status' | 'additionalPrice';
9
+ id: string;
10
+ code: string;
11
+ name: Record<string, string>;
12
+ kind: 'bank_transfer' | 'pickup' | 'credit_limit' | 'gateway';
13
+ /**
14
+ * Adapter registry key (feature 034). Determines which registered
15
+ * PaymentAdapter realises the business logic. Backfilled from `kind`.
16
+ */
17
+ adapter: string;
18
+ status: 'active' | 'inactive';
19
+ /** Flat surcharge in the order currency added when this method is chosen. */
20
+ additionalPrice: string;
21
+ /** Order-status references resolved through the OrderStatusRegistry port. */
22
+ statusOnPending: string;
23
+ statusOnSuccess: string;
24
+ statusOnFailure: string;
25
+ createdAt: Date;
26
+ updatedAt: Date;
27
+ }
28
+ //# sourceMappingURL=payment-method.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-method.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/payment-method.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAItF;;;;GAIG;AACH,qBAEa,aAAa;IACxB,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,WAAW,GAAG,WAAW,GAAG,QAAQ,GAAG,iBAAiB,CAAC;IAGlF,EAAE,EAAE,MAAM,CAAgB;IAI1B,IAAI,EAAG,MAAM,CAAC;IAGd,IAAI,EAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAG9B,IAAI,EAAG,eAAe,GAAG,QAAQ,GAAG,cAAc,GAAG,SAAS,CAAC;IAE/D;;;OAGG;IAEH,OAAO,EAAG,MAAM,CAAC;IAGjB,MAAM,EAAE,QAAQ,GAAG,UAAU,CAAY;IAEzC,6EAA6E;IAE7E,eAAe,EAAE,MAAM,CAAO;IAE9B,6EAA6E;IAE7E,eAAe,EAAG,MAAM,CAAC;IAGzB,eAAe,EAAG,MAAM,CAAC;IAGzB,eAAe,EAAG,MAAM,CAAC;IAGzB,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,93 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, OptionalProps, PrimaryKey, Property, Unique } from '@mikro-orm/core';
11
+ import { GlobalEntity } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ /**
14
+ * PaymentMethod — kind discriminates the driver (bank_transfer, pickup,
15
+ * credit_limit, gateway). Drivers ship with US2/US6/US7 depending on which
16
+ * payment type they handle.
17
+ */
18
+ let PaymentMethod = class PaymentMethod {
19
+ [OptionalProps];
20
+ id = randomUUID();
21
+ code;
22
+ name;
23
+ kind;
24
+ /**
25
+ * Adapter registry key (feature 034). Determines which registered
26
+ * PaymentAdapter realises the business logic. Backfilled from `kind`.
27
+ */
28
+ adapter;
29
+ status = 'active';
30
+ /** Flat surcharge in the order currency added when this method is chosen. */
31
+ additionalPrice = '0';
32
+ /** Order-status references resolved through the OrderStatusRegistry port. */
33
+ statusOnPending;
34
+ statusOnSuccess;
35
+ statusOnFailure;
36
+ createdAt = new Date();
37
+ updatedAt = new Date();
38
+ };
39
+ __decorate([
40
+ PrimaryKey({ type: 'uuid' }),
41
+ __metadata("design:type", String)
42
+ ], PaymentMethod.prototype, "id", void 0);
43
+ __decorate([
44
+ Property({ type: 'string', length: 64 }),
45
+ Unique(),
46
+ __metadata("design:type", String)
47
+ ], PaymentMethod.prototype, "code", void 0);
48
+ __decorate([
49
+ Property({ type: 'json' }),
50
+ __metadata("design:type", Object)
51
+ ], PaymentMethod.prototype, "name", void 0);
52
+ __decorate([
53
+ Property({ type: 'string', length: 32 }),
54
+ __metadata("design:type", String)
55
+ ], PaymentMethod.prototype, "kind", void 0);
56
+ __decorate([
57
+ Property({ type: 'string', length: 64 }),
58
+ __metadata("design:type", String)
59
+ ], PaymentMethod.prototype, "adapter", void 0);
60
+ __decorate([
61
+ Property({ type: 'string', length: 16 }),
62
+ __metadata("design:type", String)
63
+ ], PaymentMethod.prototype, "status", void 0);
64
+ __decorate([
65
+ Property({ type: 'decimal', precision: 14, scale: 2 }),
66
+ __metadata("design:type", String)
67
+ ], PaymentMethod.prototype, "additionalPrice", void 0);
68
+ __decorate([
69
+ Property({ type: 'string', length: 64 }),
70
+ __metadata("design:type", String)
71
+ ], PaymentMethod.prototype, "statusOnPending", void 0);
72
+ __decorate([
73
+ Property({ type: 'string', length: 64 }),
74
+ __metadata("design:type", String)
75
+ ], PaymentMethod.prototype, "statusOnSuccess", void 0);
76
+ __decorate([
77
+ Property({ type: 'string', length: 64 }),
78
+ __metadata("design:type", String)
79
+ ], PaymentMethod.prototype, "statusOnFailure", void 0);
80
+ __decorate([
81
+ Property({ type: 'datetime', onCreate: () => new Date() }),
82
+ __metadata("design:type", Date)
83
+ ], PaymentMethod.prototype, "createdAt", void 0);
84
+ __decorate([
85
+ Property({ type: 'datetime', onUpdate: () => new Date() }),
86
+ __metadata("design:type", Date)
87
+ ], PaymentMethod.prototype, "updatedAt", void 0);
88
+ PaymentMethod = __decorate([
89
+ GlobalEntity(),
90
+ Entity({ tableName: 'payment_methods' })
91
+ ], PaymentMethod);
92
+ export { PaymentMethod };
93
+ //# sourceMappingURL=payment-method.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-method.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/payment-method.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;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