@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Endora sp. z o.o. and the Endora Commerce contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!-- Generated by `pnpm --filter backend run manifests:generate`. Delete this line to take the file over; a README without it is never regenerated. -->
|
|
2
|
+
|
|
3
|
+
# @endora-commerce/mod-payment-methods
|
|
4
|
+
|
|
5
|
+
Payment method definitions and per-channel availability.
|
|
6
|
+
|
|
7
|
+
## What this is
|
|
8
|
+
|
|
9
|
+
An **Endora Commerce module package**. Its module id is `payment_methods` — the identity of record in the platform's registries, in its migrations and in its setting, permission and translation codes.
|
|
10
|
+
|
|
11
|
+
A module is not imported by application code. The platform discovers the extension packages an instance has installed, reads the manifest on the root subpath and composes the module from it, so installing this package and starting the instance is the whole integration.
|
|
12
|
+
|
|
13
|
+
## Entry points
|
|
14
|
+
|
|
15
|
+
| Import | Contents |
|
|
16
|
+
| --- | --- |
|
|
17
|
+
| `@endora-commerce/mod-payment-methods` | the module manifest — its id, version, dependencies, settings and activation |
|
|
18
|
+
| `@endora-commerce/mod-payment-methods/admin` | the Admin UI contribution: the screens, navigation and palette actions it adds |
|
|
19
|
+
| `@endora-commerce/mod-payment-methods/backend` | the composition root the platform calls, with the entities, services, routes and workers it registers |
|
|
20
|
+
| `@endora-commerce/mod-payment-methods/install` | the install surface: factories another module’s `installHook` constructs over its own `EntityManager` |
|
|
21
|
+
| `@endora-commerce/mod-payment-methods/migrations` | the module’s own schema migrations, in the order the platform runs them |
|
|
22
|
+
| `@endora-commerce/mod-payment-methods/ports` | type-only — the port interfaces other modules resolve this one through |
|
|
23
|
+
| `@endora-commerce/mod-payment-methods/tailwind.css` | the Tailwind source declaration for the admin code above |
|
|
24
|
+
|
|
25
|
+
## Depends on
|
|
26
|
+
|
|
27
|
+
Everything below is a **peer** dependency, so the application resolves exactly one copy of each — two copies of a host or of React are a runtime failure rather than a type error. An entry marked *optional* is needed only by the layers that use it.
|
|
28
|
+
|
|
29
|
+
**Endora packages**
|
|
30
|
+
|
|
31
|
+
- `@endora-commerce/admin-kit` — *optional*
|
|
32
|
+
- `@endora-commerce/contracts`
|
|
33
|
+
- `@endora-commerce/platform`
|
|
34
|
+
|
|
35
|
+
**Third-party**
|
|
36
|
+
|
|
37
|
+
- `@mikro-orm/core` ^6
|
|
38
|
+
- `@mikro-orm/migrations` ^6
|
|
39
|
+
- `@mikro-orm/postgresql` ^6
|
|
40
|
+
- `fastify` ^5
|
|
41
|
+
- `lucide-react` ^1 — *optional*
|
|
42
|
+
- `react` ^19 — *optional*
|
|
43
|
+
- `react-router-dom` ^7 — *optional*
|
|
44
|
+
|
|
45
|
+
## What the tarball carries
|
|
46
|
+
|
|
47
|
+
- `dist/` — the compiled JavaScript and its type declarations
|
|
48
|
+
- `i18n/` — the translation bundles this package ships (`en`, `pl`), loaded by the platform
|
|
49
|
+
- `docs/` — the package’s own pages in the Endora Commerce documentation site
|
|
50
|
+
- `tailwind.css` — the Tailwind source declaration
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
pnpm add @endora-commerce/mod-payment-methods
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Licence
|
|
59
|
+
|
|
60
|
+
MIT — the text is in `LICENSE`, beside this file.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Typed admin client for payment methods (feature 034). Wraps the shared
|
|
3
|
+
* apiClient with the adapter-aware endpoints.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Why a method is, or is not, offered to a buyer (issue #96). The admin keeps
|
|
7
|
+
* every row — switching a gateway off drops nothing — and renders the reason
|
|
8
|
+
* from the owning module's presence, exactly as `/platform/modules` does.
|
|
9
|
+
*/
|
|
10
|
+
export interface PaymentMethodAvailability {
|
|
11
|
+
ownerModule: string | null;
|
|
12
|
+
available: boolean;
|
|
13
|
+
ownerPresence: {
|
|
14
|
+
id: string;
|
|
15
|
+
present: boolean;
|
|
16
|
+
platformState: string;
|
|
17
|
+
activated: boolean;
|
|
18
|
+
deactivatable: boolean;
|
|
19
|
+
nonDeactivatableReason: string | null;
|
|
20
|
+
} | null;
|
|
21
|
+
}
|
|
22
|
+
export interface AdminPaymentMethod {
|
|
23
|
+
id: string;
|
|
24
|
+
code: string;
|
|
25
|
+
adapter: string;
|
|
26
|
+
kind: 'bank_transfer' | 'pickup' | 'credit_limit' | 'gateway';
|
|
27
|
+
name: Record<string, string>;
|
|
28
|
+
status: 'active' | 'inactive';
|
|
29
|
+
additionalPrice: number;
|
|
30
|
+
statusOnPending: string;
|
|
31
|
+
statusOnSuccess: string;
|
|
32
|
+
statusOnFailure: string;
|
|
33
|
+
salesChannelIds: string[];
|
|
34
|
+
rendererKey: string | null;
|
|
35
|
+
availability: PaymentMethodAvailability;
|
|
36
|
+
}
|
|
37
|
+
export interface OrderStatusOption {
|
|
38
|
+
code: string;
|
|
39
|
+
label: string;
|
|
40
|
+
}
|
|
41
|
+
export interface PaymentMethodUpsertBody {
|
|
42
|
+
code: string;
|
|
43
|
+
name: Record<string, string>;
|
|
44
|
+
kind: AdminPaymentMethod['kind'];
|
|
45
|
+
adapter?: string;
|
|
46
|
+
additionalPrice?: number;
|
|
47
|
+
status?: 'active' | 'inactive';
|
|
48
|
+
statusOnPending?: string;
|
|
49
|
+
statusOnSuccess?: string;
|
|
50
|
+
statusOnFailure?: string;
|
|
51
|
+
}
|
|
52
|
+
export declare const paymentMethodsClient: {
|
|
53
|
+
list(): Promise<AdminPaymentMethod[]>;
|
|
54
|
+
orderStatuses(): Promise<OrderStatusOption[]>;
|
|
55
|
+
adapters(): Promise<string[]>;
|
|
56
|
+
upsert(code: string, body: PaymentMethodUpsertBody): Promise<AdminPaymentMethod>;
|
|
57
|
+
/**
|
|
58
|
+
* Availability — feature 076 (D-82). Its own endpoint, because it is its own
|
|
59
|
+
* operation: the `PUT` above requires `name` and `kind`, so a toggle through
|
|
60
|
+
* it would resend the whole record and clobber a concurrent edit.
|
|
61
|
+
*/
|
|
62
|
+
setStatus(id: string, status: "active" | "inactive"): Promise<AdminPaymentMethod>;
|
|
63
|
+
remove(id: string): Promise<void>;
|
|
64
|
+
};
|
|
65
|
+
//# sourceMappingURL=payment-methods-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-methods-client.d.ts","sourceRoot":"","sources":["../../../src/admin/api/payment-methods-client.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACxC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE;QACb,EAAE,EAAE,MAAM,CAAC;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,aAA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CAAC;qBAKpB,OAAO,CAAC,iBAAiB,EAAE,CAAC;gBAKjC,OAAO,CAAC,MAAM,EAAE,CAAC;iBAKhB,MAAM,QAAQ,uBAAuB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQhF;;;;OAIG;kBACW,MAAM,UAAU,QAAQ,GAAG,UAAU,GAAG,OAAO,CAAC,kBAAkB,CAAC;eAOtE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAGlC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { apiClient } from '@endora-commerce/admin-kit/lib';
|
|
2
|
+
export const paymentMethodsClient = {
|
|
3
|
+
list() {
|
|
4
|
+
return apiClient
|
|
5
|
+
.get('/api/v1/admin/payment-methods')
|
|
6
|
+
.then((r) => r.data);
|
|
7
|
+
},
|
|
8
|
+
orderStatuses() {
|
|
9
|
+
return apiClient
|
|
10
|
+
.get('/api/v1/admin/order-statuses')
|
|
11
|
+
.then((r) => r.data);
|
|
12
|
+
},
|
|
13
|
+
adapters() {
|
|
14
|
+
return apiClient
|
|
15
|
+
.get('/api/v1/admin/payment-methods/adapters')
|
|
16
|
+
.then((r) => r.data);
|
|
17
|
+
},
|
|
18
|
+
upsert(code, body) {
|
|
19
|
+
return apiClient
|
|
20
|
+
.put(`/api/v1/admin/payment-methods/${encodeURIComponent(code)}`, body)
|
|
21
|
+
.then((r) => r.data);
|
|
22
|
+
},
|
|
23
|
+
/**
|
|
24
|
+
* Availability — feature 076 (D-82). Its own endpoint, because it is its own
|
|
25
|
+
* operation: the `PUT` above requires `name` and `kind`, so a toggle through
|
|
26
|
+
* it would resend the whole record and clobber a concurrent edit.
|
|
27
|
+
*/
|
|
28
|
+
setStatus(id, status) {
|
|
29
|
+
return apiClient
|
|
30
|
+
.patch(`/api/v1/admin/payment-methods/${id}/status`, {
|
|
31
|
+
status,
|
|
32
|
+
})
|
|
33
|
+
.then((r) => r.data);
|
|
34
|
+
},
|
|
35
|
+
remove(id) {
|
|
36
|
+
return apiClient.delete(`/api/v1/admin/payment-methods/${id}`);
|
|
37
|
+
},
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=payment-methods-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-methods-client.js","sourceRoot":"","sources":["../../../src/admin/api/payment-methods-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAyD3D,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI;QACF,OAAO,SAAS;aACb,GAAG,CAAiC,+BAA+B,CAAC;aACpE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,aAAa;QACX,OAAO,SAAS;aACb,GAAG,CAAgC,8BAA8B,CAAC;aAClE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,QAAQ;QACN,OAAO,SAAS;aACb,GAAG,CAAqB,wCAAwC,CAAC;aACjE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,IAAY,EAAE,IAA6B;QAChD,OAAO,SAAS;aACb,GAAG,CACF,iCAAiC,kBAAkB,CAAC,IAAI,CAAC,EAAE,EAC3D,IAAI,CACL;aACA,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD;;;;OAIG;IACH,SAAS,CAAC,EAAU,EAAE,MAA6B;QACjD,OAAO,SAAS;aACb,KAAK,CAA+B,iCAAiC,EAAE,SAAS,EAAE;YACjF,MAAM;SACP,CAAC;aACD,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACzB,CAAC;IACD,MAAM,CAAC,EAAU;QACf,OAAO,SAAS,CAAC,MAAM,CAAO,iCAAiC,EAAE,EAAE,CAAC,CAAC;IACvE,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `payment_methods`' admin surface — one route and one sidebar entry, declared
|
|
3
|
+
* by the module that owns them (feature 091, Phase 4, the plan's batch 7;
|
|
4
|
+
* `specs/091-module-owned-admin-surfaces/contracts/admin-contribution.md`).
|
|
5
|
+
*
|
|
6
|
+
* **It is a two-file layer plus a renderer table**, and the third file is worth
|
|
7
|
+
* a sentence because it looks like a cross-module seam and is not:
|
|
8
|
+
* `renderers/registry.tsx` maps a *provider code* to the small configuration
|
|
9
|
+
* form that provider's method needs. Every entry in it is this module's own
|
|
10
|
+
* markup over this module's own client; the gateway packages contribute
|
|
11
|
+
* nothing to it, which is why this batch's `check:module-boundary` line does
|
|
12
|
+
* not move for this module.
|
|
13
|
+
*
|
|
14
|
+
* **Its sidebar position does not change.** Every other row in *Pricing* is
|
|
15
|
+
* still host-declared, so `composeNav` appends this one after all of them —
|
|
16
|
+
* which is where the hand-written table already had it, last of six. The
|
|
17
|
+
* declared weight (600, the hand-written position times a hundred, batch four's
|
|
18
|
+
* convention) is what will restore the order once that section's other rows
|
|
19
|
+
* convert.
|
|
20
|
+
*
|
|
21
|
+
* **One shared label deliberately stays in `_i18n`.** The sidebar entry's own
|
|
22
|
+
* label moves into this module's bundle, but `appShell.nav.paymentMethods` is
|
|
23
|
+
* *also* the parent crumb of five gateway trails still hand-written in
|
|
24
|
+
* `CRUMB_DICT` (`/settings/{tpay,stripe,payu,autopay,paypal}`), which batch five
|
|
25
|
+
* deliberately left standing because those five modules contribute no nav entry
|
|
26
|
+
* for `registryCrumbs` to derive from. Deleting the key would render five raw
|
|
27
|
+
* keys on five screens this batch does not touch. It goes when those trails do.
|
|
28
|
+
*
|
|
29
|
+
* **This entry exports data and nothing else** (R2), like every `./admin`
|
|
30
|
+
* layer, and each component is a dynamic-import factory (R6) so Vite has a
|
|
31
|
+
* split point whether or not anybody remembers to ask for one.
|
|
32
|
+
*/
|
|
33
|
+
import type { AdminContributions } from '@endora-commerce/admin-kit/contributions';
|
|
34
|
+
export declare const contributions: AdminContributions;
|
|
35
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAenF,eAAO,MAAM,aAAa,EAAE,kBAwB3B,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/** The module's only admin route: the method catalogue and its editor. */
|
|
2
|
+
const ROUTE_PATH = '/payment-methods';
|
|
3
|
+
/**
|
|
4
|
+
* The code the screen's entry route enforces —
|
|
5
|
+
* `requireAdmin('payment_methods:read')` on
|
|
6
|
+
* `GET /api/v1/admin/payment-methods` (`routes.ts:125`). The module took its
|
|
7
|
+
* own authority on 2026-08-28; before that these screens were gated by
|
|
8
|
+
* `catalog:read` / `catalog:write`, so whoever could edit a product could
|
|
9
|
+
* rewrite which methods a checkout offers.
|
|
10
|
+
*/
|
|
11
|
+
const PERMISSION = 'payment_methods:read';
|
|
12
|
+
export const contributions = {
|
|
13
|
+
routes: [
|
|
14
|
+
{
|
|
15
|
+
path: ROUTE_PATH,
|
|
16
|
+
component: () => import('./pages/PaymentMethodsPage.js'),
|
|
17
|
+
requiredPermission: PERMISSION,
|
|
18
|
+
index: true,
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
nav: [
|
|
22
|
+
{
|
|
23
|
+
to: ROUTE_PATH,
|
|
24
|
+
// Module-relative (R8), resolved in this module's own namespace. The
|
|
25
|
+
// shared `appShell.nav.paymentMethods` stays where it is for the five
|
|
26
|
+
// gateway breadcrumbs that still name it — see the note above.
|
|
27
|
+
labelKey: 'nav.paymentMethods.label',
|
|
28
|
+
// The glyph `AppShell.tsx` rendered by hand, and already on
|
|
29
|
+
// `KnownIconNameSchema` — this module's own palette action names it.
|
|
30
|
+
icon: 'CreditCard',
|
|
31
|
+
section: 'pricing',
|
|
32
|
+
weight: 600,
|
|
33
|
+
requiredPermission: PERMISSION,
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/admin/index.ts"],"names":[],"mappings":"AAkCA,0EAA0E;AAC1E,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAE1C,MAAM,CAAC,MAAM,aAAa,GAAuB;IAC/C,MAAM,EAAE;QACN;YACE,IAAI,EAAE,UAAU;YAChB,SAAS,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,+BAA+B,CAAC;YACxD,kBAAkB,EAAE,UAAU;YAC9B,KAAK,EAAE,IAAI;SACZ;KACF;IACD,GAAG,EAAE;QACH;YACE,EAAE,EAAE,UAAU;YACd,qEAAqE;YACrE,sEAAsE;YACtE,+DAA+D;YAC/D,QAAQ,EAAE,0BAA0B;YACpC,4DAA4D;YAC5D,qEAAqE;YACrE,IAAI,EAAE,YAAY;YAClB,OAAO,EAAE,SAAS;YAClB,MAAM,EAAE,GAAG;YACX,kBAAkB,EAAE,UAAU;SAC/B;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
export declare function PaymentMethodsPage(): ReactNode;
|
|
3
|
+
/**
|
|
4
|
+
* The default export the route declaration's dynamic-import factory takes
|
|
5
|
+
* (`contracts/admin-contribution.md` R6). The named export is kept because the
|
|
6
|
+
* screen is also the subject of this module's own admin tests.
|
|
7
|
+
*/
|
|
8
|
+
export default PaymentMethodsPage;
|
|
9
|
+
//# sourceMappingURL=PaymentMethodsPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentMethodsPage.d.ts","sourceRoot":"","sources":["../../../src/admin/pages/PaymentMethodsPage.tsx"],"names":[],"mappings":"AAAA,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgBf,wBAAgB,kBAAkB,IAAI,SAAS,CAwS9C;AA0MD;;;;GAIG;AACH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, useState, } from 'react';
|
|
3
|
+
import { useSearchParams } from 'react-router-dom';
|
|
4
|
+
import { Pencil, Trash2 } from 'lucide-react';
|
|
5
|
+
import { ApiError, useAuth } from '@endora-commerce/admin-kit/lib';
|
|
6
|
+
import { AdminZone, useAdminZone } from '@endora-commerce/admin-kit/zones';
|
|
7
|
+
import { Alert, AlertDescription, Badge, Button, Card, CardContent, CardHeader, CardTitle, Input, Label, PageHeader, Select, Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '@endora-commerce/admin-kit/ui';
|
|
8
|
+
import { useTranslation } from '@endora-commerce/admin-kit/i18n';
|
|
9
|
+
import { paymentMethodsClient, } from '../api/payment-methods-client.js';
|
|
10
|
+
import { resolveAdminPaymentMethodRenderer } from '../renderers/registry.js';
|
|
11
|
+
const KINDS = ['bank_transfer', 'pickup', 'credit_limit', 'gateway'];
|
|
12
|
+
export function PaymentMethodsPage() {
|
|
13
|
+
const t = useTranslation('core');
|
|
14
|
+
const { hasPermission } = useAuth();
|
|
15
|
+
// Feature 076 (D-83 item 6) — the gateway screens link here with the method
|
|
16
|
+
// they were configuring. The row is scrolled into view **and focused**, so a
|
|
17
|
+
// keyboard operator lands where they were sent rather than at the top of a
|
|
18
|
+
// list they now have to search (WCAG 2.2 AA).
|
|
19
|
+
const [searchParams] = useSearchParams();
|
|
20
|
+
const highlight = searchParams.get('highlight');
|
|
21
|
+
const highlightedRow = useRef(null);
|
|
22
|
+
const [rows, setRows] = useState([]);
|
|
23
|
+
const [orderStatuses, setOrderStatuses] = useState([]);
|
|
24
|
+
const [adapters, setAdapters] = useState([]);
|
|
25
|
+
const [loading, setLoading] = useState(true);
|
|
26
|
+
const [error, setError] = useState(null);
|
|
27
|
+
const [info, setInfo] = useState(null);
|
|
28
|
+
// The upsert form is a controlled sub-tree keyed on this target: `null` = a
|
|
29
|
+
// blank "add" form; a row = an "edit" form seeded from that row. Bumping the
|
|
30
|
+
// key remounts the form so it picks up fresh initial values.
|
|
31
|
+
const [editing, setEditing] = useState(null);
|
|
32
|
+
const [formNonce, setFormNonce] = useState(0);
|
|
33
|
+
/**
|
|
34
|
+
* The screen's own gate (2026-08-28), on the code its routes now enforce.
|
|
35
|
+
*
|
|
36
|
+
* `payment_methods` used to borrow `catalog:read`, so this page had no
|
|
37
|
+
* permission of its own to check and the sidebar entry beside it carried the
|
|
38
|
+
* catalogue's. Both moved together; hiding the screen rather than letting it
|
|
39
|
+
* 403 is the treatment the sidebar, the palette and the dashboard already
|
|
40
|
+
* apply to a denied destination, and `AppShell.tsx`'s `PALETTE_ITEMS` comment
|
|
41
|
+
* argues it at length. The fetch is skipped as well as the render — a page
|
|
42
|
+
* that renders nothing has no reason to ask the API three questions it will
|
|
43
|
+
* be refused.
|
|
44
|
+
*/
|
|
45
|
+
const canRead = hasPermission('payment_methods:read');
|
|
46
|
+
// The host owns the card, while each installed gateway owns one contribution.
|
|
47
|
+
// `useAdminZone` applies platform presence, operator activation and the
|
|
48
|
+
// contribution's permission before deciding whether the card exists.
|
|
49
|
+
const integrations = useAdminZone('payment_method.list.integrations', {});
|
|
50
|
+
const refresh = useCallback(async () => {
|
|
51
|
+
if (!canRead) {
|
|
52
|
+
setLoading(false);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
setLoading(true);
|
|
56
|
+
setError(null);
|
|
57
|
+
try {
|
|
58
|
+
const [methods, statuses, adapterKeys] = await Promise.all([
|
|
59
|
+
paymentMethodsClient.list(),
|
|
60
|
+
paymentMethodsClient.orderStatuses(),
|
|
61
|
+
paymentMethodsClient.adapters().catch(() => []),
|
|
62
|
+
]);
|
|
63
|
+
setRows(methods);
|
|
64
|
+
setOrderStatuses(statuses);
|
|
65
|
+
setAdapters(adapterKeys);
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
setError(err instanceof ApiError ? err.envelope.error.message : 'Failed to load.');
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
setLoading(false);
|
|
72
|
+
}
|
|
73
|
+
}, [canRead]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
void refresh();
|
|
76
|
+
}, [refresh]);
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!highlight)
|
|
79
|
+
return;
|
|
80
|
+
const row = highlightedRow.current;
|
|
81
|
+
if (!row)
|
|
82
|
+
return;
|
|
83
|
+
row.scrollIntoView({ block: 'center', behavior: 'smooth' });
|
|
84
|
+
row.focus();
|
|
85
|
+
// `rows` is a dependency because the row does not exist until the list has
|
|
86
|
+
// loaded — running only on mount would focus nothing on every arrival.
|
|
87
|
+
}, [highlight, rows]);
|
|
88
|
+
const resetForm = useCallback(() => {
|
|
89
|
+
setEditing(null);
|
|
90
|
+
setFormNonce((n) => n + 1);
|
|
91
|
+
}, []);
|
|
92
|
+
const handleUpsert = useCallback(async (input) => {
|
|
93
|
+
const name = {};
|
|
94
|
+
if (input.nameEn)
|
|
95
|
+
name['en-US'] = input.nameEn;
|
|
96
|
+
if (input.namePl)
|
|
97
|
+
name['pl-PL'] = input.namePl;
|
|
98
|
+
try {
|
|
99
|
+
await paymentMethodsClient.upsert(input.code, {
|
|
100
|
+
code: input.code,
|
|
101
|
+
name,
|
|
102
|
+
kind: input.kind,
|
|
103
|
+
...(input.adapter ? { adapter: input.adapter } : {}),
|
|
104
|
+
additionalPrice: Number.isFinite(input.additionalPrice) ? input.additionalPrice : 0,
|
|
105
|
+
status: input.status,
|
|
106
|
+
...(input.statusOnPending ? { statusOnPending: input.statusOnPending } : {}),
|
|
107
|
+
...(input.statusOnSuccess ? { statusOnSuccess: input.statusOnSuccess } : {}),
|
|
108
|
+
...(input.statusOnFailure ? { statusOnFailure: input.statusOnFailure } : {}),
|
|
109
|
+
});
|
|
110
|
+
setInfo(t('legacyMethods.messages.saved', { code: input.code }));
|
|
111
|
+
resetForm();
|
|
112
|
+
await refresh();
|
|
113
|
+
}
|
|
114
|
+
catch (err) {
|
|
115
|
+
setError(err instanceof ApiError ? err.envelope.error.message : t('legacyMethods.errors.save'));
|
|
116
|
+
}
|
|
117
|
+
}, [refresh, resetForm, t]);
|
|
118
|
+
const handleDelete = useCallback(async (id) => {
|
|
119
|
+
if (!confirm(t('legacyMethods.payment.deleteConfirm')))
|
|
120
|
+
return;
|
|
121
|
+
try {
|
|
122
|
+
await paymentMethodsClient.remove(id);
|
|
123
|
+
if (editing?.id === id)
|
|
124
|
+
resetForm();
|
|
125
|
+
await refresh();
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
setError(err instanceof ApiError ? err.envelope.error.message : t('legacyMethods.errors.delete'));
|
|
129
|
+
}
|
|
130
|
+
}, [editing, refresh, resetForm, t]);
|
|
131
|
+
/**
|
|
132
|
+
* The one write that decides whether a method is offered to buyers — feature
|
|
133
|
+
* 076 (D-82). It is a control here and a state everywhere else: the four
|
|
134
|
+
* gateway screens render the chip and link to this row.
|
|
135
|
+
*/
|
|
136
|
+
const handleSetStatus = useCallback(async (row, status) => {
|
|
137
|
+
setError(null);
|
|
138
|
+
try {
|
|
139
|
+
await paymentMethodsClient.setStatus(row.id, status);
|
|
140
|
+
await refresh();
|
|
141
|
+
}
|
|
142
|
+
catch (err) {
|
|
143
|
+
setError(err instanceof ApiError ? err.envelope.error.message : t('legacyMethods.errors.save'));
|
|
144
|
+
}
|
|
145
|
+
}, [refresh, t]);
|
|
146
|
+
const startEdit = useCallback((row) => {
|
|
147
|
+
setError(null);
|
|
148
|
+
setInfo(null);
|
|
149
|
+
setEditing(row);
|
|
150
|
+
// Bring the form (top of page) into view for a clear edit affordance.
|
|
151
|
+
if (typeof window !== 'undefined')
|
|
152
|
+
window.scrollTo({ top: 0, behavior: 'smooth' });
|
|
153
|
+
}, []);
|
|
154
|
+
if (!canRead) {
|
|
155
|
+
return (_jsx(Alert, { children: _jsx(AlertDescription, { children: t('legacyMethods.payment.noPermission') }) }));
|
|
156
|
+
}
|
|
157
|
+
return (_jsxs(_Fragment, { children: [_jsx(PageHeader, { title: t('legacyMethods.payment.title'), description: t('legacyMethods.payment.description') }), error ? (_jsx(Alert, { variant: "destructive", className: "mb-4", children: _jsx(AlertDescription, { children: error }) })) : null, info ? (_jsx(Alert, { variant: "success", className: "mb-4", children: _jsx(AlertDescription, { children: info }) })) : null, integrations.length > 0 ? (_jsxs(Card, { className: "mb-4", children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: t('legacyMethods.integrations.title') }) }), _jsxs(CardContent, { className: "space-y-3", children: [_jsx("p", { className: "mb-4 text-sm text-muted-foreground", children: t('legacyMethods.integrations.description') }), _jsx(AdminZone, { name: "payment_method.list.integrations", props: {} })] })] })) : null, _jsxs(Card, { className: "mb-4", children: [_jsx(CardHeader, { children: _jsx(CardTitle, { children: editing
|
|
158
|
+
? t('legacyMethods.editTitle', { code: editing.code })
|
|
159
|
+
: t('legacyMethods.formTitle') }) }), _jsx(CardContent, { children: _jsx(UpsertForm, { initial: editing, adapters: adapters, orderStatuses: orderStatuses, onSubmit: handleUpsert, ...(editing ? { onCancel: resetForm } : {}) }, editing ? `edit-${editing.id}` : `new-${formNonce}`) })] }), _jsx(Card, { children: _jsx(CardContent, { className: "pt-6", children: loading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('common.state.loading') })) : rows.length === 0 ? (_jsx("p", { className: "text-sm text-muted-foreground", children: t('legacyMethods.payment.empty') })) : (_jsxs(Table, { children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [_jsx(TableHead, { children: t('legacyMethods.columns.code') }), _jsx(TableHead, { children: t('legacyMethods.columns.name') }), _jsx(TableHead, { children: t('legacyMethods.columns.adapter') }), _jsx(TableHead, { children: t('legacyMethods.columns.status') }), _jsx(TableHead, {})] }) }), _jsx(TableBody, { children: rows.map((r) => (_jsxs(TableRow, { ...(r.code === highlight
|
|
160
|
+
? {
|
|
161
|
+
ref: highlightedRow,
|
|
162
|
+
tabIndex: -1,
|
|
163
|
+
className: 'outline-2 outline-offset-[-2px] outline-ring',
|
|
164
|
+
}
|
|
165
|
+
: {}), children: [_jsx(TableCell, { children: _jsx("code", { className: "font-mono text-xs", children: r.code }) }), _jsx(TableCell, { children: resolveAdminPaymentMethodRenderer(r.rendererKey)(r) }), _jsxs(TableCell, { children: [_jsx("code", { className: "font-mono text-xs", children: r.adapter }), r.additionalPrice > 0 ? (_jsxs("span", { className: "text-muted-foreground", children: [" (+", r.additionalPrice, ")"] })) : null] }), _jsx(TableCell, { children: _jsxs("div", { className: "flex flex-col items-start gap-1", children: [_jsxs(Select, { value: r.status, "aria-label": t('legacyMethods.fields.status'), onChange: (e) => void handleSetStatus(r, e.target.value), children: [_jsx("option", { value: "active", children: t('legacyMethods.status.active') }), _jsx("option", { value: "inactive", children: t('legacyMethods.status.inactive') })] }), _jsx(AvailabilityNote, { method: r })] }) }), _jsx(TableCell, { children: _jsxs("div", { className: "flex justify-end gap-2", children: [_jsxs(Button, { variant: "outline", size: "sm", type: "button", onClick: () => startEdit(r), children: [_jsx(Pencil, {}), t('common.action.edit')] }), _jsxs(Button, { variant: "destructive", size: "sm", type: "button", onClick: () => void handleDelete(r.id), children: [_jsx(Trash2, {}), t('common.action.delete')] })] }) })] }, r.id))) })] })) }) })] }));
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Why this method is not offered to buyers (issue #96).
|
|
169
|
+
*
|
|
170
|
+
* A method whose gateway module is absent disappears from cart and checkout
|
|
171
|
+
* entirely — the buyer never sees an option that cannot take their money — but
|
|
172
|
+
* the admin keeps the row, because switching a module off drops nothing. The
|
|
173
|
+
* reason is read from the server's presence projection (`availability`), never
|
|
174
|
+
* from a module list held here: the frontend has no business knowing which
|
|
175
|
+
* modules are gateways.
|
|
176
|
+
*/
|
|
177
|
+
function AvailabilityNote({ method }) {
|
|
178
|
+
const t = useTranslation('core');
|
|
179
|
+
const { availability } = method;
|
|
180
|
+
if (availability.available)
|
|
181
|
+
return null;
|
|
182
|
+
const reason = availability.ownerModule === null
|
|
183
|
+
? t('legacyMethods.availability.noAdapter', { adapter: method.adapter })
|
|
184
|
+
: availability.ownerPresence?.platformState === 'installed'
|
|
185
|
+
? t('legacyMethods.availability.moduleOff', { module: availability.ownerModule })
|
|
186
|
+
: t('legacyMethods.availability.moduleUnavailable', { module: availability.ownerModule });
|
|
187
|
+
return (_jsxs("span", { className: "flex flex-col items-start gap-1", children: [_jsx(Badge, { variant: "warning", children: t('legacyMethods.availability.unavailable') }), _jsx("span", { className: "text-xs text-muted-foreground", children: reason })] }));
|
|
188
|
+
}
|
|
189
|
+
function UpsertForm({ initial, adapters, onSubmit, onCancel, orderStatuses, }) {
|
|
190
|
+
const t = useTranslation('core');
|
|
191
|
+
const isEdit = Boolean(initial);
|
|
192
|
+
const [code, setCode] = useState(initial?.code ?? '');
|
|
193
|
+
const [nameEn, setNameEn] = useState(initial?.name['en-US'] ?? '');
|
|
194
|
+
const [namePl, setNamePl] = useState(initial?.name['pl-PL'] ?? '');
|
|
195
|
+
const [kind, setKind] = useState(initial?.kind ?? 'bank_transfer');
|
|
196
|
+
const [adapter, setAdapter] = useState(initial?.adapter ?? '');
|
|
197
|
+
const [additionalPrice, setAdditionalPrice] = useState(String(initial?.additionalPrice ?? '0'));
|
|
198
|
+
const [status, setStatus] = useState(initial?.status ?? 'active');
|
|
199
|
+
const [statusOnPending, setStatusOnPending] = useState(initial?.statusOnPending ?? '');
|
|
200
|
+
const [statusOnSuccess, setStatusOnSuccess] = useState(initial?.statusOnSuccess ?? '');
|
|
201
|
+
const [statusOnFailure, setStatusOnFailure] = useState(initial?.statusOnFailure ?? '');
|
|
202
|
+
// Offer the known adapter keys, but never drop the row's current adapter even
|
|
203
|
+
// if the registry list failed to load — so an edit never silently rebinds it.
|
|
204
|
+
const adapterOptions = Array.from(new Set([...(adapter ? [adapter] : []), ...adapters]));
|
|
205
|
+
const statusSelect = (id, label, value, setValue) => (_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: id, children: label }), _jsxs(Select, { id: id, value: value, onChange: (e) => setValue(e.target.value), children: [_jsx("option", { value: "", children: "\u2014" }), orderStatuses.map((s) => (_jsx("option", { value: s.code, children: s.label }, s.code)))] })] }));
|
|
206
|
+
return (_jsxs("form", { className: "space-y-4", onSubmit: (e) => {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
void onSubmit({
|
|
209
|
+
code,
|
|
210
|
+
nameEn,
|
|
211
|
+
namePl,
|
|
212
|
+
kind,
|
|
213
|
+
adapter,
|
|
214
|
+
additionalPrice: Number(additionalPrice),
|
|
215
|
+
status,
|
|
216
|
+
statusOnPending,
|
|
217
|
+
statusOnSuccess,
|
|
218
|
+
statusOnFailure,
|
|
219
|
+
});
|
|
220
|
+
}, children: [_jsxs("div", { className: "grid gap-4 md:grid-cols-2", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmcode", children: t('legacyMethods.fields.code') }), _jsx(Input, { id: "pmcode", value: code, onChange: (e) => setCode(e.target.value), required: true, disabled: isEdit })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmkind", children: t('legacyMethods.fields.kind') }), _jsx(Select, { id: "pmkind", value: kind, onChange: (e) => setKind(e.target.value), children: KINDS.map((k) => (_jsx("option", { value: k, children: t(`legacyMethods.payment.kind.${k}`) }, k))) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmadapter", children: t('legacyMethods.fields.adapter') }), _jsxs(Select, { id: "pmadapter", value: adapter, onChange: (e) => setAdapter(e.target.value), children: [_jsx("option", { value: "", children: `— (${kind})` }), adapterOptions.map((a) => (_jsx("option", { value: a, children: a }, a)))] })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmnameen", children: t('legacyMethods.fields.nameEn') }), _jsx(Input, { id: "pmnameen", value: nameEn, onChange: (e) => setNameEn(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmnamepl", children: t('legacyMethods.fields.namePl') }), _jsx(Input, { id: "pmnamepl", value: namePl, onChange: (e) => setNamePl(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmprice", children: t('legacyMethods.fields.additionalPrice') }), _jsx(Input, { id: "pmprice", type: "number", min: "0", step: "0.01", value: additionalPrice, onChange: (e) => setAdditionalPrice(e.target.value) })] }), _jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "pmstatus", children: t('legacyMethods.fields.status') }), _jsxs(Select, { id: "pmstatus", value: status, onChange: (e) => setStatus(e.target.value), children: [_jsx("option", { value: "active", children: t('legacyMethods.status.active') }), _jsx("option", { value: "inactive", children: t('legacyMethods.status.inactive') })] })] }), statusSelect('pmsop', t('legacyMethods.fields.statusOnPending'), statusOnPending, setStatusOnPending), statusSelect('pmsos', t('legacyMethods.fields.statusOnSuccess'), statusOnSuccess, setStatusOnSuccess), statusSelect('pmsof', t('legacyMethods.fields.statusOnFailure'), statusOnFailure, setStatusOnFailure)] }), _jsxs("div", { className: "flex gap-2", children: [_jsx(Button, { type: "submit", children: t('common.action.save') }), onCancel ? (_jsx(Button, { type: "button", variant: "outline", onClick: onCancel, children: t('common.action.cancel') })) : null] })] }));
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* The default export the route declaration's dynamic-import factory takes
|
|
224
|
+
* (`contracts/admin-contribution.md` R6). The named export is kept because the
|
|
225
|
+
* screen is also the subject of this module's own admin tests.
|
|
226
|
+
*/
|
|
227
|
+
export default PaymentMethodsPage;
|
|
228
|
+
//# sourceMappingURL=PaymentMethodsPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentMethodsPage.js","sourceRoot":"","sources":["../../../src/admin/pages/PaymentMethodsPage.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,GAGT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAClO,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,oBAAoB,GAGrB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iCAAiC,EAAE,MAAM,0BAA0B,CAAC;AAE7E,MAAM,KAAK,GAAG,CAAC,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,SAAS,CAAU,CAAC;AAE9E,MAAM,UAAU,kBAAkB;IAChC,MAAM,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,EAAE,aAAa,EAAE,GAAG,O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AAK,SAAS,EAAC,YAAY,aACzB,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,YAAE,CAAC,CAAC,oBAAoB,CAAC,GAAU,EACvD,QAAQ,CAAC,CAAC,CAAC,CACV,KAAC,MAAM,IAAC,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,QAAQ,YACtD,CAAC,CAAC,sBAAsB,CAAC,GACnB,CACV,CAAC,CAAC,CAAC,IAAI,IACJ,IACD,CACR,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { AdminPaymentMethod } from '../api/payment-methods-client.js';
|
|
3
|
+
/**
|
|
4
|
+
* Admin payment-method renderer registry (feature 034, FR-016/FR-017).
|
|
5
|
+
*
|
|
6
|
+
* An adapter may register a custom renderer for how its method appears in the
|
|
7
|
+
* admin list (keyed by the adapter's `renderers.admin`). When none is
|
|
8
|
+
* registered, the platform default renderer is used — so every method always
|
|
9
|
+
* renders in the admin surface.
|
|
10
|
+
*/
|
|
11
|
+
export type AdminPaymentMethodRenderer = (method: AdminPaymentMethod) => ReactNode;
|
|
12
|
+
export declare const DefaultAdminPaymentMethodRenderer: AdminPaymentMethodRenderer;
|
|
13
|
+
export declare function registerAdminPaymentMethodRenderer(key: string, renderer: AdminPaymentMethodRenderer): void;
|
|
14
|
+
export declare function resolveAdminPaymentMethodRenderer(rendererKey: string | null): AdminPaymentMethodRenderer;
|
|
15
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/admin/renderers/registry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,kBAAkB,KAAK,SAAS,CAAC;AAMnF,eAAO,MAAM,iCAAiC,EAAE,0BAI/C,CAAC;AAIF,wBAAgB,kCAAkC,CAChD,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,0BAA0B,GACnC,IAAI,CAEN;AAED,wBAAgB,iCAAiC,CAC/C,WAAW,EAAE,MAAM,GAAG,IAAI,GACzB,0BAA0B,CAM5B"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
function pickName(name) {
|
|
3
|
+
return name['en-US'] ?? name.default ?? Object.values(name)[0] ?? '';
|
|
4
|
+
}
|
|
5
|
+
export const DefaultAdminPaymentMethodRenderer = (method) => (_jsxs("span", { children: [pickName(method.name), " ", _jsxs("code", { className: "font-mono text-xs", children: ["(", method.adapter, ")"] })] }));
|
|
6
|
+
const registry = new Map();
|
|
7
|
+
export function registerAdminPaymentMethodRenderer(key, renderer) {
|
|
8
|
+
registry.set(key, renderer);
|
|
9
|
+
}
|
|
10
|
+
export function resolveAdminPaymentMethodRenderer(rendererKey) {
|
|
11
|
+
if (rendererKey) {
|
|
12
|
+
const found = registry.get(rendererKey);
|
|
13
|
+
if (found)
|
|
14
|
+
return found;
|
|
15
|
+
}
|
|
16
|
+
return DefaultAdminPaymentMethodRenderer;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/admin/renderers/registry.tsx"],"names":[],"mappings":";AAaA,SAAS,QAAQ,CAAC,IAA4B;IAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACvE,CAAC;AAED,MAAM,CAAC,MAAM,iCAAiC,GAA+B,CAAC,MAAM,EAAE,EAAE,CAAC,CACvF,2BACG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAE,gBAAM,SAAS,EAAC,mBAAmB,kBAAG,MAAM,CAAC,OAAO,SAAS,IAChF,CACR,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsC,CAAC;AAE/D,MAAM,UAAU,kCAAkC,CAChD,GAAW,EACX,QAAoC;IAEpC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,iCAAiC,CAC/C,WAA0B;IAE1B,IAAI,WAAW,EAAE,CAAC;QAChB,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACxC,IAAI,KAAK;YAAE,OAAO,KAAK,CAAC;IAC1B,CAAC;IACD,OAAO,iCAAiC,CAAC;AAC3C,CAAC"}
|