@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.
- package/LICENSE +21 -0
- package/README.md +60 -0
- package/dist/admin/api/payment-methods-client.d.ts +65 -0
- package/dist/admin/api/payment-methods-client.d.ts.map +1 -0
- package/dist/admin/api/payment-methods-client.js +39 -0
- package/dist/admin/api/payment-methods-client.js.map +1 -0
- package/dist/admin/index.d.ts +35 -0
- package/dist/admin/index.d.ts.map +1 -0
- package/dist/admin/index.js +37 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/pages/PaymentMethodsPage.d.ts +9 -0
- package/dist/admin/pages/PaymentMethodsPage.d.ts.map +1 -0
- package/dist/admin/pages/PaymentMethodsPage.js +228 -0
- package/dist/admin/pages/PaymentMethodsPage.js.map +1 -0
- package/dist/admin/renderers/registry.d.ts +15 -0
- package/dist/admin/renderers/registry.d.ts.map +1 -0
- package/dist/admin/renderers/registry.js +18 -0
- package/dist/admin/renderers/registry.js.map +1 -0
- package/dist/backend/commands/payment-method.commands.d.ts +86 -0
- package/dist/backend/commands/payment-method.commands.d.ts.map +1 -0
- package/dist/backend/commands/payment-method.commands.js +168 -0
- package/dist/backend/commands/payment-method.commands.js.map +1 -0
- package/dist/backend/demo/reset.d.ts +13 -0
- package/dist/backend/demo/reset.d.ts.map +1 -0
- package/dist/backend/demo/reset.js +13 -0
- package/dist/backend/demo/reset.js.map +1 -0
- package/dist/backend/demo/rows.d.ts +31 -0
- package/dist/backend/demo/rows.d.ts.map +1 -0
- package/dist/backend/demo/rows.js +50 -0
- package/dist/backend/demo/rows.js.map +1 -0
- package/dist/backend/demo/seed.d.ts +17 -0
- package/dist/backend/demo/seed.d.ts.map +1 -0
- package/dist/backend/demo/seed.js +30 -0
- package/dist/backend/demo/seed.js.map +1 -0
- package/dist/backend/entities/payment-method.entity.d.ts +28 -0
- package/dist/backend/entities/payment-method.entity.d.ts.map +1 -0
- package/dist/backend/entities/payment-method.entity.js +93 -0
- package/dist/backend/entities/payment-method.entity.js.map +1 -0
- package/dist/backend/index.d.ts +103 -0
- package/dist/backend/index.d.ts.map +1 -0
- package/dist/backend/index.js +151 -0
- package/dist/backend/index.js.map +1 -0
- package/dist/backend/routes.d.ts +55 -0
- package/dist/backend/routes.d.ts.map +1 -0
- package/dist/backend/routes.js +226 -0
- package/dist/backend/routes.js.map +1 -0
- package/dist/backend/services/name-resolver.d.ts +12 -0
- package/dist/backend/services/name-resolver.d.ts.map +1 -0
- package/dist/backend/services/name-resolver.js +19 -0
- package/dist/backend/services/name-resolver.js.map +1 -0
- package/dist/backend/services/order-status-registry.port.d.ts +57 -0
- package/dist/backend/services/order-status-registry.port.d.ts.map +1 -0
- package/dist/backend/services/order-status-registry.port.js +53 -0
- package/dist/backend/services/order-status-registry.port.js.map +1 -0
- package/dist/backend/services/payment-adapter-registry.d.ts +79 -0
- package/dist/backend/services/payment-adapter-registry.d.ts.map +1 -0
- package/dist/backend/services/payment-adapter-registry.js +87 -0
- package/dist/backend/services/payment-adapter-registry.js.map +1 -0
- package/dist/backend/services/payment-method-eligibility.d.ts +24 -0
- package/dist/backend/services/payment-method-eligibility.d.ts.map +1 -0
- package/dist/backend/services/payment-method-eligibility.js +48 -0
- package/dist/backend/services/payment-method-eligibility.js.map +1 -0
- package/dist/backend/services/payment-method-read-port.d.ts +25 -0
- package/dist/backend/services/payment-method-read-port.d.ts.map +1 -0
- package/dist/backend/services/payment-method-read-port.js +57 -0
- package/dist/backend/services/payment-method-read-port.js.map +1 -0
- package/dist/backend/services/payment-method-reconciler.d.ts +97 -0
- package/dist/backend/services/payment-method-reconciler.d.ts.map +1 -0
- package/dist/backend/services/payment-method-reconciler.js +164 -0
- package/dist/backend/services/payment-method-reconciler.js.map +1 -0
- package/dist/backend/services/registry-singleton.d.ts +16 -0
- package/dist/backend/services/registry-singleton.d.ts.map +1 -0
- package/dist/backend/services/registry-singleton.js +17 -0
- package/dist/backend/services/registry-singleton.js.map +1 -0
- package/dist/install/index.d.ts +57 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +57 -0
- package/dist/install/index.js.map +1 -0
- package/dist/manifest.d.ts +169 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +145 -0
- package/dist/manifest.js.map +1 -0
- package/dist/migrations/20260611T140353_payment_methods_adapter.d.ts +32 -0
- package/dist/migrations/20260611T140353_payment_methods_adapter.d.ts.map +1 -0
- package/dist/migrations/20260611T140353_payment_methods_adapter.js +76 -0
- package/dist/migrations/20260611T140353_payment_methods_adapter.js.map +1 -0
- package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.d.ts +46 -0
- package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.d.ts.map +1 -0
- package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.js +54 -0
- package/dist/migrations/20260821T084920_payment_methods_failure_status_on_hold.js.map +1 -0
- package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.d.ts +27 -0
- package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.d.ts.map +1 -0
- package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.js +44 -0
- package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.js.map +1 -0
- package/dist/migrations/index.d.ts +32 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +36 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/ports/index.d.ts +157 -0
- package/dist/ports/index.d.ts.map +1 -0
- package/dist/ports/index.js +2 -0
- package/dist/ports/index.js.map +1 -0
- package/docs/payment_methods.md +146 -0
- package/i18n/en.json +5 -0
- package/i18n/pl.json +5 -0
- package/package.json +105 -0
- package/tailwind.css +14 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAA2B,MAAM,4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/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Payment-method adapter framework (feature 034 — Metoda Płatności).
|
|
4
|
+
*
|
|
5
|
+
* Extends the existing `payment_methods` entry into a configurable,
|
|
6
|
+
* adapter-backed payment method and the `payments` row into a richer
|
|
7
|
+
* payment-process record:
|
|
8
|
+
*
|
|
9
|
+
* payment_methods:
|
|
10
|
+
* + adapter — registry key of the adapter realising the logic
|
|
11
|
+
* (backfilled from the existing `kind`)
|
|
12
|
+
* + additional_price — flat surcharge in the order currency
|
|
13
|
+
* + status_on_pending — Order-status reference applied at order creation
|
|
14
|
+
* + status_on_success — Order-status reference applied on a successful payment
|
|
15
|
+
* + status_on_failure — Order-status reference applied on a failed payment
|
|
16
|
+
*
|
|
17
|
+
* payments:
|
|
18
|
+
* + provider_details — adapter/PSP payload captured on receive_payment
|
|
19
|
+
* + failure_reason — populated on a failure outcome
|
|
20
|
+
* + attempt_no — retry sequence per order (1 = first attempt)
|
|
21
|
+
*
|
|
22
|
+
* `status` columns stay plain varchar (no CHECK constraint existed), so the
|
|
23
|
+
* new `failed` payment-process status needs no DDL beyond application code.
|
|
24
|
+
* Seed status mappings reuse the current hard-coded order `status` enum
|
|
25
|
+
* (new / confirmed / cancelled) until the Orders module ships a configurable
|
|
26
|
+
* order-status registry (see research.md R2).
|
|
27
|
+
*/
|
|
28
|
+
export declare class Migration20260611T140353PaymentMethodsAdapter extends Migration {
|
|
29
|
+
up(): Promise<void>;
|
|
30
|
+
down(): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=20260611T140353_payment_methods_adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260611T140353_payment_methods_adapter.d.ts","sourceRoot":"","sources":["../../src/migrations/20260611T140353_payment_methods_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,qBAAa,6CAA8C,SAAQ,SAAS;IAC3D,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAgCnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAgBrC"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Payment-method adapter framework (feature 034 — Metoda Płatności).
|
|
4
|
+
*
|
|
5
|
+
* Extends the existing `payment_methods` entry into a configurable,
|
|
6
|
+
* adapter-backed payment method and the `payments` row into a richer
|
|
7
|
+
* payment-process record:
|
|
8
|
+
*
|
|
9
|
+
* payment_methods:
|
|
10
|
+
* + adapter — registry key of the adapter realising the logic
|
|
11
|
+
* (backfilled from the existing `kind`)
|
|
12
|
+
* + additional_price — flat surcharge in the order currency
|
|
13
|
+
* + status_on_pending — Order-status reference applied at order creation
|
|
14
|
+
* + status_on_success — Order-status reference applied on a successful payment
|
|
15
|
+
* + status_on_failure — Order-status reference applied on a failed payment
|
|
16
|
+
*
|
|
17
|
+
* payments:
|
|
18
|
+
* + provider_details — adapter/PSP payload captured on receive_payment
|
|
19
|
+
* + failure_reason — populated on a failure outcome
|
|
20
|
+
* + attempt_no — retry sequence per order (1 = first attempt)
|
|
21
|
+
*
|
|
22
|
+
* `status` columns stay plain varchar (no CHECK constraint existed), so the
|
|
23
|
+
* new `failed` payment-process status needs no DDL beyond application code.
|
|
24
|
+
* Seed status mappings reuse the current hard-coded order `status` enum
|
|
25
|
+
* (new / confirmed / cancelled) until the Orders module ships a configurable
|
|
26
|
+
* order-status registry (see research.md R2).
|
|
27
|
+
*/
|
|
28
|
+
export class Migration20260611T140353PaymentMethodsAdapter extends Migration {
|
|
29
|
+
async up() {
|
|
30
|
+
// payment_methods — add nullable, backfill, then tighten to NOT NULL.
|
|
31
|
+
this.addSql(`
|
|
32
|
+
alter table "payment_methods"
|
|
33
|
+
add column "adapter" varchar(64) null,
|
|
34
|
+
add column "additional_price" numeric(14,2) not null default 0,
|
|
35
|
+
add column "status_on_pending" varchar(64) null,
|
|
36
|
+
add column "status_on_success" varchar(64) null,
|
|
37
|
+
add column "status_on_failure" varchar(64) null;
|
|
38
|
+
`);
|
|
39
|
+
// Backfill: adapter mirrors the existing kind; statuses get seed defaults.
|
|
40
|
+
this.addSql(`update "payment_methods" set "adapter" = "kind" where "adapter" is null;`);
|
|
41
|
+
this.addSql(`update "payment_methods" set "status_on_pending" = 'new' where "status_on_pending" is null;`);
|
|
42
|
+
this.addSql(`update "payment_methods" set "status_on_success" = 'paid' where "status_on_success" is null;`);
|
|
43
|
+
this.addSql(`update "payment_methods" set "status_on_failure" = 'cancelled' where "status_on_failure" is null;`);
|
|
44
|
+
this.addSql(`
|
|
45
|
+
alter table "payment_methods"
|
|
46
|
+
alter column "adapter" set not null,
|
|
47
|
+
alter column "status_on_pending" set not null,
|
|
48
|
+
alter column "status_on_success" set not null,
|
|
49
|
+
alter column "status_on_failure" set not null;
|
|
50
|
+
`);
|
|
51
|
+
// payments — payment-process detail + retry sequence.
|
|
52
|
+
this.addSql(`
|
|
53
|
+
alter table "payments"
|
|
54
|
+
add column "provider_details" jsonb null,
|
|
55
|
+
add column "failure_reason" text null,
|
|
56
|
+
add column "attempt_no" int not null default 1;
|
|
57
|
+
`);
|
|
58
|
+
}
|
|
59
|
+
async down() {
|
|
60
|
+
this.addSql(`
|
|
61
|
+
alter table "payments"
|
|
62
|
+
drop column if exists "provider_details",
|
|
63
|
+
drop column if exists "failure_reason",
|
|
64
|
+
drop column if exists "attempt_no";
|
|
65
|
+
`);
|
|
66
|
+
this.addSql(`
|
|
67
|
+
alter table "payment_methods"
|
|
68
|
+
drop column if exists "adapter",
|
|
69
|
+
drop column if exists "additional_price",
|
|
70
|
+
drop column if exists "status_on_pending",
|
|
71
|
+
drop column if exists "status_on_success",
|
|
72
|
+
drop column if exists "status_on_failure";
|
|
73
|
+
`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=20260611T140353_payment_methods_adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260611T140353_payment_methods_adapter.js","sourceRoot":"","sources":["../../src/migrations/20260611T140353_payment_methods_adapter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,OAAO,6CAA8C,SAAQ,SAAS;IACjE,KAAK,CAAC,EAAE;QACf,sEAAsE;QACtE,IAAI,CAAC,MAAM,CAAC;;;;;;;KAOX,CAAC,CAAC;QACH,2EAA2E;QAC3E,IAAI,CAAC,MAAM,CAAC,0EAA0E,CAAC,CAAC;QACxF,IAAI,CAAC,MAAM,CAAC,6FAA6F,CAAC,CAAC;QAC3G,IAAI,CAAC,MAAM,CAAC,8FAA8F,CAAC,CAAC;QAC5G,IAAI,CAAC,MAAM,CAAC,mGAAmG,CAAC,CAAC;QACjH,IAAI,CAAC,MAAM,CAAC;;;;;;KAMX,CAAC,CAAC;QAEH,sDAAsD;QACtD,IAAI,CAAC,MAAM,CAAC;;;;;KAKX,CAAC,CAAC;IACL,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC;;;;;KAKX,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC;;;;;;;KAOX,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Feature 085 (FR-003 / FR-005) — a declined payment holds the order instead of
|
|
4
|
+
* ending it.
|
|
5
|
+
*
|
|
6
|
+
* `status_on_failure` was seeded `cancelled`: the settlement ingress applied it
|
|
7
|
+
* on the first decline, `cancelled` is terminal and cannot be left, and the
|
|
8
|
+
* buyer's most recoverable mistake destroyed the order they were trying to pay
|
|
9
|
+
* for. The shipped default is now `on_hold`, which is a system status —
|
|
10
|
+
* reachable from every non-terminal status, able to reach every status, and
|
|
11
|
+
* neither it nor its edges can be deleted by an operator.
|
|
12
|
+
*
|
|
13
|
+
* ### Why this is one of five migrations rather than the only one
|
|
14
|
+
*
|
|
15
|
+
* `stripe`, `payu`, `tpay` and `autopay` each declare `payment_methods` in
|
|
16
|
+
* their manifest `dependencies`, and feature 081 orders migrations module by
|
|
17
|
+
* module along that graph — so this file runs **before** all four gateway seed
|
|
18
|
+
* migrations. On a fresh database it therefore normalises nothing and the
|
|
19
|
+
* gateways would insert `cancelled` after it. Each of the four carries its own
|
|
20
|
+
* normalisation, stamped after its own seed. This one is the base: every row
|
|
21
|
+
* that exists by the time `payment_methods` migrates, which on an existing
|
|
22
|
+
* installation is the operator-created rows, the built-in bank-transfer /
|
|
23
|
+
* pickup / credit-limit rows the reconciler created at boot, and the gateway
|
|
24
|
+
* rows already seeded there.
|
|
25
|
+
*
|
|
26
|
+
* ### What it costs
|
|
27
|
+
*
|
|
28
|
+
* There is no provenance column, so `where status_on_failure = 'cancelled'`
|
|
29
|
+
* cannot tell a seeded default from an operator who deliberately chose to
|
|
30
|
+
* cancel on failure, and it overwrites the latter. That is acceptable only
|
|
31
|
+
* because there is no production deployment yet (research R9); after the first
|
|
32
|
+
* one this becomes a data migration requiring operator notification.
|
|
33
|
+
*/
|
|
34
|
+
export declare class Migration20260821T084920PaymentMethodsFailureStatusOnHold extends Migration {
|
|
35
|
+
up(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Deliberately empty. The inverse — putting `cancelled` back on every row
|
|
38
|
+
* that now reads `on_hold` — cannot distinguish the rows this migration moved
|
|
39
|
+
* from the rows an operator has since set to `on_hold` themselves, so it
|
|
40
|
+
* would silently take a choice away. The forward statement is idempotent and
|
|
41
|
+
* the value is operator-configurable; a deployment that wants `cancelled`
|
|
42
|
+
* back sets it on the method.
|
|
43
|
+
*/
|
|
44
|
+
down(): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=20260821T084920_payment_methods_failure_status_on_hold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260821T084920_payment_methods_failure_status_on_hold.d.ts","sourceRoot":"","sources":["../../src/migrations/20260821T084920_payment_methods_failure_status_on_hold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,qBAAa,yDAA0D,SAAQ,SAAS;IACvE,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAQlC;;;;;;;OAOG;IACY,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* Feature 085 (FR-003 / FR-005) — a declined payment holds the order instead of
|
|
4
|
+
* ending it.
|
|
5
|
+
*
|
|
6
|
+
* `status_on_failure` was seeded `cancelled`: the settlement ingress applied it
|
|
7
|
+
* on the first decline, `cancelled` is terminal and cannot be left, and the
|
|
8
|
+
* buyer's most recoverable mistake destroyed the order they were trying to pay
|
|
9
|
+
* for. The shipped default is now `on_hold`, which is a system status —
|
|
10
|
+
* reachable from every non-terminal status, able to reach every status, and
|
|
11
|
+
* neither it nor its edges can be deleted by an operator.
|
|
12
|
+
*
|
|
13
|
+
* ### Why this is one of five migrations rather than the only one
|
|
14
|
+
*
|
|
15
|
+
* `stripe`, `payu`, `tpay` and `autopay` each declare `payment_methods` in
|
|
16
|
+
* their manifest `dependencies`, and feature 081 orders migrations module by
|
|
17
|
+
* module along that graph — so this file runs **before** all four gateway seed
|
|
18
|
+
* migrations. On a fresh database it therefore normalises nothing and the
|
|
19
|
+
* gateways would insert `cancelled` after it. Each of the four carries its own
|
|
20
|
+
* normalisation, stamped after its own seed. This one is the base: every row
|
|
21
|
+
* that exists by the time `payment_methods` migrates, which on an existing
|
|
22
|
+
* installation is the operator-created rows, the built-in bank-transfer /
|
|
23
|
+
* pickup / credit-limit rows the reconciler created at boot, and the gateway
|
|
24
|
+
* rows already seeded there.
|
|
25
|
+
*
|
|
26
|
+
* ### What it costs
|
|
27
|
+
*
|
|
28
|
+
* There is no provenance column, so `where status_on_failure = 'cancelled'`
|
|
29
|
+
* cannot tell a seeded default from an operator who deliberately chose to
|
|
30
|
+
* cancel on failure, and it overwrites the latter. That is acceptable only
|
|
31
|
+
* because there is no production deployment yet (research R9); after the first
|
|
32
|
+
* one this becomes a data migration requiring operator notification.
|
|
33
|
+
*/
|
|
34
|
+
export class Migration20260821T084920PaymentMethodsFailureStatusOnHold extends Migration {
|
|
35
|
+
async up() {
|
|
36
|
+
this.addSql(`
|
|
37
|
+
update "payment_methods"
|
|
38
|
+
set "status_on_failure" = 'on_hold', "updated_at" = now()
|
|
39
|
+
where "status_on_failure" = 'cancelled';
|
|
40
|
+
`);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Deliberately empty. The inverse — putting `cancelled` back on every row
|
|
44
|
+
* that now reads `on_hold` — cannot distinguish the rows this migration moved
|
|
45
|
+
* from the rows an operator has since set to `on_hold` themselves, so it
|
|
46
|
+
* would silently take a choice away. The forward statement is idempotent and
|
|
47
|
+
* the value is operator-configurable; a deployment that wants `cancelled`
|
|
48
|
+
* back sets it on the method.
|
|
49
|
+
*/
|
|
50
|
+
async down() {
|
|
51
|
+
// No inverse — see the note above.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=20260821T084920_payment_methods_failure_status_on_hold.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260821T084920_payment_methods_failure_status_on_hold.js","sourceRoot":"","sources":["../../src/migrations/20260821T084920_payment_methods_failure_status_on_hold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,OAAO,yDAA0D,SAAQ,SAAS;IAC7E,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC;;;;KAIX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;OAOG;IACM,KAAK,CAAC,IAAI;QACjB,mCAAmC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* The `sales_channel_payment_methods` sales-channel bridge — the payment methods available in a channel.
|
|
4
|
+
*
|
|
5
|
+
* It was created by the platform's frozen `Migration20260430T170044CoreSalesChannelsPromote`
|
|
6
|
+
* until `specs/120-migration-closure-bridge-ownership/` Phase 2. Under D-226 a
|
|
7
|
+
* bridge between an always-present near side (`sales_channels`, a kernel table)
|
|
8
|
+
* and a switchable far side belongs to the far side, so this module creates it:
|
|
9
|
+
* an instance that does not install `payment_methods` no longer has a migration corpus
|
|
10
|
+
* naming a table nothing builds.
|
|
11
|
+
*
|
|
12
|
+
* `if not exists`, because every database that has already applied the frozen
|
|
13
|
+
* migration has this table. The storage keys on the class name and holds no
|
|
14
|
+
* checksum, so nothing is re-offered there and this migration is the no-op it
|
|
15
|
+
* reads as; on a fresh database it is the creation.
|
|
16
|
+
*
|
|
17
|
+
* The statements are the frozen ones verbatim — same columns, same primary key,
|
|
18
|
+
* same two foreign keys, same index — so the two paths reach one schema. Its
|
|
19
|
+
* position needs nothing declared: `sales_channels` is the kernel's and
|
|
20
|
+
* `payment_methods` is created inside the frozen prefix, which every
|
|
21
|
+
* above-watermark migration runs after.
|
|
22
|
+
*/
|
|
23
|
+
export declare class Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods extends Migration {
|
|
24
|
+
up(): Promise<void>;
|
|
25
|
+
down(): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=20260912T094631_payment_methods_sales_channel_payment_methods.d.ts.map
|
package/dist/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260912T094631_payment_methods_sales_channel_payment_methods.d.ts","sourceRoot":"","sources":["../../src/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBAAa,gEAAiE,SAAQ,SAAS;IAC9E,EAAE,IAAI,OAAO,CAAC,IAAI,CAAC;IAmBnB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAGrC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Migration } from '@mikro-orm/migrations';
|
|
2
|
+
/**
|
|
3
|
+
* The `sales_channel_payment_methods` sales-channel bridge — the payment methods available in a channel.
|
|
4
|
+
*
|
|
5
|
+
* It was created by the platform's frozen `Migration20260430T170044CoreSalesChannelsPromote`
|
|
6
|
+
* until `specs/120-migration-closure-bridge-ownership/` Phase 2. Under D-226 a
|
|
7
|
+
* bridge between an always-present near side (`sales_channels`, a kernel table)
|
|
8
|
+
* and a switchable far side belongs to the far side, so this module creates it:
|
|
9
|
+
* an instance that does not install `payment_methods` no longer has a migration corpus
|
|
10
|
+
* naming a table nothing builds.
|
|
11
|
+
*
|
|
12
|
+
* `if not exists`, because every database that has already applied the frozen
|
|
13
|
+
* migration has this table. The storage keys on the class name and holds no
|
|
14
|
+
* checksum, so nothing is re-offered there and this migration is the no-op it
|
|
15
|
+
* reads as; on a fresh database it is the creation.
|
|
16
|
+
*
|
|
17
|
+
* The statements are the frozen ones verbatim — same columns, same primary key,
|
|
18
|
+
* same two foreign keys, same index — so the two paths reach one schema. Its
|
|
19
|
+
* position needs nothing declared: `sales_channels` is the kernel's and
|
|
20
|
+
* `payment_methods` is created inside the frozen prefix, which every
|
|
21
|
+
* above-watermark migration runs after.
|
|
22
|
+
*/
|
|
23
|
+
export class Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods extends Migration {
|
|
24
|
+
async up() {
|
|
25
|
+
this.addSql(`
|
|
26
|
+
create table if not exists "sales_channel_payment_methods" (
|
|
27
|
+
"sales_channel_id" uuid not null,
|
|
28
|
+
"payment_method_id" uuid not null,
|
|
29
|
+
constraint "sales_channel_payment_methods_pkey"
|
|
30
|
+
primary key ("sales_channel_id", "payment_method_id"),
|
|
31
|
+
constraint "sales_channel_payment_methods_channel_fk"
|
|
32
|
+
foreign key ("sales_channel_id") references "sales_channels" ("id") on delete cascade,
|
|
33
|
+
constraint "sales_channel_payment_methods_payment_method_fk"
|
|
34
|
+
foreign key ("payment_method_id") references "payment_methods" ("id") on delete cascade
|
|
35
|
+
);
|
|
36
|
+
`);
|
|
37
|
+
this.addSql('create index if not exists "sales_channel_payment_methods_payment_method_id_index" ' +
|
|
38
|
+
'on "sales_channel_payment_methods" ("payment_method_id");');
|
|
39
|
+
}
|
|
40
|
+
async down() {
|
|
41
|
+
this.addSql('drop table if exists "sales_channel_payment_methods" cascade;');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=20260912T094631_payment_methods_sales_channel_payment_methods.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"20260912T094631_payment_methods_sales_channel_payment_methods.js","sourceRoot":"","sources":["../../src/migrations/20260912T094631_payment_methods_sales_channel_payment_methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,gEAAiE,SAAQ,SAAS;IACpF,KAAK,CAAC,EAAE;QACf,IAAI,CAAC,MAAM,CAAC;;;;;;;;;;;KAWX,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CACT,qFAAqF;YACnF,2DAA2D,CAC9D,CAAC;IACJ,CAAC;IAEQ,KAAK,CAAC,IAAI;QACjB,IAAI,CAAC,MAAM,CAAC,+DAA+D,CAAC,CAAC;IAC/E,CAAC;CACF"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `./migrations` subpath — every migration class this module owns, as one
|
|
3
|
+
* ordered `migrations` array.
|
|
4
|
+
*
|
|
5
|
+
* The array is what the platform reads when this module is **installed**:
|
|
6
|
+
* `src/packages/package-runtime.ts` takes `exported['migrations']` and refuses
|
|
7
|
+
* the package outright when it is absent (D-168).
|
|
8
|
+
*
|
|
9
|
+
* **Listed in ascending timestamp.** The entries stamped after
|
|
10
|
+
* `BASELINE_THROUGH` leave the frozen historical prefix and are ordered by the
|
|
11
|
+
* manifest `dependencies` graph instead. A timestamp orders this module's own
|
|
12
|
+
* migrations and nothing else (feature 081). How many of each there are is not
|
|
13
|
+
* written here: the stamps answer it, and a count in a comment goes stale in the
|
|
14
|
+
* merge request that adds a migration (D-100).
|
|
15
|
+
*
|
|
16
|
+
* The **named** exports stay beside the array, and the asymmetry with
|
|
17
|
+
* `./backend` — which publishes an array and no named class (D-168) — is
|
|
18
|
+
* deliberate. `db/migrations-registry.generated.ts` imports each class by name
|
|
19
|
+
* from this specifier, and a migration class name is contract in a way an entity
|
|
20
|
+
* class name is not: `mikro_orm_migrations` persists it, so it is a string every
|
|
21
|
+
* already-migrated database holds.
|
|
22
|
+
*
|
|
23
|
+
* A class that is in neither the array nor the barrel is a migration that does
|
|
24
|
+
* not run: `migration:pending` reports nothing pending and the first symptom is
|
|
25
|
+
* a query against a table nobody created.
|
|
26
|
+
*/
|
|
27
|
+
import { Migration20260611T140353PaymentMethodsAdapter } from './20260611T140353_payment_methods_adapter.js';
|
|
28
|
+
import { Migration20260821T084920PaymentMethodsFailureStatusOnHold } from './20260821T084920_payment_methods_failure_status_on_hold.js';
|
|
29
|
+
import { Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods } from './20260912T094631_payment_methods_sales_channel_payment_methods.js';
|
|
30
|
+
export declare const migrations: (typeof Migration20260611T140353PaymentMethodsAdapter)[];
|
|
31
|
+
export { Migration20260611T140353PaymentMethodsAdapter, Migration20260821T084920PaymentMethodsFailureStatusOnHold, Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods, };
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,6CAA6C,EAAE,MAAM,8CAA8C,CAAC;AAC7G,OAAO,EAAE,yDAAyD,EAAE,MAAM,6DAA6D,CAAC;AACxI,OAAO,EAAE,gEAAgE,EAAE,MAAM,oEAAoE,CAAC;AAEtJ,eAAO,MAAM,UAAU,0DAItB,CAAC;AAEF,OAAO,EACL,6CAA6C,EAC7C,yDAAyD,EACzD,gEAAgE,GACjE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `./migrations` subpath — every migration class this module owns, as one
|
|
3
|
+
* ordered `migrations` array.
|
|
4
|
+
*
|
|
5
|
+
* The array is what the platform reads when this module is **installed**:
|
|
6
|
+
* `src/packages/package-runtime.ts` takes `exported['migrations']` and refuses
|
|
7
|
+
* the package outright when it is absent (D-168).
|
|
8
|
+
*
|
|
9
|
+
* **Listed in ascending timestamp.** The entries stamped after
|
|
10
|
+
* `BASELINE_THROUGH` leave the frozen historical prefix and are ordered by the
|
|
11
|
+
* manifest `dependencies` graph instead. A timestamp orders this module's own
|
|
12
|
+
* migrations and nothing else (feature 081). How many of each there are is not
|
|
13
|
+
* written here: the stamps answer it, and a count in a comment goes stale in the
|
|
14
|
+
* merge request that adds a migration (D-100).
|
|
15
|
+
*
|
|
16
|
+
* The **named** exports stay beside the array, and the asymmetry with
|
|
17
|
+
* `./backend` — which publishes an array and no named class (D-168) — is
|
|
18
|
+
* deliberate. `db/migrations-registry.generated.ts` imports each class by name
|
|
19
|
+
* from this specifier, and a migration class name is contract in a way an entity
|
|
20
|
+
* class name is not: `mikro_orm_migrations` persists it, so it is a string every
|
|
21
|
+
* already-migrated database holds.
|
|
22
|
+
*
|
|
23
|
+
* A class that is in neither the array nor the barrel is a migration that does
|
|
24
|
+
* not run: `migration:pending` reports nothing pending and the first symptom is
|
|
25
|
+
* a query against a table nobody created.
|
|
26
|
+
*/
|
|
27
|
+
import { Migration20260611T140353PaymentMethodsAdapter } from './20260611T140353_payment_methods_adapter.js';
|
|
28
|
+
import { Migration20260821T084920PaymentMethodsFailureStatusOnHold } from './20260821T084920_payment_methods_failure_status_on_hold.js';
|
|
29
|
+
import { Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods } from './20260912T094631_payment_methods_sales_channel_payment_methods.js';
|
|
30
|
+
export const migrations = [
|
|
31
|
+
Migration20260611T140353PaymentMethodsAdapter,
|
|
32
|
+
Migration20260821T084920PaymentMethodsFailureStatusOnHold,
|
|
33
|
+
Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods,
|
|
34
|
+
];
|
|
35
|
+
export { Migration20260611T140353PaymentMethodsAdapter, Migration20260821T084920PaymentMethodsFailureStatusOnHold, Migration20260912T094631PaymentMethodsSalesChannelPaymentMethods, };
|
|
36
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migrations/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EAAE,6CAA6C,EAAE,MAAM,8CAA8C,CAAC;AAC7G,OAAO,EAAE,yDAAyD,EAAE,MAAM,6DAA6D,CAAC;AACxI,OAAO,EAAE,gEAAgE,EAAE,MAAM,oEAAoE,CAAC;AAEtJ,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,6CAA6C;IAC7C,yDAAyD;IACzD,gEAAgE;CACjE,CAAC;AAEF,OAAO,EACL,6CAA6C,EAC7C,yDAAyD,EACzD,gEAAgE,GACjE,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The install-time seed surface `payment_methods` publishes, and **nothing that
|
|
3
|
+
* exists at runtime** (feature 134, FR-064; D-168, D-169, D-171).
|
|
4
|
+
*
|
|
5
|
+
* The delivery twin — `packages/modules/delivery_methods/src/ports/index.ts` —
|
|
6
|
+
* is the same decision taken one wave earlier, and its doc-block carries the
|
|
7
|
+
* full argument. **Wave 2 reuses that decision rather than retaking it**
|
|
8
|
+
* (`contracts/foreign-write-repair.md` §2, §8 item 2h); what is written here is
|
|
9
|
+
* what differs, and the differences are two: this seam's row carries a `kind`
|
|
10
|
+
* the delivery one has no equivalent of, and five modules adopt it instead of
|
|
11
|
+
* two.
|
|
12
|
+
*
|
|
13
|
+
* `tsc` compiles this file to `export {};`. That is the property D-171 makes the
|
|
14
|
+
* boundary decision on — *a subpath is contract surface iff the module it
|
|
15
|
+
* resolves to exports no runtime binding* — so a consumer naming this subpath
|
|
16
|
+
* names a declaration and can name nothing else. The runtime half is one
|
|
17
|
+
* factory, `createPaymentMethodSeeder`, on this package's `./install`.
|
|
18
|
+
*
|
|
19
|
+
* ## Why this interface exists at all, and why it is here rather than in
|
|
20
|
+
* `packages/contracts`
|
|
21
|
+
*
|
|
22
|
+
* A module that ships its own gateway rows used to seed them with an `insert`
|
|
23
|
+
* into this module's table from its own migration — `autopay`, `paypal`, `payu`,
|
|
24
|
+
* `stripe` and `tpay` each did, which is fifteen `migration-foreign-writes`
|
|
25
|
+
* ledger keys and, **once a seeding module ships separately from the table's
|
|
26
|
+
* owner**, a hard schema dependency with no version range and no compile-time
|
|
27
|
+
* signal at all. That is the whole of the reason, and it holds for any pair of
|
|
28
|
+
* modules published from two places rather than for these five: an `insert` into
|
|
29
|
+
* a table another package owns is a dependency on that table's *shape*, and npm
|
|
30
|
+
* has no way to express one. The repair is that the seed is issued from the
|
|
31
|
+
* seeding module's `installHook` through this surface — **R11 / D-251 /
|
|
32
|
+
* FR-064**, the criterion any module may satisfy.
|
|
33
|
+
*
|
|
34
|
+
* It cannot live in `@endora-commerce/contracts`: every method takes a MikroORM
|
|
35
|
+
* `EntityManager`, that package is compiled by `admin` and `storefront`, and
|
|
36
|
+
* FR-034 keeps it free of `@mikro-orm` imports. That is exactly D-171's
|
|
37
|
+
* qualifying test — *does this signature stop the interface living in
|
|
38
|
+
* `packages/contracts`* — and it is why the `em` is a **required** first
|
|
39
|
+
* parameter on every method and never an optional one (D-169): an optional
|
|
40
|
+
* transactional `em` lets a caller hand a transaction to an implementation that
|
|
41
|
+
* ignores it and receive a silently non-atomic write.
|
|
42
|
+
*
|
|
43
|
+
* ## It carries no `Container name:` marker, deliberately
|
|
44
|
+
*
|
|
45
|
+
* This is not a container port and must not read as one. `ModuleLifecycleContext`
|
|
46
|
+
* is `{ em, redis, log, module }`, both orchestrator construction sites pass no
|
|
47
|
+
* container, and D-46 deleted `ctx.onInstall` because `module:install` composes
|
|
48
|
+
* nothing — so there is no cradle for a hook to resolve a name from, `lazyPort`
|
|
49
|
+
* is structurally unavailable here, and a documented container name would be a
|
|
50
|
+
* name nothing registers (`check:port-shape`'s signal 2, from the other side).
|
|
51
|
+
* The consumer's seam is the factory, not a resolution.
|
|
52
|
+
*
|
|
53
|
+
* ## No entity leaves by this door (D-168)
|
|
54
|
+
*
|
|
55
|
+
* {@link PaymentMethodSeedRecord} is a published record and not the
|
|
56
|
+
* `PaymentMethod` entity, type-only included. Handing a caller a managed entity
|
|
57
|
+
* hands it the ability to mutate a payment method outside the seam, and to
|
|
58
|
+
* persist that change on whichever transaction it happens to hold.
|
|
59
|
+
*/
|
|
60
|
+
import type { EntityManager } from '@mikro-orm/postgresql';
|
|
61
|
+
import type { PaymentAdapterType } from '@endora-commerce/contracts';
|
|
62
|
+
/** The row values a seeding module supplies for its own payment method. */
|
|
63
|
+
export interface PaymentMethodSeedDefaults {
|
|
64
|
+
/** Unique within `payment_methods`; the seam's whole idempotence rests on it. */
|
|
65
|
+
code: string;
|
|
66
|
+
/**
|
|
67
|
+
* Which driver realises the method — `'gateway'` for all five wave-2 vendors.
|
|
68
|
+
* The delivery twin has no equivalent field, which is the one shape difference
|
|
69
|
+
* between the two seams.
|
|
70
|
+
*/
|
|
71
|
+
type: PaymentAdapterType;
|
|
72
|
+
/** Translations by language tag, with a `default` key. */
|
|
73
|
+
name: Record<string, string>;
|
|
74
|
+
additionalPrice?: string;
|
|
75
|
+
/**
|
|
76
|
+
* `'active'` when omitted. **Pass it explicitly when the module wants anything
|
|
77
|
+
* else**: all five gateway seeds wrote `'inactive'`, and taking the default
|
|
78
|
+
* there would offer a payment method at checkout that no operator chose
|
|
79
|
+
* (`contracts/foreign-write-repair.md` §2.4).
|
|
80
|
+
*/
|
|
81
|
+
status?: 'active' | 'inactive';
|
|
82
|
+
statusOnPending?: string;
|
|
83
|
+
statusOnSuccess?: string;
|
|
84
|
+
/**
|
|
85
|
+
* `'on_hold'` when omitted, which is feature 085 FR-003's shipped default and
|
|
86
|
+
* the value every caller wants.
|
|
87
|
+
*
|
|
88
|
+
* **Never pass `'cancelled'`.** `cancelled` is terminal, so a declined payment
|
|
89
|
+
* destroys the order the buyer was trying to pay for; the five
|
|
90
|
+
* `*_failure_status_on_hold` migrations exist only to undo rows the old seeds
|
|
91
|
+
* wrote with it, and they retire with no replacement precisely because this
|
|
92
|
+
* default means a fresh install can no longer produce one
|
|
93
|
+
* (`contracts/foreign-write-repair.md` §4).
|
|
94
|
+
*/
|
|
95
|
+
statusOnFailure?: string;
|
|
96
|
+
}
|
|
97
|
+
/** What the seam answers about a payment method — a record, never the entity. */
|
|
98
|
+
export interface PaymentMethodSeedRecord {
|
|
99
|
+
readonly id: string;
|
|
100
|
+
readonly code: string;
|
|
101
|
+
readonly name: Record<string, string>;
|
|
102
|
+
readonly kind: PaymentAdapterType;
|
|
103
|
+
readonly adapter: string;
|
|
104
|
+
readonly status: 'active' | 'inactive';
|
|
105
|
+
readonly additionalPrice: string;
|
|
106
|
+
readonly statusOnPending: string;
|
|
107
|
+
readonly statusOnSuccess: string;
|
|
108
|
+
readonly statusOnFailure: string;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Created-versus-found, which the caller needs and cannot derive.
|
|
112
|
+
*
|
|
113
|
+
* `created` is what a channel binding is guarded on: the seed binds **once, for
|
|
114
|
+
* the rows it creates**, and re-binding a method an operator deliberately
|
|
115
|
+
* unbound from every channel is issue #96 verbatim
|
|
116
|
+
* (`contracts/foreign-write-repair.md` §2.3).
|
|
117
|
+
*/
|
|
118
|
+
export interface PaymentMethodSeedOutcome {
|
|
119
|
+
readonly row: PaymentMethodSeedRecord;
|
|
120
|
+
readonly created: boolean;
|
|
121
|
+
}
|
|
122
|
+
export interface PaymentMethodSeedApi {
|
|
123
|
+
/**
|
|
124
|
+
* Create this module's payment-method row, or return the existing one
|
|
125
|
+
* untouched. Idempotent and prune-safe: a row matched by `code` keeps its
|
|
126
|
+
* admin-edited configuration and only a missing `adapter` link is backfilled.
|
|
127
|
+
*/
|
|
128
|
+
ensureMethodForAdapter(em: EntityManager, adapterKey: string, defaults: PaymentMethodSeedDefaults): Promise<PaymentMethodSeedOutcome>;
|
|
129
|
+
/**
|
|
130
|
+
* Put the method in the system-default sales channel.
|
|
131
|
+
*
|
|
132
|
+
* **Call it only when `ensureMethodForAdapter` answered `created === true`.**
|
|
133
|
+
* Never as a reconcile: "unbound from every channel" is a state an operator is
|
|
134
|
+
* entitled to reach and to keep, and an unguarded call brings the method back
|
|
135
|
+
* with nothing saying so (issue #96).
|
|
136
|
+
*
|
|
137
|
+
* Answers whether a membership row was written — `false` when the method was
|
|
138
|
+
* already in that channel, and `false` when the platform has **no**
|
|
139
|
+
* system-default channel yet, which a database that has been migrated and never
|
|
140
|
+
* booted does not: the default channel is created at boot, and an install
|
|
141
|
+
* composes nothing. The row is then seeded and unbound, which is what the seed
|
|
142
|
+
* migration this replaced did in the same state.
|
|
143
|
+
*/
|
|
144
|
+
bindToDefaultChannel(em: EntityManager, paymentMethodId: string): Promise<boolean>;
|
|
145
|
+
/**
|
|
146
|
+
* Remove the method and, by cascade, its channel memberships and every
|
|
147
|
+
* vendor-owned row keyed on it.
|
|
148
|
+
*
|
|
149
|
+
* For a **hard** uninstall only (`if (!ctx.hard) return;`). A soft uninstall
|
|
150
|
+
* and a deactivation both keep the row: the registry filters the adapter's
|
|
151
|
+
* enumeration by its contributing module's effective state, so an off module
|
|
152
|
+
* is answered at the read and the operator's edits survive being switched back
|
|
153
|
+
* on (Principle XVII). Answers whether a row was removed.
|
|
154
|
+
*/
|
|
155
|
+
removeMethodForAdapter(em: EntityManager, code: string): Promise<boolean>;
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ports/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAErE,2EAA2E;AAC3E,MAAM,WAAW,yBAAyB;IACxC,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,EAAE,kBAAkB,CAAC;IACzB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;;OAUG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED,i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