ts-glitter 21.0.3 → 21.0.5
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/lowcode/Entry.js +1 -1
- package/lowcode/Entry.ts +1 -1
- package/lowcode/backend-manager/bg-blog.js +22 -37
- package/lowcode/backend-manager/bg-blog.ts +45 -34
- package/lowcode/backend-manager/bg-list-component.js +2 -2
- package/lowcode/backend-manager/bg-list-component.ts +2 -2
- package/lowcode/backend-manager/bg-widget.js +21 -0
- package/lowcode/backend-manager/bg-widget.ts +21 -0
- package/lowcode/cms-plugin/filter-options.js +3 -3
- package/lowcode/cms-plugin/filter-options.ts +1 -1
- package/lowcode/cms-plugin/shopping-finance-setting.js +251 -6
- package/lowcode/cms-plugin/shopping-finance-setting.ts +291 -6
- package/lowcode/cms-plugin/shopping-order-manager.js +56 -46
- package/lowcode/cms-plugin/shopping-order-manager.ts +59 -47
- package/lowcode/cms-plugin/shopping-product-setting.js +10 -5
- package/lowcode/cms-plugin/shopping-product-setting.ts +14 -6
- package/lowcode/cms-plugin/shopping-setting-advance.js +21 -72
- package/lowcode/cms-plugin/shopping-setting-advance.ts +31 -98
- package/lowcode/css/editor.css +48 -16
- package/lowcode/css/front-end.css +16 -17
- package/lowcode/glitter-base/global/language.js +2 -0
- package/lowcode/glitter-base/global/language.ts +3 -0
- package/lowcode/glitter-base/global/shipment-config.js +4 -4
- package/lowcode/glitter-base/global/shipment-config.ts +1 -1
- package/lowcode/glitter-base/route/shopping.js +11 -0
- package/lowcode/glitter-base/route/shopping.ts +12 -0
- package/lowcode/official_view_component/form-widget/input-custom.js +0 -1
- package/lowcode/official_view_component/form-widget/input-custom.ts +0 -1
- package/lowcode/public-components/checkout/index.js +578 -780
- package/lowcode/public-components/checkout/index.ts +2457 -2652
- package/lowcode/public-components/headers/header-class.js +252 -324
- package/lowcode/public-components/headers/header-class.ts +389 -480
- package/lowcode/public-components/modules/cart-module.js +433 -0
- package/lowcode/public-components/modules/cart-module.ts +491 -0
- package/lowcode/public-components/modules/product-module.js +45 -0
- package/lowcode/public-components/modules/product-module.ts +58 -0
- package/lowcode/public-components/product/product-detail.js +178 -184
- package/lowcode/public-components/product/product-detail.ts +564 -579
- package/lowcode/public-components/user-manager/um-order.js +162 -32
- package/lowcode/public-components/user-manager/um-order.ts +181 -46
- package/lowcode/public-models/product.ts +1 -0
- package/lowcode/view-model/saas-view-model.js +1 -1
- package/lowcode/view-model/saas-view-model.ts +1 -1
- package/package.json +1 -1
- package/src/Language.js +1 -0
- package/src/Language.js.map +1 -1
- package/src/Language.ts +3 -0
- package/src/api-public/controllers/article.js +33 -29
- package/src/api-public/controllers/article.js.map +1 -1
- package/src/api-public/controllers/article.ts +152 -146
- package/src/api-public/controllers/index.js +2 -0
- package/src/api-public/controllers/index.js.map +1 -1
- package/src/api-public/controllers/index.ts +2 -0
- package/src/api-public/controllers/shop.js +125 -47
- package/src/api-public/controllers/shop.js.map +1 -1
- package/src/api-public/controllers/shop.ts +148 -61
- package/src/api-public/controllers/user.js +51 -52
- package/src/api-public/controllers/user.js.map +1 -1
- package/src/api-public/controllers/user.ts +63 -52
- package/src/api-public/models/glitter-finance.js +2 -1
- package/src/api-public/models/glitter-finance.js.map +5 -1
- package/src/api-public/services/checkout-event.d.ts +1 -0
- package/src/api-public/services/checkout-event.js +18 -10
- package/src/api-public/services/checkout-event.js.map +1 -1
- package/src/api-public/services/checkout-event.ts +18 -7
- package/src/api-public/services/factories/payment-strategy-factory.d.ts +6 -0
- package/src/api-public/services/factories/payment-strategy-factory.js +49 -0
- package/src/api-public/services/factories/payment-strategy-factory.js.map +1 -0
- package/src/api-public/services/factories/payment-strategy-factory.ts +71 -0
- package/src/api-public/services/fb-service.js +4 -4
- package/src/api-public/services/fb-service.js.map +1 -1
- package/src/api-public/services/financial-service.d.ts +2 -1
- package/src/api-public/services/financial-service.js +48 -53
- package/src/api-public/services/financial-service.js.map +1 -1
- package/src/api-public/services/financial-service.ts +29 -38
- package/src/api-public/services/financial-serviceV2.d.ts +298 -0
- package/src/api-public/services/financial-serviceV2.js +1158 -0
- package/src/api-public/services/financial-serviceV2.js.map +1 -0
- package/src/api-public/services/financial-serviceV2.ts +1518 -0
- package/src/api-public/services/interface/payment-keys-interface.d.ts +37 -0
- package/src/api-public/services/interface/payment-keys-interface.js +3 -0
- package/src/api-public/services/interface/payment-keys-interface.js.map +1 -0
- package/src/api-public/services/interface/payment-keys-interface.ts +46 -0
- package/src/api-public/services/interface/payment-strategy-interface.d.ts +17 -0
- package/src/api-public/services/interface/payment-strategy-interface.js +3 -0
- package/src/api-public/services/interface/payment-strategy-interface.js.map +1 -0
- package/src/api-public/services/interface/payment-strategy-interface.ts +48 -0
- package/src/api-public/services/migrate-event/public-user-config.d.ts +5 -0
- package/src/api-public/services/migrate-event/public-user-config.js +81 -0
- package/src/api-public/services/migrate-event/public-user-config.js.map +1 -0
- package/src/api-public/services/migrate-event/public-user-config.ts +106 -0
- package/src/api-public/services/model/handlePaymentTransaction.js +0 -68
- package/src/api-public/services/model/handlePaymentTransaction.js.map +1 -1
- package/src/api-public/services/model/handlePaymentTransaction.ts +62 -54
- package/src/api-public/services/monitor.d.ts +1 -0
- package/src/api-public/services/payment-service.d.ts +12 -0
- package/src/api-public/services/payment-service.js +83 -0
- package/src/api-public/services/payment-service.js.map +1 -0
- package/src/api-public/services/payment-service.ts +112 -0
- package/src/api-public/services/shopping.d.ts +2 -1
- package/src/api-public/services/shopping.js +60 -23
- package/src/api-public/services/shopping.js.map +1 -1
- package/src/api-public/services/shopping.ts +88 -16
- package/src/api-public/services/strategies/ecpay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/ecpay-strategy.js +26 -0
- package/src/api-public/services/strategies/ecpay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/ecpay-strategy.ts +30 -0
- package/src/api-public/services/strategies/ezpay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/ezpay-strategy.js +26 -0
- package/src/api-public/services/strategies/ezpay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/ezpay-strategy.ts +31 -0
- package/src/api-public/services/strategies/jkopay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/jkopay-strategy.js +32 -0
- package/src/api-public/services/strategies/jkopay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/jkopay-strategy.ts +36 -0
- package/src/api-public/services/strategies/linepay-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/linepay-strategy.js +32 -0
- package/src/api-public/services/strategies/linepay-strategy.js.map +1 -0
- package/src/api-public/services/strategies/linepay-strategy.ts +35 -0
- package/src/api-public/services/strategies/paynow-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/paynow-strategy.js +26 -0
- package/src/api-public/services/strategies/paynow-strategy.js.map +1 -0
- package/src/api-public/services/strategies/paynow-strategy.ts +29 -0
- package/src/api-public/services/strategies/paypal-strategy.d.ts +8 -0
- package/src/api-public/services/strategies/paypal-strategy.js +28 -0
- package/src/api-public/services/strategies/paypal-strategy.js.map +1 -0
- package/src/api-public/services/strategies/paypal-strategy.ts +31 -0
- package/src/api-public/services/updated-table-checked.d.ts +1 -0
- package/src/api-public/services/updated-table-checked.js +37 -15
- package/src/api-public/services/updated-table-checked.js.map +1 -1
- package/src/api-public/services/updated-table-checked.ts +56 -36
- package/src/api-public/utils/ut-permission.d.ts +1 -0
- package/src/app-project/serverless/src/index.js +17 -7
- package/src/app-project/serverless/src/index.js.map +1 -1
- package/src/app-project/serverless/src/modules/CryptoJS.js +17 -7
- package/src/app-project/serverless/src/modules/CryptoJS.js.map +1 -1
- package/src/app-project/serverless/src/modules/ssh.js +17 -7
- package/src/app-project/serverless/src/modules/ssh.js.map +1 -1
- package/src/config.d.ts +1 -1
- package/src/modules/AWSLib.js +3 -2
- package/src/modules/AWSLib.js.map +1 -1
- package/src/modules/CryptoJS.js +17 -7
- package/src/modules/CryptoJS.js.map +1 -1
- package/src/modules/database.d.ts +1 -1
- package/src/modules/redis.d.ts +1 -1
- package/src/modules/ssh.js +17 -7
- package/src/modules/ssh.js.map +1 -1
- package/src/modules/tool.d.ts +4 -4
- package/src/modules/tool.js +2 -1
- package/src/modules/tool.js.map +1 -1
- package/src/run.js +2 -1
- package/src/run.js.map +1 -1
- package/src/services/create-instance.js +4 -3
- package/src/services/create-instance.js.map +1 -1
- package/src/services/saas-table-check.js +2 -2
- package/src/services/saas-table-check.js.map +5 -1
- package/src/services/tool.js +3 -2
- package/src/services/tool.js.map +1 -1
- package/vp00rqhw1r.json +1 -0
- package/src/api-public/services/product-migrate.d.ts +0 -8
- package/src/api-public/services/product-migrate.js.map +0 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface EcEzPayKeyData {
|
|
2
|
+
HASH_IV: string;
|
|
3
|
+
HASH_KEY: string;
|
|
4
|
+
ActionURL: string;
|
|
5
|
+
NotifyURL: string;
|
|
6
|
+
ReturnURL: string;
|
|
7
|
+
MERCHANT_ID: string;
|
|
8
|
+
TYPE: 'ecPay';
|
|
9
|
+
}
|
|
10
|
+
export interface PayPalKeyData {
|
|
11
|
+
NotifyURL: string;
|
|
12
|
+
ReturnURL: string;
|
|
13
|
+
PAYPAL_CLIENT_ID: string;
|
|
14
|
+
PAYPAL_SECRET: string;
|
|
15
|
+
TYPE: 'PayPal';
|
|
16
|
+
BETA: string;
|
|
17
|
+
}
|
|
18
|
+
export interface LinePayKeyData {
|
|
19
|
+
BETA: string;
|
|
20
|
+
CLIENT_ID: string;
|
|
21
|
+
SECRET: string;
|
|
22
|
+
ReturnURL: string;
|
|
23
|
+
}
|
|
24
|
+
export interface JkoPayKeyData {
|
|
25
|
+
API_KEY: string;
|
|
26
|
+
NotifyURL: string;
|
|
27
|
+
ReturnURL: string;
|
|
28
|
+
SECRET_KEY: string;
|
|
29
|
+
STORE_ID: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PayNowKeyData {
|
|
32
|
+
PublicKey: string;
|
|
33
|
+
PrivateKey: string;
|
|
34
|
+
ReturnURL: string;
|
|
35
|
+
NotifyURL: string;
|
|
36
|
+
BETA: string;
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-keys-interface.js","sourceRoot":"","sources":["payment-keys-interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// EcPay / EzPay (藍新) 可能需要的金鑰
|
|
2
|
+
export interface EcEzPayKeyData {
|
|
3
|
+
HASH_IV: string,
|
|
4
|
+
HASH_KEY: string,
|
|
5
|
+
ActionURL: string,
|
|
6
|
+
NotifyURL: string,
|
|
7
|
+
ReturnURL: string,
|
|
8
|
+
MERCHANT_ID: string,
|
|
9
|
+
TYPE: 'ecPay' ,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// PayPal 需要的金鑰
|
|
13
|
+
export interface PayPalKeyData {
|
|
14
|
+
NotifyURL: string,
|
|
15
|
+
ReturnURL: string,
|
|
16
|
+
PAYPAL_CLIENT_ID: string,
|
|
17
|
+
PAYPAL_SECRET: string,
|
|
18
|
+
TYPE: 'PayPal',
|
|
19
|
+
BETA: string,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Line Pay 需要的金鑰
|
|
23
|
+
export interface LinePayKeyData {
|
|
24
|
+
BETA: string,
|
|
25
|
+
CLIENT_ID: string,
|
|
26
|
+
SECRET: string,
|
|
27
|
+
ReturnURL: string,
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// JKO Pay 需要的金鑰
|
|
31
|
+
export interface JkoPayKeyData {
|
|
32
|
+
API_KEY: string,
|
|
33
|
+
NotifyURL: string,
|
|
34
|
+
ReturnURL: string,
|
|
35
|
+
SECRET_KEY: string,
|
|
36
|
+
STORE_ID: string,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// PayNow (立吉付) 需要的金鑰
|
|
40
|
+
export interface PayNowKeyData {
|
|
41
|
+
PublicKey:string,
|
|
42
|
+
PrivateKey:string,
|
|
43
|
+
ReturnURL:string,
|
|
44
|
+
NotifyURL:string,
|
|
45
|
+
BETA:string
|
|
46
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Cart } from '../shopping.js';
|
|
2
|
+
export interface PaymentResult {
|
|
3
|
+
form?: string;
|
|
4
|
+
orderId?: string;
|
|
5
|
+
approveLink?: string;
|
|
6
|
+
responseData?: any;
|
|
7
|
+
off_line?: boolean;
|
|
8
|
+
error?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PaymentConfig {
|
|
11
|
+
app: string;
|
|
12
|
+
id: string;
|
|
13
|
+
domain: string;
|
|
14
|
+
}
|
|
15
|
+
export interface IPaymentStrategy {
|
|
16
|
+
initiatePayment(orderData: Cart, config: PaymentConfig): Promise<PaymentResult>;
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payment-strategy-interface.js","sourceRoot":"","sources":["payment-strategy-interface.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Cart } from '../shopping.js';
|
|
2
|
+
import { KeyData } from '../financial-serviceV2.js';
|
|
3
|
+
|
|
4
|
+
// export interface KeyData {
|
|
5
|
+
// MERCHANT_ID: string;
|
|
6
|
+
// HASH_KEY: string;
|
|
7
|
+
// HASH_IV: string;
|
|
8
|
+
// NotifyURL: string;
|
|
9
|
+
// ReturnURL: string;
|
|
10
|
+
// ActionURL: string;
|
|
11
|
+
// TYPE: string;
|
|
12
|
+
// CreditCheckCode?: string;
|
|
13
|
+
// }
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 定義支付策略執行後的回傳結果結構
|
|
17
|
+
*/
|
|
18
|
+
export interface PaymentResult {
|
|
19
|
+
form?: string; // For EcPay, EzPay HTML form string
|
|
20
|
+
orderId?:string; // For PayPal redirect link
|
|
21
|
+
approveLink?:string; // For PayPal redirect link
|
|
22
|
+
responseData?: any; // For LinePay, JKOpay API response
|
|
23
|
+
off_line?: boolean; // Flag for offline payment
|
|
24
|
+
error?: string; // Optional error message
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* 定義傳遞給策略的通用設定物件結構
|
|
29
|
+
*/
|
|
30
|
+
export interface PaymentConfig {
|
|
31
|
+
app: string; // App 名稱/ID
|
|
32
|
+
id: string; // 產生的 redirect id (用於 ReturnURL)
|
|
33
|
+
domain: string; // process.env.DOMAIN
|
|
34
|
+
// 這裡還有line jko...的方式
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 定義支付策略的通用介面 (合約)
|
|
39
|
+
*/
|
|
40
|
+
export interface IPaymentStrategy {
|
|
41
|
+
/**
|
|
42
|
+
* 啟動支付流程
|
|
43
|
+
* @param orderData - 訂單相關資料 (建議使用更精確的型別取代 any)
|
|
44
|
+
* @param config - 通用的支付設定檔
|
|
45
|
+
* @returns 一個 Promise,解析後為標準化的 PaymentResult
|
|
46
|
+
*/
|
|
47
|
+
initiatePayment(orderData: Cart, config: PaymentConfig): Promise<PaymentResult>;
|
|
48
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.MigratePublicUserConfig = void 0;
|
|
7
|
+
const database_js_1 = __importDefault(require("../../../modules/database.js"));
|
|
8
|
+
const tool_js_1 = __importDefault(require("../../../modules/tool.js"));
|
|
9
|
+
const user_js_1 = require("../user.js");
|
|
10
|
+
class MigratePublicUserConfig {
|
|
11
|
+
constructor(app_name) {
|
|
12
|
+
this.app_name = app_name;
|
|
13
|
+
}
|
|
14
|
+
async setLogisticsGroup() {
|
|
15
|
+
var _a;
|
|
16
|
+
const app_name = this.app_name;
|
|
17
|
+
function compareArray(arr1, arr2) {
|
|
18
|
+
const slice1 = arr1.slice().sort();
|
|
19
|
+
const slice2 = arr2.slice().sort();
|
|
20
|
+
if (slice1.length !== slice2.length)
|
|
21
|
+
return false;
|
|
22
|
+
for (let i = 0; i < slice1.length; i++) {
|
|
23
|
+
if (slice1[i] !== slice2[i])
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
const publicConfigResult = await database_js_1.default.query(`SELECT * FROM \`${app_name}\`.t_user_public_config WHERE \`key\` = 'logistics_group'
|
|
29
|
+
`, []);
|
|
30
|
+
if (publicConfigResult.length > 0) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
const getData = await database_js_1.default.query(`
|
|
34
|
+
SELECT GROUP_CONCAT(DISTINCT JSON_UNQUOTE(JSON_EXTRACT(content, '$.designated_logistics.list')) SEPARATOR ',')
|
|
35
|
+
AS unique_tags
|
|
36
|
+
FROM \`${app_name}\`.t_manager_post
|
|
37
|
+
WHERE JSON_UNQUOTE(JSON_EXTRACT(content, '$.designated_logistics')) IS NOT NULL;
|
|
38
|
+
`, []);
|
|
39
|
+
const unique_tags_string = (_a = getData[0].unique_tags) !== null && _a !== void 0 ? _a : '';
|
|
40
|
+
const unique_tags_json = JSON.parse(`[${unique_tags_string}]`);
|
|
41
|
+
const unique_tags_array = Array.isArray(unique_tags_json) ? unique_tags_json : [];
|
|
42
|
+
const groupArray = [];
|
|
43
|
+
unique_tags_array.map(list => {
|
|
44
|
+
if (list.length > 0) {
|
|
45
|
+
const isUnique = groupArray.every(group => !compareArray(group.list, list));
|
|
46
|
+
if (isUnique) {
|
|
47
|
+
groupArray.push({
|
|
48
|
+
key: tool_js_1.default.randomString(8),
|
|
49
|
+
name: `物流組合${groupArray.length + 1}`,
|
|
50
|
+
list: list,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
await new user_js_1.User(app_name).setConfig({
|
|
56
|
+
key: 'logistics_group',
|
|
57
|
+
user_id: 'manager',
|
|
58
|
+
value: groupArray,
|
|
59
|
+
});
|
|
60
|
+
const getProductList = await database_js_1.default.query(`
|
|
61
|
+
SELECT * FROM \`${app_name}\`.t_manager_post
|
|
62
|
+
WHERE JSON_UNQUOTE(JSON_EXTRACT(content, '$.designated_logistics')) IS NOT NULL;
|
|
63
|
+
`, []);
|
|
64
|
+
for (const product of getProductList) {
|
|
65
|
+
const data = product.content.designated_logistics;
|
|
66
|
+
if (!data.group && data.type === 'designated') {
|
|
67
|
+
const findGroup = groupArray.find(group => compareArray(group.list, data.list));
|
|
68
|
+
if (findGroup) {
|
|
69
|
+
data.group = [findGroup.key];
|
|
70
|
+
const updateResult = await database_js_1.default.query(`UPDATE \`${app_name}\`.t_manager_post SET ? WHERE id = ?
|
|
71
|
+
`, [{ content: JSON.stringify(product.content) }, product.id]);
|
|
72
|
+
if (updateResult.affectedRows === 0) {
|
|
73
|
+
console.error(`Product with ID ${product.id} not found.`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.MigratePublicUserConfig = MigratePublicUserConfig;
|
|
81
|
+
//# sourceMappingURL=public-user-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-user-config.js","sourceRoot":"","sources":["public-user-config.ts"],"names":[],"mappings":";;;;;;AAAA,+EAA8C;AAC9C,uEAA4C;AAC5C,wCAAkC;AAElC,MAAa,uBAAuB;IAGlC,YAAY,QAAgB;QAC1B,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,KAAK,CAAC,iBAAiB;;QACrB,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAE/B,SAAS,YAAY,CAAC,IAAc,EAAE,IAAc;YAClD,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;YACnC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,MAAM,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM;gBAAE,OAAO,KAAK,CAAC;YAElD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;gBACvC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC;oBAAE,OAAO,KAAK,CAAC;YAC5C,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,kBAAkB,GAAG,MAAM,qBAAE,CAAC,KAAK,CACvC,mBAAmB,QAAQ;OAC1B,EACD,EAAE,CACH,CAAC;QAEF,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAClC,OAAO;QACT,CAAC;QAED,MAAM,OAAO,GAAG,MAAM,qBAAE,CAAC,KAAK,CAC5B;;;iBAGW,QAAQ;;OAElB,EACD,EAAE,CACH,CAAC;QAMF,MAAM,kBAAkB,GAAG,MAAA,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,mCAAI,EAAE,CAAC;QACxD,MAAM,gBAAgB,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,kBAAkB,GAAG,CAAC,CAAC;QAC/D,MAAM,iBAAiB,GAAe,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9F,MAAM,UAAU,GAAoD,EAAE,CAAC;QAEvE,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YAC3B,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACpB,MAAM,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;gBAE5E,IAAI,QAAQ,EAAE,CAAC;oBACb,UAAU,CAAC,IAAI,CAAC;wBACd,GAAG,EAAE,iBAAI,CAAC,YAAY,CAAC,CAAC,CAAC;wBACzB,IAAI,EAAE,OAAO,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;wBACpC,IAAI,EAAE,IAAI;qBACX,CAAC,CAAC;gBACL,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,IAAI,cAAI,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC;YACjC,GAAG,EAAE,iBAAiB;YACtB,OAAO,EAAE,SAAS;YAClB,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;QAEH,MAAM,cAAc,GAAG,MAAM,qBAAE,CAAC,KAAK,CACnC;0BACoB,QAAQ;;OAE3B,EACD,EAAE,CACH,CAAC;QAEF,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE,CAAC;YACrC,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC;YAElD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC9C,MAAM,SAAS,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;gBAEhF,IAAI,SAAS,EAAE,CAAC;oBACd,IAAI,CAAC,KAAK,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;oBAE7B,MAAM,YAAY,GAAG,MAAM,qBAAE,CAAC,KAAK,CACjC,YAAY,QAAQ;aACnB,EACD,CAAC,EAAE,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,EAAE,CAAC,CAC3D,CAAC;oBAEF,IAAI,YAAY,CAAC,YAAY,KAAK,CAAC,EAAE,CAAC;wBACpC,OAAO,CAAC,KAAK,CAAC,mBAAmB,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;oBAC5D,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;IACH,CAAC;CACF;AArGD,0DAqGC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import db from '../../../modules/database.js';
|
|
2
|
+
import tool from '../../../modules/tool.js';
|
|
3
|
+
import { User } from '../user.js';
|
|
4
|
+
|
|
5
|
+
export class MigratePublicUserConfig {
|
|
6
|
+
app_name: string;
|
|
7
|
+
|
|
8
|
+
constructor(app_name: string) {
|
|
9
|
+
this.app_name = app_name;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async setLogisticsGroup() {
|
|
13
|
+
const app_name = this.app_name;
|
|
14
|
+
|
|
15
|
+
function compareArray(arr1: string[], arr2: string[]) {
|
|
16
|
+
const slice1 = arr1.slice().sort();
|
|
17
|
+
const slice2 = arr2.slice().sort();
|
|
18
|
+
if (slice1.length !== slice2.length) return false;
|
|
19
|
+
|
|
20
|
+
for (let i = 0; i < slice1.length; i++) {
|
|
21
|
+
if (slice1[i] !== slice2[i]) return false;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const publicConfigResult = await db.query(
|
|
28
|
+
`SELECT * FROM \`${app_name}\`.t_user_public_config WHERE \`key\` = 'logistics_group'
|
|
29
|
+
`,
|
|
30
|
+
[]
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (publicConfigResult.length > 0) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const getData = await db.query(
|
|
38
|
+
`
|
|
39
|
+
SELECT GROUP_CONCAT(DISTINCT JSON_UNQUOTE(JSON_EXTRACT(content, '$.designated_logistics.list')) SEPARATOR ',')
|
|
40
|
+
AS unique_tags
|
|
41
|
+
FROM \`${app_name}\`.t_manager_post
|
|
42
|
+
WHERE JSON_UNQUOTE(JSON_EXTRACT(content, '$.designated_logistics')) IS NOT NULL;
|
|
43
|
+
`,
|
|
44
|
+
[]
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
// if (getData.length === 0) {
|
|
48
|
+
// return;
|
|
49
|
+
// }
|
|
50
|
+
|
|
51
|
+
const unique_tags_string = getData[0].unique_tags ?? '';
|
|
52
|
+
const unique_tags_json = JSON.parse(`[${unique_tags_string}]`);
|
|
53
|
+
const unique_tags_array: string[][] = Array.isArray(unique_tags_json) ? unique_tags_json : [];
|
|
54
|
+
const groupArray: { key: string; name: string; list: string[] }[] = [];
|
|
55
|
+
|
|
56
|
+
unique_tags_array.map(list => {
|
|
57
|
+
if (list.length > 0) {
|
|
58
|
+
const isUnique = groupArray.every(group => !compareArray(group.list, list));
|
|
59
|
+
|
|
60
|
+
if (isUnique) {
|
|
61
|
+
groupArray.push({
|
|
62
|
+
key: tool.randomString(8),
|
|
63
|
+
name: `物流組合${groupArray.length + 1}`,
|
|
64
|
+
list: list,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
await new User(app_name).setConfig({
|
|
71
|
+
key: 'logistics_group',
|
|
72
|
+
user_id: 'manager',
|
|
73
|
+
value: groupArray,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const getProductList = await db.query(
|
|
77
|
+
`
|
|
78
|
+
SELECT * FROM \`${app_name}\`.t_manager_post
|
|
79
|
+
WHERE JSON_UNQUOTE(JSON_EXTRACT(content, '$.designated_logistics')) IS NOT NULL;
|
|
80
|
+
`,
|
|
81
|
+
[]
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
for (const product of getProductList) {
|
|
85
|
+
const data = product.content.designated_logistics;
|
|
86
|
+
|
|
87
|
+
if (!data.group && data.type === 'designated') {
|
|
88
|
+
const findGroup = groupArray.find(group => compareArray(group.list, data.list));
|
|
89
|
+
|
|
90
|
+
if (findGroup) {
|
|
91
|
+
data.group = [findGroup.key];
|
|
92
|
+
|
|
93
|
+
const updateResult = await db.query(
|
|
94
|
+
`UPDATE \`${app_name}\`.t_manager_post SET ? WHERE id = ?
|
|
95
|
+
`,
|
|
96
|
+
[{ content: JSON.stringify(product.content) }, product.id]
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
if (updateResult.affectedRows === 0) {
|
|
100
|
+
console.error(`Product with ID ${product.id} not found.`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -1,36 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const process_1 = __importDefault(require("process"));
|
|
30
|
-
const financial_service_js_1 = __importStar(require("../financial-service.js"));
|
|
31
3
|
const private_config_js_1 = require("../../../services/private_config.js");
|
|
32
|
-
const tool_js_1 = __importDefault(require("../../../modules/tool.js"));
|
|
33
|
-
const redis_1 = __importDefault(require("../../../modules/redis"));
|
|
34
4
|
const mime = require('mime');
|
|
35
5
|
class PaymentTransaction {
|
|
36
6
|
constructor(app, payment_select) {
|
|
@@ -57,44 +27,6 @@ class PaymentTransaction {
|
|
|
57
27
|
if (!this.kd) {
|
|
58
28
|
await this.createInstance();
|
|
59
29
|
}
|
|
60
|
-
const id = 'redirect_' + tool_js_1.default.randomString(6);
|
|
61
|
-
await redis_1.default.setValue(id, return_url);
|
|
62
|
-
switch (this.payment_select) {
|
|
63
|
-
case 'ecPay':
|
|
64
|
-
case 'newWebPay':
|
|
65
|
-
const subMitData = await new financial_service_js_1.default(this.app, {
|
|
66
|
-
HASH_IV: this.kd.HASH_IV,
|
|
67
|
-
HASH_KEY: this.kd.HASH_KEY,
|
|
68
|
-
ActionURL: this.kd.ActionURL,
|
|
69
|
-
NotifyURL: `${process_1.default.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`,
|
|
70
|
-
ReturnURL: `${process_1.default.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`,
|
|
71
|
-
MERCHANT_ID: this.kd.MERCHANT_ID,
|
|
72
|
-
TYPE: this.payment_select,
|
|
73
|
-
}).createOrderPage(carData);
|
|
74
|
-
return { form: subMitData };
|
|
75
|
-
case 'paypal':
|
|
76
|
-
this.kd.ReturnURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`;
|
|
77
|
-
this.kd.NotifyURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`;
|
|
78
|
-
return await new financial_service_js_1.PayPal(this.app, this.kd).checkout(carData);
|
|
79
|
-
case 'line_pay':
|
|
80
|
-
this.kd.ReturnURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}&type=${this.payment_select}`;
|
|
81
|
-
this.kd.NotifyURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${this.payment_select}`;
|
|
82
|
-
return await new financial_service_js_1.LinePay(this.app, this.kd).createOrder(carData);
|
|
83
|
-
case 'paynow': {
|
|
84
|
-
this.kd.ReturnURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}&type=${carData.customer_info.payment_select}`;
|
|
85
|
-
this.kd.NotifyURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&paynow=true&type=${carData.customer_info.payment_select}`;
|
|
86
|
-
return await new financial_service_js_1.PayNow(this.app, this.kd).createOrder(carData);
|
|
87
|
-
}
|
|
88
|
-
case 'jkopay': {
|
|
89
|
-
this.kd.ReturnURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&jkopay=true&return=${id}`;
|
|
90
|
-
this.kd.NotifyURL = `${process_1.default.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=jkopay&return=${id}`;
|
|
91
|
-
return await new financial_service_js_1.JKO(this.app, this.kd).createOrder(carData);
|
|
92
|
-
}
|
|
93
|
-
default: {
|
|
94
|
-
carData.method = 'off_line';
|
|
95
|
-
return ``;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
30
|
}
|
|
99
31
|
}
|
|
100
32
|
exports.default = PaymentTransaction;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handlePaymentTransaction.js","sourceRoot":"","sources":["handlePaymentTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"handlePaymentTransaction.js","sourceRoot":"","sources":["handlePaymentTransaction.ts"],"names":[],"mappings":";;AAOA,2EAAqE;AAKrE,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAG7B,MAAM,kBAAkB;IAKtB,YAAY,GAAW,EAAE,cAAsB;QAC7C,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,cAAc;;QAClB,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,CACd,MAAM,kCAAc,CAAC,SAAS,CAAC;gBAC7B,OAAO,EAAE,IAAI,CAAC,GAAG;gBACjB,GAAG,EAAE,iBAAiB;aACvB,CAAC,CACH,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YACX,IAAI,CAAC,EAAE,GAAG,MAAA,OAAO,CAAC,IAAI,CAAC,cAAc,CAAC,mCAAI;gBACxC,SAAS,EAAE,EAAE;gBACb,SAAS,EAAE,EAAE;aACd,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAEf,MAAM,IAAI,KAAK,CAAC,sCAAsC,KAAK,EAAE,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAW,EAAG,UAAiB;QAClD,IAAI,CAAC,IAAI,CAAC,EAAE,EAAC,CAAC;YACZ,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAC9B,CAAC;IAgEH,CAAC;CACF;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -5,10 +5,10 @@ import {App} from '../../../services/app.js';
|
|
|
5
5
|
import process from "process";
|
|
6
6
|
import {User} from "../user";
|
|
7
7
|
import { CustomerSessions } from '../customer-sessions';
|
|
8
|
-
import FinancialService, { JKO, LinePay, PayNow, PayPal } from '../financial-service.js';
|
|
9
8
|
import { Private_config } from '../../../services/private_config.js';
|
|
10
9
|
import Tool from '../../../modules/tool.js';
|
|
11
10
|
import redis from '../../../modules/redis';
|
|
11
|
+
import { JKOV2, LinePayV2, PayNowV2, PayPalV2 } from '../financial-serviceV2.js';
|
|
12
12
|
|
|
13
13
|
const mime = require('mime');
|
|
14
14
|
|
|
@@ -45,61 +45,69 @@ class PaymentTransaction {
|
|
|
45
45
|
if (!this.kd){
|
|
46
46
|
await this.createInstance();
|
|
47
47
|
}
|
|
48
|
-
const id = 'redirect_' + Tool.randomString(6);
|
|
49
|
-
await redis.setValue(id, return_url);
|
|
50
48
|
|
|
51
|
-
switch (this.payment_select) {
|
|
52
|
-
case 'ecPay':
|
|
53
|
-
case 'newWebPay':
|
|
54
|
-
const subMitData = await new FinancialService(this.app, {
|
|
55
|
-
HASH_IV: this.kd.HASH_IV,
|
|
56
|
-
HASH_KEY: this.kd.HASH_KEY,
|
|
57
|
-
ActionURL: this.kd.ActionURL,
|
|
58
|
-
NotifyURL: `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`,
|
|
59
|
-
ReturnURL: `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`,
|
|
60
|
-
MERCHANT_ID: this.kd.MERCHANT_ID,
|
|
61
|
-
TYPE: this.payment_select,
|
|
62
|
-
}).createOrderPage(carData);
|
|
63
|
-
return { form: subMitData };
|
|
64
|
-
case 'paypal':
|
|
65
|
-
this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`;
|
|
66
|
-
this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`;
|
|
67
|
-
return await new PayPal(this.app, this.kd).checkout(carData);
|
|
68
|
-
case 'line_pay':
|
|
69
|
-
this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}&type=${this.payment_select}`;
|
|
70
|
-
this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${this.payment_select}`;
|
|
71
|
-
return await new LinePay(this.app, this.kd).createOrder(carData);
|
|
72
|
-
case 'paynow': {
|
|
73
|
-
this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}&type=${carData.customer_info.payment_select}`;
|
|
74
|
-
this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&paynow=true&type=${carData.customer_info.payment_select}`;
|
|
75
|
-
return await new PayNow(this.app , this.kd).createOrder(carData);
|
|
76
|
-
}
|
|
77
|
-
case 'jkopay': {
|
|
78
|
-
this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&jkopay=true&return=${id}`;
|
|
79
|
-
this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=jkopay&return=${id}`;
|
|
80
|
-
return await new JKO(this.app, this.kd).createOrder(carData);
|
|
81
|
-
}
|
|
82
49
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
50
|
+
// switch (this.payment_select) {
|
|
51
|
+
// case 'ecPay':
|
|
52
|
+
// return await new EzPayV2(this.app, {
|
|
53
|
+
// HASH_IV: this.kd.HASH_IV,
|
|
54
|
+
// HASH_KEY: this.kd.HASH_KEY,
|
|
55
|
+
// ActionURL: this.kd.ActionURL,
|
|
56
|
+
// NotifyURL: `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`,
|
|
57
|
+
// ReturnURL: `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`,
|
|
58
|
+
// MERCHANT_ID: this.kd.MERCHANT_ID,
|
|
59
|
+
// TYPE: this.payment_select,
|
|
60
|
+
// }).initiatePayment(carData) ;
|
|
61
|
+
// case 'newWebPay':
|
|
62
|
+
// return { form: await new EzPayV2(this.app, {
|
|
63
|
+
// HASH_IV: this.kd.HASH_IV,
|
|
64
|
+
// HASH_KEY: this.kd.HASH_KEY,
|
|
65
|
+
// ActionURL: this.kd.ActionURL,
|
|
66
|
+
// NotifyURL: `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`,
|
|
67
|
+
// ReturnURL: `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`,
|
|
68
|
+
// MERCHANT_ID: this.kd.MERCHANT_ID,
|
|
69
|
+
// TYPE: this.payment_select,
|
|
70
|
+
// }).createOrderPage(carData) };
|
|
71
|
+
//
|
|
72
|
+
// case 'paypal':
|
|
73
|
+
// this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}`;
|
|
74
|
+
// this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${carData.customer_info.payment_select}`;
|
|
75
|
+
// return await new PayPalV2(this.app, this.kd).checkout(carData);
|
|
76
|
+
// case 'line_pay':
|
|
77
|
+
// this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}&type=${this.payment_select}`;
|
|
78
|
+
// this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=${this.payment_select}`;
|
|
79
|
+
// return await new LinePayV2(this.app, this.kd).createOrder(carData);
|
|
80
|
+
// case 'paynow': {
|
|
81
|
+
// this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}&type=${carData.customer_info.payment_select}`;
|
|
82
|
+
// this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&paynow=true&type=${carData.customer_info.payment_select}`;
|
|
83
|
+
// return await new PayNowV2(this.app , this.kd).createOrder(carData);
|
|
84
|
+
// }
|
|
85
|
+
// case 'jkopay': {
|
|
86
|
+
// this.kd.ReturnURL = `${process.env.DOMAIN}/api-public/v1/ec/redirect?g-app=${this.app}&jkopay=true&return=${id}`;
|
|
87
|
+
// this.kd.NotifyURL = `${process.env.DOMAIN}/api-public/v1/ec/notify?g-app=${this.app}&type=jkopay&return=${id}`;
|
|
88
|
+
// return await new JKOV2(this.app, this.kd).createOrder(carData);
|
|
89
|
+
// }
|
|
90
|
+
//
|
|
91
|
+
// default: {
|
|
92
|
+
// carData.method = 'off_line';
|
|
93
|
+
// return ``;
|
|
94
|
+
// }
|
|
95
|
+
// //
|
|
96
|
+
// // if (carData.customer_info.lineID) {
|
|
97
|
+
// // await this.lineMessage.sendCustomerLine('auto-line-order-create', carData.orderID, carData.customer_info.lineID);
|
|
98
|
+
// // console.info('訂單line訊息寄送成功');
|
|
99
|
+
// // }
|
|
100
|
+
// //
|
|
101
|
+
// // for (const email of new Set([carData.customer_info, carData.user_info].map(dd => dd && dd.email))) {
|
|
102
|
+
// // if (email) {
|
|
103
|
+
// // this.autoSendEmail.customerOrder(this.app, 'auto-email-order-create', carData.orderID, email, carData.language!!);
|
|
104
|
+
// // }
|
|
105
|
+
// // }
|
|
106
|
+
// //
|
|
107
|
+
// // await this.releaseVoucherHistory(carData.orderID, 1);
|
|
108
|
+
// // this.checkPoint('default release checkout');
|
|
109
|
+
// // return { off_line: true, return_url: `${this.processEnvDomain}/api-public/v1/ec/redirect?g-app=${this.app}&return=${id}` };
|
|
110
|
+
// }
|
|
103
111
|
}
|
|
104
112
|
}
|
|
105
113
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IPaymentStrategy, PaymentResult } from './interface/payment-strategy-interface.js';
|
|
2
|
+
import { Cart } from './shopping.js';
|
|
3
|
+
export declare class PaymentService {
|
|
4
|
+
private paymentStrategies;
|
|
5
|
+
private kd;
|
|
6
|
+
private app;
|
|
7
|
+
private domain;
|
|
8
|
+
private payment_select;
|
|
9
|
+
constructor(paymentStrategies: Map<string, IPaymentStrategy>, appName: string, payment_select: string);
|
|
10
|
+
private createInstance;
|
|
11
|
+
processPayment(carData: Cart, return_url: string, payment_select: string): Promise<PaymentResult>;
|
|
12
|
+
}
|