cabloy 5.1.127 → 5.1.129
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/.cabloy-version +1 -1
- package/CHANGELOG.md +23 -0
- package/cabloy-docs/backend/i18n-guide.md +86 -7
- package/e2e/specs/a-commerce/commerce.spec.ts +93 -8
- package/package.json +1 -1
- package/vona/env/.env +2 -0
- package/vona/env/.env.prod +6 -2
- package/vona/packages-cli/cabloy-cli/package.json +1 -1
- package/vona/packages-cli/cli/package.json +1 -1
- package/vona/packages-cli/cli-set-api/package.json +1 -1
- package/vona/packages-utils/module-glob/package.json +1 -1
- package/vona/packages-utils/utils/package.json +1 -1
- package/vona/packages-utils/utils/src/vona.ts +8 -1
- package/vona/packages-vona/vona/package.json +1 -1
- package/vona/packages-vona/vona-core/package.json +1 -1
- package/vona/packages-vona/vona-mock/package.json +1 -1
- package/vona/pnpm-lock.yaml +142 -21
- package/vona/pnpm-workspace.yaml +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/.metadata/index.ts +1 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productSelectResItem.tsx +3 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/dto/productView.tsx +3 -1
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/entity/product.tsx +23 -3
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/model/product.ts +1 -0
- package/vona/src/suite/a-commerce/modules/commerce-catalog/src/service/product.ts +7 -2
- package/vona/src/suite/a-commerce/modules/commerce-catalog/test/productPresentation.test.ts +214 -0
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/bean/payScene.commerceOrder.ts +39 -3
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/commercePayScene.ts +14 -1
- package/vona/src/suite/a-commerce/modules/commerce-payment/src/service/paymentAttempt.ts +5 -1
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/.metadata/index.ts +17 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/controller/checkout.ts +18 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutCreate.tsx +3 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutPaymentMethod.tsx +19 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/dto/checkoutPaymentMethods.tsx +17 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/src/service/order.ts +51 -0
- package/vona/src/suite/a-commerce/modules/commerce-trade/test/paymentOutcome.test.ts +2 -1
- package/vona/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/.metadata/index.ts +94 -55
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/bean.payScene.ts +65 -1
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/bean/meta.redlock.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentCallback.ts +32 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/controller/paymentSession.ts +26 -8
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentCallback.ts +99 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/paymentSession.ts +26 -3
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/providerOperation.ts +214 -82
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/service/refundOperation.ts +27 -2
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payScene.ts +9 -0
- package/vona/src/suite-vendor/a-pay/modules/a-pay/src/types/payment.ts +5 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-mock/src/bean/payProvider.mock.ts +7 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/bean/payProvider.paypal.ts +395 -84
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/index.ts +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/lib/paypalGateway.ts +129 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-paypal/src/types/index.ts +2 -0
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/package.json +1 -1
- package/vona/src/suite-vendor/a-pay/modules/pay-stripe/src/bean/payProvider.stripe.ts +7 -0
- package/vona/src/suite-vendor/a-pay/package.json +5 -5
- package/vona/src/suite-vendor/a-vona/modules/a-core/package.json +1 -1
- package/vona/src/suite-vendor/a-vona/package.json +1 -1
- package/zova/packages-cli/cli/package.json +3 -3
- package/zova/packages-cli/cli-set-front/package.json +4 -4
- package/zova/packages-utils/zova-jsx/package.json +3 -3
- package/zova/packages-utils/zova-vite/package.json +2 -2
- package/zova/packages-zova/zova/package.json +3 -3
- package/zova/packages-zova/zova-core/package.json +2 -2
- package/zova/pnpm-lock.yaml +41 -41
- package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/schemas.ts +8 -0
- package/zova/src/suite/a-commerce/modules/commerce-member/src/api/openapi/types.ts +175 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/cli/openapi.config.ts +1 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/commerceTradeCheckout.ts +16 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/schemas.ts +8 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/api/openapi/types.ts +177 -2
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradeCheckout.ts +12 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/model/cart.ts +11 -0
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/checkout/controller.tsx +25 -1
- package/zova/src/suite/a-commerce/modules/commerce-trade/src/page/payment/controller.tsx +27 -4
- package/zova/src/suite-vendor/a-pay/modules/a-pay/cli/openapi.config.ts +1 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/package.json +1 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/schemas.ts +20 -8
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/openapi/types.ts +292 -32
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/api/paymentSession.ts +26 -4
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/apiSchema/paymentSession.ts +5 -0
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/component/paymentNextAction/controller.tsx +2 -1
- package/zova/src/suite-vendor/a-pay/modules/a-pay/src/model/paymentSession.ts +12 -0
- package/zova/src/suite-vendor/a-pay/package.json +2 -2
- package/zova/src/suite-vendor/a-zova/modules/a-zova/package.json +4 -4
- package/zova/src/suite-vendor/a-zova/package.json +2 -2
- /package/vona/patches/{zova-core@5.1.81.patch → zova-core@5.1.82.patch} +0 -0
|
@@ -95,6 +95,38 @@ export interface paths {
|
|
|
95
95
|
patch?: never;
|
|
96
96
|
trace?: never;
|
|
97
97
|
};
|
|
98
|
+
'/api/payment-callback/return': {
|
|
99
|
+
parameters: {
|
|
100
|
+
query?: never;
|
|
101
|
+
header?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
cookie?: never;
|
|
104
|
+
};
|
|
105
|
+
get: operations['PaymentCallback_returned'];
|
|
106
|
+
put?: never;
|
|
107
|
+
post?: never;
|
|
108
|
+
delete?: never;
|
|
109
|
+
options?: never;
|
|
110
|
+
head?: never;
|
|
111
|
+
patch?: never;
|
|
112
|
+
trace?: never;
|
|
113
|
+
};
|
|
114
|
+
'/api/payment-callback/cancel': {
|
|
115
|
+
parameters: {
|
|
116
|
+
query?: never;
|
|
117
|
+
header?: never;
|
|
118
|
+
path?: never;
|
|
119
|
+
cookie?: never;
|
|
120
|
+
};
|
|
121
|
+
get: operations['PaymentCallback_cancelled'];
|
|
122
|
+
put?: never;
|
|
123
|
+
post?: never;
|
|
124
|
+
delete?: never;
|
|
125
|
+
options?: never;
|
|
126
|
+
head?: never;
|
|
127
|
+
patch?: never;
|
|
128
|
+
trace?: never;
|
|
129
|
+
};
|
|
98
130
|
'/api/payment-session/{id}/start': {
|
|
99
131
|
parameters: {
|
|
100
132
|
query?: never;
|
|
@@ -111,6 +143,22 @@ export interface paths {
|
|
|
111
143
|
patch?: never;
|
|
112
144
|
trace?: never;
|
|
113
145
|
};
|
|
146
|
+
'/api/payment-session/{id}/reconcile': {
|
|
147
|
+
parameters: {
|
|
148
|
+
query?: never;
|
|
149
|
+
header?: never;
|
|
150
|
+
path?: never;
|
|
151
|
+
cookie?: never;
|
|
152
|
+
};
|
|
153
|
+
get?: never;
|
|
154
|
+
put?: never;
|
|
155
|
+
post: operations['PaymentSession_reconcile'];
|
|
156
|
+
delete?: never;
|
|
157
|
+
options?: never;
|
|
158
|
+
head?: never;
|
|
159
|
+
patch?: never;
|
|
160
|
+
trace?: never;
|
|
161
|
+
};
|
|
114
162
|
'/api/payment-session/{id}': {
|
|
115
163
|
parameters: {
|
|
116
164
|
query?: never;
|
|
@@ -527,6 +575,22 @@ export interface paths {
|
|
|
527
575
|
patch: operations['CommerceTradeCart_updateItem'];
|
|
528
576
|
trace?: never;
|
|
529
577
|
};
|
|
578
|
+
'/api/commerce/trade/checkout/payment-methods': {
|
|
579
|
+
parameters: {
|
|
580
|
+
query?: never;
|
|
581
|
+
header?: never;
|
|
582
|
+
path?: never;
|
|
583
|
+
cookie?: never;
|
|
584
|
+
};
|
|
585
|
+
get: operations['CommerceTradeCheckout_paymentMethods'];
|
|
586
|
+
put?: never;
|
|
587
|
+
post?: never;
|
|
588
|
+
delete?: never;
|
|
589
|
+
options?: never;
|
|
590
|
+
head?: never;
|
|
591
|
+
patch?: never;
|
|
592
|
+
trace?: never;
|
|
593
|
+
};
|
|
530
594
|
'/api/commerce/trade/checkout': {
|
|
531
595
|
parameters: {
|
|
532
596
|
query?: never;
|
|
@@ -2652,6 +2716,16 @@ export interface components {
|
|
|
2652
2716
|
/** @description Quantity */
|
|
2653
2717
|
quantity: number;
|
|
2654
2718
|
};
|
|
2719
|
+
'commerce-trade.dto.checkoutPaymentMethods': {
|
|
2720
|
+
items: components['schemas']['commerce-trade.dto.checkoutPaymentMethod'][];
|
|
2721
|
+
defaultKey: string;
|
|
2722
|
+
};
|
|
2723
|
+
'commerce-trade.dto.checkoutPaymentMethod': {
|
|
2724
|
+
key: string;
|
|
2725
|
+
label: string;
|
|
2726
|
+
/** @enum {string} */
|
|
2727
|
+
interaction: 'redirect' | 'embedded';
|
|
2728
|
+
};
|
|
2655
2729
|
'commerce-trade.dto.checkoutResult': {
|
|
2656
2730
|
orderId: number | string;
|
|
2657
2731
|
paymentAttemptId: number | string;
|
|
@@ -2670,6 +2744,7 @@ export interface components {
|
|
|
2670
2744
|
addressId: number | string;
|
|
2671
2745
|
couponGrantId?: number | string | undefined;
|
|
2672
2746
|
correlationId: string;
|
|
2747
|
+
providerCandidateKey?: string | undefined;
|
|
2673
2748
|
};
|
|
2674
2749
|
'commerce-trade.dto.orderMineRes': {
|
|
2675
2750
|
list: components['schemas']['commerce-trade.dto.orderSummary'][];
|
|
@@ -5219,6 +5294,56 @@ export interface operations {
|
|
|
5219
5294
|
};
|
|
5220
5295
|
};
|
|
5221
5296
|
};
|
|
5297
|
+
PaymentCallback_returned: {
|
|
5298
|
+
parameters: {
|
|
5299
|
+
query: {
|
|
5300
|
+
state: string;
|
|
5301
|
+
};
|
|
5302
|
+
header?: never;
|
|
5303
|
+
path?: never;
|
|
5304
|
+
cookie?: never;
|
|
5305
|
+
};
|
|
5306
|
+
requestBody?: never;
|
|
5307
|
+
responses: {
|
|
5308
|
+
200: {
|
|
5309
|
+
headers: {
|
|
5310
|
+
[name: string]: unknown;
|
|
5311
|
+
};
|
|
5312
|
+
content: {
|
|
5313
|
+
'application/json': {
|
|
5314
|
+
code: string;
|
|
5315
|
+
message: string;
|
|
5316
|
+
data?: unknown;
|
|
5317
|
+
};
|
|
5318
|
+
};
|
|
5319
|
+
};
|
|
5320
|
+
};
|
|
5321
|
+
};
|
|
5322
|
+
PaymentCallback_cancelled: {
|
|
5323
|
+
parameters: {
|
|
5324
|
+
query: {
|
|
5325
|
+
state: string;
|
|
5326
|
+
};
|
|
5327
|
+
header?: never;
|
|
5328
|
+
path?: never;
|
|
5329
|
+
cookie?: never;
|
|
5330
|
+
};
|
|
5331
|
+
requestBody?: never;
|
|
5332
|
+
responses: {
|
|
5333
|
+
200: {
|
|
5334
|
+
headers: {
|
|
5335
|
+
[name: string]: unknown;
|
|
5336
|
+
};
|
|
5337
|
+
content: {
|
|
5338
|
+
'application/json': {
|
|
5339
|
+
code: string;
|
|
5340
|
+
message: string;
|
|
5341
|
+
data?: unknown;
|
|
5342
|
+
};
|
|
5343
|
+
};
|
|
5344
|
+
};
|
|
5345
|
+
};
|
|
5346
|
+
};
|
|
5222
5347
|
PaymentSession_start: {
|
|
5223
5348
|
parameters: {
|
|
5224
5349
|
query?: never;
|
|
@@ -5245,6 +5370,32 @@ export interface operations {
|
|
|
5245
5370
|
};
|
|
5246
5371
|
authToken: true;
|
|
5247
5372
|
};
|
|
5373
|
+
PaymentSession_reconcile: {
|
|
5374
|
+
parameters: {
|
|
5375
|
+
query?: never;
|
|
5376
|
+
header?: never;
|
|
5377
|
+
path: {
|
|
5378
|
+
id: number | string;
|
|
5379
|
+
};
|
|
5380
|
+
cookie?: never;
|
|
5381
|
+
};
|
|
5382
|
+
requestBody?: never;
|
|
5383
|
+
responses: {
|
|
5384
|
+
200: {
|
|
5385
|
+
headers: {
|
|
5386
|
+
[name: string]: unknown;
|
|
5387
|
+
};
|
|
5388
|
+
content: {
|
|
5389
|
+
'application/json': {
|
|
5390
|
+
code: string;
|
|
5391
|
+
message: string;
|
|
5392
|
+
data: components['schemas']['a-pay.dto.paymentSessionView'];
|
|
5393
|
+
};
|
|
5394
|
+
};
|
|
5395
|
+
};
|
|
5396
|
+
};
|
|
5397
|
+
authToken: true;
|
|
5398
|
+
};
|
|
5248
5399
|
PaymentSession_view: {
|
|
5249
5400
|
parameters: {
|
|
5250
5401
|
query?: never;
|
|
@@ -6106,6 +6257,30 @@ export interface operations {
|
|
|
6106
6257
|
};
|
|
6107
6258
|
authToken: true;
|
|
6108
6259
|
};
|
|
6260
|
+
CommerceTradeCheckout_paymentMethods: {
|
|
6261
|
+
parameters: {
|
|
6262
|
+
query?: never;
|
|
6263
|
+
header?: never;
|
|
6264
|
+
path?: never;
|
|
6265
|
+
cookie?: never;
|
|
6266
|
+
};
|
|
6267
|
+
requestBody?: never;
|
|
6268
|
+
responses: {
|
|
6269
|
+
200: {
|
|
6270
|
+
headers: {
|
|
6271
|
+
[name: string]: unknown;
|
|
6272
|
+
};
|
|
6273
|
+
content: {
|
|
6274
|
+
'application/json': {
|
|
6275
|
+
code: string;
|
|
6276
|
+
message: string;
|
|
6277
|
+
data: components['schemas']['commerce-trade.dto.checkoutPaymentMethods'];
|
|
6278
|
+
};
|
|
6279
|
+
};
|
|
6280
|
+
};
|
|
6281
|
+
};
|
|
6282
|
+
authToken: true;
|
|
6283
|
+
};
|
|
6109
6284
|
CommerceTradeCheckout_create: {
|
|
6110
6285
|
parameters: {
|
|
6111
6286
|
query?: never;
|
|
@@ -9,6 +9,7 @@ export default function (): ZovaOpenapiConfigModule {
|
|
|
9
9
|
'CommerceTradeCart_updateItem',
|
|
10
10
|
'CommerceTradeCart_deleteItem',
|
|
11
11
|
'CommerceTradeCart_clear',
|
|
12
|
+
'CommerceTradeCheckout_paymentMethods',
|
|
12
13
|
'CommerceTradeCheckout_create',
|
|
13
14
|
'CommerceTradeOrder_select',
|
|
14
15
|
'CommerceTradeOrder_view',
|
|
@@ -6,6 +6,15 @@ import type { components, paths } from './openapi/index.js';
|
|
|
6
6
|
|
|
7
7
|
import { OpenApiBaseURL } from './openapi/index.js';
|
|
8
8
|
|
|
9
|
+
/** CommerceTradeCheckout_paymentMethods */
|
|
10
|
+
export const ApiApiCommerceTradeCheckoutpaymentMethodsPath =
|
|
11
|
+
'/api/commerce/trade/checkout/payment-methods';
|
|
12
|
+
export type ApiApiCommerceTradeCheckoutpaymentMethodsPath =
|
|
13
|
+
'/api/commerce/trade/checkout/payment-methods';
|
|
14
|
+
export type ApiApiCommerceTradeCheckoutpaymentMethodsMethod = 'get';
|
|
15
|
+
export type ApiApiCommerceTradeCheckoutpaymentMethodsResponseBody =
|
|
16
|
+
paths[ApiApiCommerceTradeCheckoutpaymentMethodsPath][ApiApiCommerceTradeCheckoutpaymentMethodsMethod]['responses']['200']['content']['application/json']['data'];
|
|
17
|
+
|
|
9
18
|
/** CommerceTradeCheckout_create */
|
|
10
19
|
export const ApiApiCommerceTradeCheckoutcreatePath = '/api/commerce/trade/checkout';
|
|
11
20
|
export type ApiApiCommerceTradeCheckoutcreatePath = '/api/commerce/trade/checkout';
|
|
@@ -17,6 +26,13 @@ export type ApiApiCommerceTradeCheckoutcreateResponseBody =
|
|
|
17
26
|
|
|
18
27
|
@Api()
|
|
19
28
|
export class ApiCommerceTradeCheckout extends BeanApiBase {
|
|
29
|
+
paymentMethods(options?: IApiActionOptions) {
|
|
30
|
+
return this.$fetch.get<any, ApiApiCommerceTradeCheckoutpaymentMethodsResponseBody>(
|
|
31
|
+
ApiApiCommerceTradeCheckoutpaymentMethodsPath,
|
|
32
|
+
this.$configPrepare(OpenApiBaseURL(this.sys), options, true),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
20
36
|
create(body: ApiApiCommerceTradeCheckoutcreateRequestBody, options?: IApiActionOptions) {
|
|
21
37
|
return this.$fetch.post<any, ApiApiCommerceTradeCheckoutcreateResponseBody>(
|
|
22
38
|
ApiApiCommerceTradeCheckoutcreatePath,
|
|
@@ -117,6 +117,14 @@ export type ApiSchemaCommerceTradeDtoCartUpdateItem =
|
|
|
117
117
|
components['schemas']['commerce-trade.dto.cartUpdateItem'];
|
|
118
118
|
export type ApiSchemaCommerceTradeDtoCartUpdateItemPartial =
|
|
119
119
|
Partial<ApiSchemaCommerceTradeDtoCartUpdateItem>;
|
|
120
|
+
export type ApiSchemaCommerceTradeDtoCheckoutPaymentMethods =
|
|
121
|
+
components['schemas']['commerce-trade.dto.checkoutPaymentMethods'];
|
|
122
|
+
export type ApiSchemaCommerceTradeDtoCheckoutPaymentMethodsPartial =
|
|
123
|
+
Partial<ApiSchemaCommerceTradeDtoCheckoutPaymentMethods>;
|
|
124
|
+
export type ApiSchemaCommerceTradeDtoCheckoutPaymentMethod =
|
|
125
|
+
components['schemas']['commerce-trade.dto.checkoutPaymentMethod'];
|
|
126
|
+
export type ApiSchemaCommerceTradeDtoCheckoutPaymentMethodPartial =
|
|
127
|
+
Partial<ApiSchemaCommerceTradeDtoCheckoutPaymentMethod>;
|
|
120
128
|
export type ApiSchemaCommerceTradeDtoCheckoutResult =
|
|
121
129
|
components['schemas']['commerce-trade.dto.checkoutResult'];
|
|
122
130
|
export type ApiSchemaCommerceTradeDtoCheckoutResultPartial =
|
|
@@ -95,7 +95,39 @@ export interface paths {
|
|
|
95
95
|
patch?: never;
|
|
96
96
|
trace?: never;
|
|
97
97
|
};
|
|
98
|
-
'/api/payment-
|
|
98
|
+
'/api/payment-callback/return': {
|
|
99
|
+
parameters: {
|
|
100
|
+
query?: never;
|
|
101
|
+
header?: never;
|
|
102
|
+
path?: never;
|
|
103
|
+
cookie?: never;
|
|
104
|
+
};
|
|
105
|
+
get: operations['PaymentCallback_returned'];
|
|
106
|
+
put?: never;
|
|
107
|
+
post?: never;
|
|
108
|
+
delete?: never;
|
|
109
|
+
options?: never;
|
|
110
|
+
head?: never;
|
|
111
|
+
patch?: never;
|
|
112
|
+
trace?: never;
|
|
113
|
+
};
|
|
114
|
+
'/api/payment-callback/cancel': {
|
|
115
|
+
parameters: {
|
|
116
|
+
query?: never;
|
|
117
|
+
header?: never;
|
|
118
|
+
path?: never;
|
|
119
|
+
cookie?: never;
|
|
120
|
+
};
|
|
121
|
+
get: operations['PaymentCallback_cancelled'];
|
|
122
|
+
put?: never;
|
|
123
|
+
post?: never;
|
|
124
|
+
delete?: never;
|
|
125
|
+
options?: never;
|
|
126
|
+
head?: never;
|
|
127
|
+
patch?: never;
|
|
128
|
+
trace?: never;
|
|
129
|
+
};
|
|
130
|
+
'/api/pay/payment-session/{id}/start': {
|
|
99
131
|
parameters: {
|
|
100
132
|
query?: never;
|
|
101
133
|
header?: never;
|
|
@@ -111,7 +143,23 @@ export interface paths {
|
|
|
111
143
|
patch?: never;
|
|
112
144
|
trace?: never;
|
|
113
145
|
};
|
|
114
|
-
'/api/payment-session/{id}': {
|
|
146
|
+
'/api/pay/payment-session/{id}/reconcile': {
|
|
147
|
+
parameters: {
|
|
148
|
+
query?: never;
|
|
149
|
+
header?: never;
|
|
150
|
+
path?: never;
|
|
151
|
+
cookie?: never;
|
|
152
|
+
};
|
|
153
|
+
get?: never;
|
|
154
|
+
put?: never;
|
|
155
|
+
post: operations['PaymentSession_reconcile'];
|
|
156
|
+
delete?: never;
|
|
157
|
+
options?: never;
|
|
158
|
+
head?: never;
|
|
159
|
+
patch?: never;
|
|
160
|
+
trace?: never;
|
|
161
|
+
};
|
|
162
|
+
'/api/pay/payment-session/{id}': {
|
|
115
163
|
parameters: {
|
|
116
164
|
query?: never;
|
|
117
165
|
header?: never;
|
|
@@ -527,6 +575,22 @@ export interface paths {
|
|
|
527
575
|
patch: operations['CommerceTradeCart_updateItem'];
|
|
528
576
|
trace?: never;
|
|
529
577
|
};
|
|
578
|
+
'/api/commerce/trade/checkout/payment-methods': {
|
|
579
|
+
parameters: {
|
|
580
|
+
query?: never;
|
|
581
|
+
header?: never;
|
|
582
|
+
path?: never;
|
|
583
|
+
cookie?: never;
|
|
584
|
+
};
|
|
585
|
+
get: operations['CommerceTradeCheckout_paymentMethods'];
|
|
586
|
+
put?: never;
|
|
587
|
+
post?: never;
|
|
588
|
+
delete?: never;
|
|
589
|
+
options?: never;
|
|
590
|
+
head?: never;
|
|
591
|
+
patch?: never;
|
|
592
|
+
trace?: never;
|
|
593
|
+
};
|
|
530
594
|
'/api/commerce/trade/checkout': {
|
|
531
595
|
parameters: {
|
|
532
596
|
query?: never;
|
|
@@ -2652,6 +2716,16 @@ export interface components {
|
|
|
2652
2716
|
/** @description Quantity */
|
|
2653
2717
|
quantity: number;
|
|
2654
2718
|
};
|
|
2719
|
+
'commerce-trade.dto.checkoutPaymentMethods': {
|
|
2720
|
+
items: components['schemas']['commerce-trade.dto.checkoutPaymentMethod'][];
|
|
2721
|
+
defaultKey: string;
|
|
2722
|
+
};
|
|
2723
|
+
'commerce-trade.dto.checkoutPaymentMethod': {
|
|
2724
|
+
key: string;
|
|
2725
|
+
label: string;
|
|
2726
|
+
/** @enum {string} */
|
|
2727
|
+
interaction: 'redirect' | 'embedded';
|
|
2728
|
+
};
|
|
2655
2729
|
'commerce-trade.dto.checkoutResult': {
|
|
2656
2730
|
orderId: number | string;
|
|
2657
2731
|
paymentAttemptId: number | string;
|
|
@@ -2670,6 +2744,7 @@ export interface components {
|
|
|
2670
2744
|
addressId: number | string;
|
|
2671
2745
|
couponGrantId?: number | string | undefined;
|
|
2672
2746
|
correlationId: string;
|
|
2747
|
+
providerCandidateKey?: string | undefined;
|
|
2673
2748
|
};
|
|
2674
2749
|
'commerce-trade.dto.orderMineRes': {
|
|
2675
2750
|
list: components['schemas']['commerce-trade.dto.orderSummary'][];
|
|
@@ -5219,6 +5294,56 @@ export interface operations {
|
|
|
5219
5294
|
};
|
|
5220
5295
|
};
|
|
5221
5296
|
};
|
|
5297
|
+
PaymentCallback_returned: {
|
|
5298
|
+
parameters: {
|
|
5299
|
+
query: {
|
|
5300
|
+
state: string;
|
|
5301
|
+
};
|
|
5302
|
+
header?: never;
|
|
5303
|
+
path?: never;
|
|
5304
|
+
cookie?: never;
|
|
5305
|
+
};
|
|
5306
|
+
requestBody?: never;
|
|
5307
|
+
responses: {
|
|
5308
|
+
200: {
|
|
5309
|
+
headers: {
|
|
5310
|
+
[name: string]: unknown;
|
|
5311
|
+
};
|
|
5312
|
+
content: {
|
|
5313
|
+
'application/json': {
|
|
5314
|
+
code: string;
|
|
5315
|
+
message: string;
|
|
5316
|
+
data?: unknown;
|
|
5317
|
+
};
|
|
5318
|
+
};
|
|
5319
|
+
};
|
|
5320
|
+
};
|
|
5321
|
+
};
|
|
5322
|
+
PaymentCallback_cancelled: {
|
|
5323
|
+
parameters: {
|
|
5324
|
+
query: {
|
|
5325
|
+
state: string;
|
|
5326
|
+
};
|
|
5327
|
+
header?: never;
|
|
5328
|
+
path?: never;
|
|
5329
|
+
cookie?: never;
|
|
5330
|
+
};
|
|
5331
|
+
requestBody?: never;
|
|
5332
|
+
responses: {
|
|
5333
|
+
200: {
|
|
5334
|
+
headers: {
|
|
5335
|
+
[name: string]: unknown;
|
|
5336
|
+
};
|
|
5337
|
+
content: {
|
|
5338
|
+
'application/json': {
|
|
5339
|
+
code: string;
|
|
5340
|
+
message: string;
|
|
5341
|
+
data?: unknown;
|
|
5342
|
+
};
|
|
5343
|
+
};
|
|
5344
|
+
};
|
|
5345
|
+
};
|
|
5346
|
+
};
|
|
5222
5347
|
PaymentSession_start: {
|
|
5223
5348
|
parameters: {
|
|
5224
5349
|
query?: never;
|
|
@@ -5245,6 +5370,32 @@ export interface operations {
|
|
|
5245
5370
|
};
|
|
5246
5371
|
authToken: true;
|
|
5247
5372
|
};
|
|
5373
|
+
PaymentSession_reconcile: {
|
|
5374
|
+
parameters: {
|
|
5375
|
+
query?: never;
|
|
5376
|
+
header?: never;
|
|
5377
|
+
path: {
|
|
5378
|
+
id: number | string;
|
|
5379
|
+
};
|
|
5380
|
+
cookie?: never;
|
|
5381
|
+
};
|
|
5382
|
+
requestBody?: never;
|
|
5383
|
+
responses: {
|
|
5384
|
+
200: {
|
|
5385
|
+
headers: {
|
|
5386
|
+
[name: string]: unknown;
|
|
5387
|
+
};
|
|
5388
|
+
content: {
|
|
5389
|
+
'application/json': {
|
|
5390
|
+
code: string;
|
|
5391
|
+
message: string;
|
|
5392
|
+
data: components['schemas']['a-pay.dto.paymentSessionView'];
|
|
5393
|
+
};
|
|
5394
|
+
};
|
|
5395
|
+
};
|
|
5396
|
+
};
|
|
5397
|
+
authToken: true;
|
|
5398
|
+
};
|
|
5248
5399
|
PaymentSession_view: {
|
|
5249
5400
|
parameters: {
|
|
5250
5401
|
query?: never;
|
|
@@ -6106,6 +6257,30 @@ export interface operations {
|
|
|
6106
6257
|
};
|
|
6107
6258
|
authToken: true;
|
|
6108
6259
|
};
|
|
6260
|
+
CommerceTradeCheckout_paymentMethods: {
|
|
6261
|
+
parameters: {
|
|
6262
|
+
query?: never;
|
|
6263
|
+
header?: never;
|
|
6264
|
+
path?: never;
|
|
6265
|
+
cookie?: never;
|
|
6266
|
+
};
|
|
6267
|
+
requestBody?: never;
|
|
6268
|
+
responses: {
|
|
6269
|
+
200: {
|
|
6270
|
+
headers: {
|
|
6271
|
+
[name: string]: unknown;
|
|
6272
|
+
};
|
|
6273
|
+
content: {
|
|
6274
|
+
'application/json': {
|
|
6275
|
+
code: string;
|
|
6276
|
+
message: string;
|
|
6277
|
+
data: components['schemas']['commerce-trade.dto.checkoutPaymentMethods'];
|
|
6278
|
+
};
|
|
6279
|
+
};
|
|
6280
|
+
};
|
|
6281
|
+
};
|
|
6282
|
+
authToken: true;
|
|
6283
|
+
};
|
|
6109
6284
|
CommerceTradeCheckout_create: {
|
|
6110
6285
|
parameters: {
|
|
6111
6286
|
query?: never;
|
package/zova/src/suite/a-commerce/modules/commerce-trade/src/apiSchema/commerceTradeCheckout.ts
CHANGED
|
@@ -3,10 +3,21 @@ import type { IApiSchemaOptions } from 'zova-module-a-api';
|
|
|
3
3
|
import { BeanBase } from 'zova';
|
|
4
4
|
import { ApiSchema } from 'zova-module-a-api';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
ApiApiCommerceTradeCheckoutpaymentMethodsPath,
|
|
8
|
+
ApiApiCommerceTradeCheckoutcreatePath,
|
|
9
|
+
} from '../api/commerceTradeCheckout.js';
|
|
7
10
|
|
|
8
11
|
@ApiSchema()
|
|
9
12
|
export class ApiSchemaCommerceTradeCheckout extends BeanBase {
|
|
13
|
+
paymentMethods(options?: IApiSchemaOptions) {
|
|
14
|
+
return this.$sdk.createApiSchemas(
|
|
15
|
+
ApiApiCommerceTradeCheckoutpaymentMethodsPath,
|
|
16
|
+
'get',
|
|
17
|
+
options,
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
|
|
10
21
|
create(options?: IApiSchemaOptions) {
|
|
11
22
|
return this.$sdk.createApiSchemas(ApiApiCommerceTradeCheckoutcreatePath, 'post', options);
|
|
12
23
|
}
|
|
@@ -65,6 +65,17 @@ export class ModelCart extends BeanModelBase {
|
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
paymentMethods() {
|
|
69
|
+
if (!process.env.CLIENT || !this.$passport.isAuthenticated) return;
|
|
70
|
+
return this.$useStateData({
|
|
71
|
+
queryKey: ['paymentMethods'],
|
|
72
|
+
queryFn: async () => {
|
|
73
|
+
return await this.scope.api.commerceTradeCheckout.paymentMethods();
|
|
74
|
+
},
|
|
75
|
+
meta: { disableSuspenseOnInit: true },
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
68
79
|
checkout() {
|
|
69
80
|
return this.$useMutationData({
|
|
70
81
|
mutationKey: ['checkout'],
|
|
@@ -25,6 +25,7 @@ export class ControllerPageCheckout extends BeanControllerPageBase {
|
|
|
25
25
|
|
|
26
26
|
addressId?: string;
|
|
27
27
|
couponGrantId?: string;
|
|
28
|
+
providerCandidateKey?: string;
|
|
28
29
|
submitting = false;
|
|
29
30
|
|
|
30
31
|
get queryAddresses() {
|
|
@@ -37,6 +38,10 @@ export class ControllerPageCheckout extends BeanControllerPageBase {
|
|
|
37
38
|
return this.$$modelCoupon.mine();
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
get queryPaymentMethods() {
|
|
42
|
+
return this.$$modelCart.paymentMethods();
|
|
43
|
+
}
|
|
44
|
+
|
|
40
45
|
async checkout() {
|
|
41
46
|
if (!this.addressId || this.submitting) return;
|
|
42
47
|
this.submitting = true;
|
|
@@ -45,6 +50,7 @@ export class ControllerPageCheckout extends BeanControllerPageBase {
|
|
|
45
50
|
addressId: this.addressId,
|
|
46
51
|
couponGrantId: this.couponGrantId,
|
|
47
52
|
correlationId: `${Date.now()}-${Math.random().toString(36).slice(2, 12)}`,
|
|
53
|
+
providerCandidateKey: this.providerCandidateKey,
|
|
48
54
|
});
|
|
49
55
|
this.$router.push({
|
|
50
56
|
name: 'commerce-trade:payment',
|
|
@@ -69,6 +75,10 @@ export class ControllerPageCheckout extends BeanControllerPageBase {
|
|
|
69
75
|
}
|
|
70
76
|
const addresses = this.queryAddresses?.data?.list ?? [];
|
|
71
77
|
const coupons = this.queryCoupons?.data ?? [];
|
|
78
|
+
const paymentMethods = this.queryPaymentMethods?.data;
|
|
79
|
+
if (!this.providerCandidateKey && paymentMethods?.defaultKey) {
|
|
80
|
+
this.providerCandidateKey = paymentMethods.defaultKey;
|
|
81
|
+
}
|
|
72
82
|
return (
|
|
73
83
|
<ZPage>
|
|
74
84
|
<section class="mx-auto max-w-3xl p-6">
|
|
@@ -93,6 +103,20 @@ export class ControllerPageCheckout extends BeanControllerPageBase {
|
|
|
93
103
|
<p class="text-base-content/70">Add an address before checking out.</p>
|
|
94
104
|
)}
|
|
95
105
|
</fieldset>
|
|
106
|
+
<fieldset class="space-y-2">
|
|
107
|
+
<legend class="font-semibold">Payment method</legend>
|
|
108
|
+
{paymentMethods?.items.map(method => (
|
|
109
|
+
<label class="flex cursor-pointer gap-3 rounded border border-base-300 p-3">
|
|
110
|
+
<input
|
|
111
|
+
type="radio"
|
|
112
|
+
name="paymentMethod"
|
|
113
|
+
value={method.key}
|
|
114
|
+
v-model={this.providerCandidateKey}
|
|
115
|
+
/>
|
|
116
|
+
<span>{method.label}</span>
|
|
117
|
+
</label>
|
|
118
|
+
))}
|
|
119
|
+
</fieldset>
|
|
96
120
|
<fieldset class="space-y-2">
|
|
97
121
|
<legend class="font-semibold">Coupon</legend>
|
|
98
122
|
<label class="flex cursor-pointer gap-3 rounded border border-base-300 p-3">
|
|
@@ -115,7 +139,7 @@ export class ControllerPageCheckout extends BeanControllerPageBase {
|
|
|
115
139
|
</fieldset>
|
|
116
140
|
<button
|
|
117
141
|
class="btn btn-primary"
|
|
118
|
-
disabled={!this.addressId || this.submitting}
|
|
142
|
+
disabled={!this.addressId || !this.providerCandidateKey || this.submitting}
|
|
119
143
|
onClick={() => this.checkout()}
|
|
120
144
|
>
|
|
121
145
|
Create order
|
|
@@ -15,7 +15,9 @@ export const ControllerPagePaymentSchemaParams = z.object({
|
|
|
15
15
|
orderId: z.string(),
|
|
16
16
|
locale: z.string().optional(),
|
|
17
17
|
});
|
|
18
|
-
export const ControllerPagePaymentSchemaQuery = z.object({
|
|
18
|
+
export const ControllerPagePaymentSchemaQuery = z.object({
|
|
19
|
+
providerResult: z.enum(['return', 'cancel']).optional(),
|
|
20
|
+
});
|
|
19
21
|
|
|
20
22
|
type TypeMockPaymentOutcome = 'succeeded' | 'failed' | 'cancelled';
|
|
21
23
|
|
|
@@ -42,6 +44,7 @@ export class ControllerPagePayment extends BeanControllerPageBase {
|
|
|
42
44
|
if (this.$ssr.isRuntimeSsrHydrated) {
|
|
43
45
|
await $QueryEnsureLoaded(() => this.queryPaymentSession);
|
|
44
46
|
await $QueryEnsureLoaded(() => this.queryOrder);
|
|
47
|
+
if (this.$query.providerResult) await this.reconcile();
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
|
|
@@ -53,6 +56,20 @@ export class ControllerPagePayment extends BeanControllerPageBase {
|
|
|
53
56
|
return this.$$modelOrderMine.viewMine(this.orderId!);
|
|
54
57
|
}
|
|
55
58
|
|
|
59
|
+
async reconcile() {
|
|
60
|
+
if (!this.paymentSessionId || this.submitting) return;
|
|
61
|
+
this.submitting = true;
|
|
62
|
+
this.message = undefined;
|
|
63
|
+
try {
|
|
64
|
+
await this.$$modelPaymentSession.reconcile(this.paymentSessionId).mutateAsync();
|
|
65
|
+
await this._waitForSettlement();
|
|
66
|
+
} catch (error: any) {
|
|
67
|
+
this.message = error.message;
|
|
68
|
+
} finally {
|
|
69
|
+
this.submitting = false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
56
73
|
async start() {
|
|
57
74
|
if (!this.paymentSessionId || this.submitting) return;
|
|
58
75
|
this.submitting = true;
|
|
@@ -81,17 +98,23 @@ export class ControllerPagePayment extends BeanControllerPageBase {
|
|
|
81
98
|
}
|
|
82
99
|
}
|
|
83
100
|
|
|
84
|
-
private async _waitForSettlement(outcome
|
|
101
|
+
private async _waitForSettlement(outcome?: TypeMockPaymentOutcome) {
|
|
85
102
|
this.waitingForOrder = true;
|
|
86
103
|
const terminalSessionState = outcome;
|
|
87
|
-
const terminalOrderState = outcome === 'succeeded' ? 'paid' : 'cancelled';
|
|
104
|
+
const terminalOrderState = outcome === 'succeeded' ? 'paid' : outcome ? 'cancelled' : undefined;
|
|
88
105
|
try {
|
|
89
106
|
for (let attempt = 0; attempt < 60; attempt++) {
|
|
90
107
|
const session = await this.queryPaymentSession?.refetch();
|
|
91
108
|
const order = await this.scope.api.commerceTradeOrder.viewMine({
|
|
92
109
|
params: { id: this.orderId! },
|
|
93
110
|
});
|
|
94
|
-
|
|
111
|
+
const settled =
|
|
112
|
+
terminalSessionState && terminalOrderState
|
|
113
|
+
? session?.data?.state === terminalSessionState && order?.state === terminalOrderState
|
|
114
|
+
: ['succeeded', 'failed', 'cancelled', 'expired'].includes(
|
|
115
|
+
session?.data?.state ?? '',
|
|
116
|
+
) && ['paid', 'cancelled', 'expired'].includes(order?.state ?? '');
|
|
117
|
+
if (settled) {
|
|
95
118
|
await this.queryOrder?.refetch();
|
|
96
119
|
await this.$router.push({
|
|
97
120
|
name: 'commerce-trade:order',
|
|
@@ -3,7 +3,7 @@ import type { ZovaOpenapiConfigModule } from 'zova-openapi';
|
|
|
3
3
|
export default function (): ZovaOpenapiConfigModule {
|
|
4
4
|
return {
|
|
5
5
|
operations: {
|
|
6
|
-
match: ['PaymentSession_start', 'PaymentSession_view'],
|
|
6
|
+
match: ['PaymentSession_start', 'PaymentSession_reconcile', 'PaymentSession_view'],
|
|
7
7
|
},
|
|
8
8
|
};
|
|
9
9
|
}
|