@chevre/domain 21.7.0-alpha.4 → 21.7.0-alpha.6
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/lib/chevre/emailMessageBuilder.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/factory.js +37 -45
- package/lib/chevre/service/payment/any/factory.js +4 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +6 -9
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +2 -2
- package/lib/chevre/settings.d.ts +1 -0
- package/lib/chevre/settings.js +2 -1
- package/package.json +2 -2
|
@@ -24,6 +24,6 @@ export declare function createReturnOrderMessage(params: {
|
|
|
24
24
|
*/
|
|
25
25
|
export declare function createRefundMessage(params: {
|
|
26
26
|
order: factory.order.IOrder;
|
|
27
|
-
paymentMethods: factory.order.
|
|
27
|
+
paymentMethods: factory.order.IReferencedInvoice[];
|
|
28
28
|
email?: factory.creativeWork.message.email.ICustomization;
|
|
29
29
|
}): Promise<factory.creativeWork.message.email.ICreativeWork>;
|
|
@@ -6,6 +6,6 @@ export declare function createStartParams(params: factory.assetTransaction.pay.I
|
|
|
6
6
|
transactionNumber: string;
|
|
7
7
|
paymentServiceType: factory.service.paymentService.PaymentServiceType;
|
|
8
8
|
amount: number;
|
|
9
|
-
paymentService?: factory.service.paymentService.IService;
|
|
9
|
+
paymentService?: factory.service.paymentService.IService | factory.product.IProduct;
|
|
10
10
|
location?: factory.action.trade.pay.ILocation;
|
|
11
11
|
}): factory.assetTransaction.IStartParams<factory.assetTransactionType.Pay>;
|
|
@@ -5,9 +5,10 @@ exports.createStartParams = void 0;
|
|
|
5
5
|
* 決済取引ファクトリー
|
|
6
6
|
*/
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
|
+
const settings_1 = require("../../../settings");
|
|
8
9
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
9
10
|
function createStartParams(params) {
|
|
10
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
11
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
|
|
11
12
|
const paymentServiceId = (params.paymentService !== undefined)
|
|
12
13
|
? String(params.paymentService.id)
|
|
13
14
|
: '';
|
|
@@ -54,54 +55,47 @@ function createStartParams(params) {
|
|
|
54
55
|
default:
|
|
55
56
|
// no op
|
|
56
57
|
}
|
|
57
|
-
const informPaymentParams = createInformPaymentParams({
|
|
58
|
+
const informPaymentParams = createInformPaymentParams({
|
|
59
|
+
paymentService: params.paymentService
|
|
60
|
+
});
|
|
58
61
|
const accountId = (_g = params.object.paymentMethod) === null || _g === void 0 ? void 0 : _g.accountId;
|
|
59
62
|
// currencyはデフォルトでJPY
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
63
|
+
let paymentMethodCurrency = factory.priceCurrency.JPY;
|
|
64
|
+
if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.PaymentCard) {
|
|
65
|
+
const paymentCardServiceOutputCurrency = (_k = (_j = (_h = params.paymentService) === null || _h === void 0 ? void 0 : _h.serviceOutput) === null || _j === void 0 ? void 0 : _j.amount) === null || _k === void 0 ? void 0 : _k.currency;
|
|
66
|
+
if (typeof paymentCardServiceOutputCurrency === 'string') {
|
|
67
|
+
paymentMethodCurrency = paymentCardServiceOutputCurrency;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
71
|
+
// カード通貨区分が存在すれば適用
|
|
72
|
+
const creditCardAsPaymentServiceOutputCurrency = (_p = (_o = (_m = (_l = params.paymentService) === null || _l === void 0 ? void 0 : _l.serviceOutput) === null || _m === void 0 ? void 0 : _m.paymentMethod) === null || _o === void 0 ? void 0 : _o.amount) === null || _p === void 0 ? void 0 : _p.currency;
|
|
73
|
+
if (typeof creditCardAsPaymentServiceOutputCurrency === 'string') {
|
|
74
|
+
paymentMethodCurrency = creditCardAsPaymentServiceOutputCurrency;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
const paymentMethodAmount = {
|
|
78
|
+
typeOf: 'MonetaryAmount',
|
|
79
|
+
currency: paymentMethodCurrency,
|
|
80
|
+
value: params.amount
|
|
81
|
+
};
|
|
82
|
+
const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.additionalProperty))
|
|
83
|
+
? (_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.additionalProperty
|
|
84
|
+
: [], name: (typeof ((_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.name) === 'string')
|
|
79
85
|
? params.object.paymentMethod.name
|
|
80
86
|
: paymentMethodType,
|
|
81
|
-
//
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
// amount: paymentMethodAmount,
|
|
85
|
-
paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_l = params.object.paymentMethod) === null || _l === void 0 ? void 0 : _l.description) === 'string')
|
|
86
|
-
? { description: (_m = params.object.paymentMethod) === null || _m === void 0 ? void 0 : _m.description }
|
|
87
|
+
// MonetaryAmount対応(2023-08-14~)
|
|
88
|
+
amount: (settings_1.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT) ? paymentMethodAmount : params.amount, paymentMethodId: params.transactionNumber, typeOf: paymentMethodType }, (typeof ((_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.description) === 'string')
|
|
89
|
+
? { description: (_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.description }
|
|
87
90
|
: undefined), (totalPaymentDue !== undefined)
|
|
88
91
|
? { totalPaymentDue: totalPaymentDue }
|
|
89
|
-
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((
|
|
90
|
-
? { method: (
|
|
91
|
-
: undefined), (((
|
|
92
|
-
? { creditCard: (
|
|
93
|
-
: undefined), (Array.isArray((
|
|
94
|
-
? { movieTickets: (
|
|
92
|
+
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.method) === 'string')
|
|
93
|
+
? { method: (_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.method }
|
|
94
|
+
: undefined), (((_x = params.object.paymentMethod) === null || _x === void 0 ? void 0 : _x.creditCard) !== undefined)
|
|
95
|
+
? { creditCard: (_y = params.object.paymentMethod) === null || _y === void 0 ? void 0 : _y.creditCard }
|
|
96
|
+
: undefined), (Array.isArray((_z = params.object.paymentMethod) === null || _z === void 0 ? void 0 : _z.movieTickets))
|
|
97
|
+
? { movieTickets: (_0 = params.object.paymentMethod) === null || _0 === void 0 ? void 0 : _0.movieTickets }
|
|
95
98
|
: undefined);
|
|
96
|
-
// const serviceOutput: factory.order.IOrderPaymentMethodIssuedThroughServiceOutput | undefined =
|
|
97
|
-
// (typeof creditCardAsPaymentServiceOutputCurrency === 'string')
|
|
98
|
-
// ? {
|
|
99
|
-
// amount: {
|
|
100
|
-
// currency: creditCardAsPaymentServiceOutputCurrency, // カード通貨区分
|
|
101
|
-
// value: paymentMethod.amount // 通貨区分としての金額
|
|
102
|
-
// }
|
|
103
|
-
// }
|
|
104
|
-
// : undefined;
|
|
105
99
|
const object = {
|
|
106
100
|
// パラメータから必要なもののみ取り込む
|
|
107
101
|
accountId: (typeof accountId === 'string') ? accountId : '',
|
|
@@ -110,10 +104,8 @@ function createStartParams(params) {
|
|
|
110
104
|
id: paymentServiceId,
|
|
111
105
|
onPaymentStatusChanged: { informPayment: informPaymentParams },
|
|
112
106
|
paymentMethod
|
|
113
|
-
// CreditCardIFのカード通貨区分を追加(2023-08-07~)
|
|
114
|
-
// ...(typeof serviceOutput !== undefined) ? { serviceOutput } : undefined
|
|
115
107
|
};
|
|
116
|
-
return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires }, (typeof ((
|
|
108
|
+
return Object.assign({ project: { typeOf: factory.organizationType.Project, id: params.project.id }, transactionNumber: params.transactionNumber, typeOf: factory.assetTransactionType.Pay, agent: params.agent, recipient: params.recipient, object, expires: params.expires }, (typeof ((_1 = params.location) === null || _1 === void 0 ? void 0 : _1.typeOf) === 'string')
|
|
117
109
|
? { location: params.location }
|
|
118
110
|
: undefined);
|
|
119
111
|
}
|
|
@@ -104,6 +104,9 @@ function createAuthorizeResult(params) {
|
|
|
104
104
|
// }
|
|
105
105
|
// : undefined
|
|
106
106
|
};
|
|
107
|
+
const paymentMethodAsObject = {
|
|
108
|
+
typeOf: params.object.paymentMethod
|
|
109
|
+
};
|
|
107
110
|
return {
|
|
108
111
|
accountId: (typeof ((_b = payTransactionObject.paymentMethod) === null || _b === void 0 ? void 0 : _b.accountId) === 'string')
|
|
109
112
|
? payTransactionObject.paymentMethod.accountId
|
|
@@ -112,6 +115,7 @@ function createAuthorizeResult(params) {
|
|
|
112
115
|
// amount: params.object.amount,
|
|
113
116
|
issuedThrough,
|
|
114
117
|
paymentMethod: params.object.paymentMethod,
|
|
118
|
+
paymentMethodAsObject,
|
|
115
119
|
paymentStatus: factory.paymentStatusType.PaymentDue,
|
|
116
120
|
paymentMethodId: (typeof ((_c = payTransactionObject.paymentMethod) === null || _c === void 0 ? void 0 : _c.paymentMethodId) === 'string')
|
|
117
121
|
? payTransactionObject.paymentMethod.paymentMethodId
|
|
@@ -70,16 +70,13 @@ function createPaymentMethods(params) {
|
|
|
70
70
|
});
|
|
71
71
|
// 決済方法をセット
|
|
72
72
|
authorizePaymentActions.forEach((a) => {
|
|
73
|
+
var _a, _b;
|
|
73
74
|
const result = a.result;
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
paymentMethodId: result.paymentMethodId,
|
|
80
|
-
totalPaymentDue: result.totalPaymentDue,
|
|
81
|
-
typeOf: result.paymentMethod
|
|
82
|
-
});
|
|
75
|
+
const paymentMethodAmountCurrencyByAuthorizeAction = (_b = (_a = result.paymentMethodAsObject) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
76
|
+
const paymentMethodOfInvoice = (typeof paymentMethodAmountCurrencyByAuthorizeAction === 'string') ?
|
|
77
|
+
{ amount: { currency: paymentMethodAmountCurrencyByAuthorizeAction } }
|
|
78
|
+
: undefined;
|
|
79
|
+
paymentMethods.push(Object.assign({ accountId: result.accountId, additionalProperty: (Array.isArray(result.additionalProperty)) ? result.additionalProperty : [], issuedThrough: result.issuedThrough, name: result.name, paymentMethodId: result.paymentMethodId, totalPaymentDue: result.totalPaymentDue, typeOf: result.paymentMethod }, (paymentMethodOfInvoice !== undefined) ? { paymentMethod: paymentMethodOfInvoice } : undefined));
|
|
83
80
|
});
|
|
84
81
|
// 決済方法から注文金額の計算
|
|
85
82
|
// price += authorizePaymentActions
|
|
@@ -214,9 +214,9 @@ function validatePaymentMethods(params) {
|
|
|
214
214
|
if (typeof settings_1.settings.maxNumCreditCardPaymentMethod === 'number') {
|
|
215
215
|
// CreditCard IFの決済方法の最大値検証
|
|
216
216
|
const creditCardPaymentMethodCount = params.order.paymentMethods.filter((p) => {
|
|
217
|
-
var _a, _b
|
|
217
|
+
var _a, _b;
|
|
218
218
|
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
219
|
-
const serviceOutputAmountCurrency = (
|
|
219
|
+
const serviceOutputAmountCurrency = (_b = (_a = p.paymentMethod) === null || _a === void 0 ? void 0 : _a.amount) === null || _b === void 0 ? void 0 : _b.currency;
|
|
220
220
|
return p.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.CreditCard
|
|
221
221
|
&& typeof serviceOutputAmountCurrency !== 'string';
|
|
222
222
|
}).length;
|
package/lib/chevre/settings.d.ts
CHANGED
|
@@ -40,6 +40,7 @@ export declare const USE_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
|
40
40
|
export declare const USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING: boolean;
|
|
41
41
|
export declare const USE_NEW_EVENT_AVAILABILITY_KEY_FROM: moment.Moment;
|
|
42
42
|
export declare const USE_ADVANCE_BOOKING_REQUIREMENT: boolean;
|
|
43
|
+
export declare const USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT: boolean;
|
|
43
44
|
export declare const INFORM_RESERVATION_TASK_DELAY_IN_SECONDS: number;
|
|
44
45
|
export declare const MONGO_MAX_TIME_MS: number;
|
|
45
46
|
/**
|
package/lib/chevre/settings.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
3
|
+
exports.settings = exports.MONGO_MAX_TIME_MS = exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = exports.USE_ADVANCE_BOOKING_REQUIREMENT = exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = exports.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING = exports.USE_ASSET_TRANSACTION_SYNC_PROCESSING = exports.DEFAULT_TASKS_EXPORT_AGENT_NAME = exports.DEFAULT_PAYMENT_METHOD_TYPE_FOR_CREDIT_CARD = exports.DEFAULT_SENDER_EMAIL = exports.TRANSACTION_CANCELED_STORAGE_PERIOD_IN_DAYS = exports.TRANSACTION_CONFIRMED_STORAGE_PERIOD_IN_DAYS = exports.ASSET_TRANSACTION_STORAGE_PERIOD_IN_DAYS = exports.ABORTED_TASKS_WITHOUT_REPORT = exports.TRIGGER_WEBHOOK_RETRY_INTERVAL_IN_MS = exports.TRIGGER_WEBHOOK_MAX_RETRY_COUNT = void 0;
|
|
4
4
|
const moment = require("moment");
|
|
5
5
|
const factory = require("./factory");
|
|
6
6
|
const transactionWebhookUrls = (typeof process.env.INFORM_TRANSACTION_URL === 'string')
|
|
@@ -72,6 +72,7 @@ exports.USE_NEW_EVENT_AVAILABILITY_KEY_FROM = (typeof process.env.USE_NEW_EVENT_
|
|
|
72
72
|
// ? process.env.USE_NEW_STOCK_HOLDER_REPO_IDS.split(' ')
|
|
73
73
|
// : [];
|
|
74
74
|
exports.USE_ADVANCE_BOOKING_REQUIREMENT = process.env.USE_ADVANCE_BOOKING_REQUIREMENT === '1';
|
|
75
|
+
exports.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT = process.env.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT === '1';
|
|
75
76
|
exports.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS = (typeof process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS === 'string')
|
|
76
77
|
? Number(process.env.INFORM_RESERVATION_TASK_DELAY_IN_SECONDS)
|
|
77
78
|
: 0;
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@chevre/factory": "4.325.0-alpha.
|
|
12
|
+
"@chevre/factory": "4.325.0-alpha.3",
|
|
13
13
|
"@cinerino/sdk": "3.164.0",
|
|
14
14
|
"@motionpicture/coa-service": "9.2.0",
|
|
15
15
|
"@motionpicture/gmo-service": "5.2.0",
|
|
@@ -117,5 +117,5 @@
|
|
|
117
117
|
"postversion": "git push origin --tags",
|
|
118
118
|
"prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
|
|
119
119
|
},
|
|
120
|
-
"version": "21.7.0-alpha.
|
|
120
|
+
"version": "21.7.0-alpha.6"
|
|
121
121
|
}
|