@chevre/domain 21.7.0-alpha.5 → 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.
@@ -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({ paymentService: params.paymentService });
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
- // let paymentMethodCurrency: string = factory.priceCurrency.JPY;
61
- // if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.PaymentCard) {
62
- // // ひとまず使用していないので空文字
63
- // paymentMethodCurrency = '';
64
- // } else if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
65
- // // カード通貨区分が存在すれば適用
66
- // const creditCardAsPaymentServiceOutputCurrency = params.paymentService?.serviceOutput?.paymentMethod?.amount?.currency;
67
- // if (typeof creditCardAsPaymentServiceOutputCurrency === 'string') {
68
- // paymentMethodCurrency = creditCardAsPaymentServiceOutputCurrency;
69
- // }
70
- // }
71
- // const paymentMethodAmount: factory.assetTransaction.pay.IPaymentMethodAmount = {
72
- // typeOf: 'MonetaryAmount',
73
- // currency: paymentMethodCurrency,
74
- // value: params.amount
75
- // };
76
- const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_h = params.object.paymentMethod) === null || _h === void 0 ? void 0 : _h.additionalProperty))
77
- ? (_j = params.object.paymentMethod) === null || _j === void 0 ? void 0 : _j.additionalProperty
78
- : [], name: (typeof ((_k = params.object.paymentMethod) === null || _k === void 0 ? void 0 : _k.name) === 'string')
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
- // tslint:disable-next-line:no-suspicious-comment
82
- // TODO MonetaryAmount対応(2023-08-14~)
83
- amount: params.amount,
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 ((_o = params.object.paymentMethod) === null || _o === void 0 ? void 0 : _o.method) === 'string')
90
- ? { method: (_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.method }
91
- : undefined), (((_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.creditCard) !== undefined)
92
- ? { creditCard: (_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.creditCard }
93
- : undefined), (Array.isArray((_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.movieTickets))
94
- ? { movieTickets: (_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.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 ((_u = params.location) === null || _u === void 0 ? void 0 : _u.typeOf) === 'string')
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
  }
@@ -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
  /**
@@ -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
@@ -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.5"
120
+ "version": "21.7.0-alpha.6"
121
121
  }