@chevre/domain 21.8.0-alpha.4 → 21.8.0-alpha.41
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/example/src/chevre/countOffers.ts +32 -0
- package/example/src/chevre/importOffersFromCOA.ts +7 -1
- package/example/src/chevre/migrateAggregateOffers.ts +75 -0
- package/example/src/chevre/migrateOrderPaymentMethodIdentifier.ts +81 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodId.ts +72 -0
- package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +78 -0
- package/example/src/chevre/processPay.ts +3 -4
- package/example/src/chevre/publishPermitOwnershipInfoToken.ts +56 -0
- package/example/src/chevre/pullAddOnsFromOffer.ts +26 -0
- package/example/src/chevre/searchOffersByCatalog.ts +9 -4
- package/example/src/chevre/searchOffersFromAggregateOffer.ts +167 -0
- package/example/src/chevre/sync2aggregateOffer.ts +27 -0
- package/example/src/chevre/syncAggregateOffer.ts +25 -0
- package/lib/chevre/repo/assetTransaction.d.ts +16 -1
- package/lib/chevre/repo/assetTransaction.js +54 -2
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.d.ts +71 -0
- package/lib/chevre/repo/mongoose/schemas/aggregateOffer.js +176 -0
- package/lib/chevre/repo/mongoose/schemas/offer.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +1 -0
- package/lib/chevre/repo/mongoose/schemas/task.d.ts +3 -0
- package/lib/chevre/repo/mongoose/schemas/task.js +8 -0
- package/lib/chevre/repo/offer.d.ts +71 -14
- package/lib/chevre/repo/offer.js +1061 -87
- package/lib/chevre/repo/order.d.ts +15 -0
- package/lib/chevre/repo/order.js +34 -1
- package/lib/chevre/repo/task.d.ts +7 -1
- package/lib/chevre/repo/task.js +100 -0
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +2 -2
- package/lib/chevre/service/aggregation/event/aggregateUseActionsOnEvent.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/account/validation.js +2 -2
- package/lib/chevre/service/assetTransaction/pay/factory.js +26 -18
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.js +65 -46
- package/lib/chevre/service/assetTransaction/refund/factory.js +8 -2
- package/lib/chevre/service/assetTransaction/reserve.js +105 -31
- package/lib/chevre/service/delivery.js +17 -0
- package/lib/chevre/service/offer/event/authorize.js +18 -19
- package/lib/chevre/service/offer/event/factory.js +8 -8
- package/lib/chevre/service/offer/event/importFromCOA.d.ts +2 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +2 -2
- package/lib/chevre/service/offer/event/voidTransaction.js +7 -2
- package/lib/chevre/service/offer/product/searchProductOffers.js +1 -1
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +29 -40
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +27 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +226 -0
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +8 -6
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +80 -57
- package/lib/chevre/service/order/onOrderStatusChanged.js +104 -81
- package/lib/chevre/service/order/payOrder.d.ts +2 -10
- package/lib/chevre/service/order/payOrder.js +4 -45
- package/lib/chevre/service/order/placeOrder.js +11 -13
- package/lib/chevre/service/order.d.ts +3 -1
- package/lib/chevre/service/order.js +6 -2
- package/lib/chevre/service/payment/any/factory.js +33 -8
- package/lib/chevre/service/payment/any.js +30 -21
- package/lib/chevre/service/payment/creditCard.js +12 -12
- package/lib/chevre/service/payment/movieTicket/validation.js +2 -2
- package/lib/chevre/service/payment/movieTicket.js +10 -11
- package/lib/chevre/service/payment/paymentCard.js +9 -12
- package/lib/chevre/service/project.js +1 -1
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationCanceled.js +1 -4
- package/lib/chevre/service/reserve/potentialActions/onReservationCheckedIn.js +1 -5
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +3 -0
- package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +1 -4
- package/lib/chevre/service/task/confirmPayTransaction.js +1 -3
- package/lib/chevre/service/task/importOffersFromCOA.js +3 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.d.ts +6 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +37 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.d.ts +6 -0
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +35 -0
- package/lib/chevre/service/task/returnPayTransaction.js +8 -3
- package/lib/chevre/service/task/syncAggregateOffer.d.ts +7 -0
- package/lib/chevre/service/task/syncAggregateOffer.js +23 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/result.js +32 -16
- package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateMovieTicket.js +13 -11
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +53 -17
- package/lib/chevre/service/transaction/placeOrderInProgress.js +4 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +7 -6
- package/lib/chevre/service/transaction/returnOrder.js +5 -1
- package/lib/chevre/settings.d.ts +4 -2
- package/lib/chevre/settings.js +5 -5
- package/package.json +3 -3
- package/example/src/chevre/migrateAuthorizePaymentActionResult.ts +0 -83
- package/example/src/chevre/migrateEventOrganizer.ts +0 -154
|
@@ -70,6 +70,21 @@ export declare class MongoRepository {
|
|
|
70
70
|
}): Promise<{
|
|
71
71
|
updatedAt: Date;
|
|
72
72
|
}>;
|
|
73
|
+
/**
|
|
74
|
+
* 注文後に決済方法区分を確定する
|
|
75
|
+
*/
|
|
76
|
+
fixPaymentMethodIdentifier(params: {
|
|
77
|
+
project: {
|
|
78
|
+
id: string;
|
|
79
|
+
};
|
|
80
|
+
orderNumber: string;
|
|
81
|
+
invoice: {
|
|
82
|
+
paymentMethodId: string;
|
|
83
|
+
paymentMethod: {
|
|
84
|
+
identifier: string;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
}): Promise<void>;
|
|
73
88
|
findById(params: {
|
|
74
89
|
id: string;
|
|
75
90
|
inclusion: string[];
|
package/lib/chevre/repo/order.js
CHANGED
|
@@ -681,7 +681,10 @@ class MongoRepository {
|
|
|
681
681
|
orderNumber: { $eq: params.orderNumber },
|
|
682
682
|
orderStatus: { $eq: params.previousOrderStatus },
|
|
683
683
|
'project.id': { $eq: params.project.id }
|
|
684
|
-
}, {
|
|
684
|
+
}, {
|
|
685
|
+
previousOrderStatus: params.previousOrderStatus,
|
|
686
|
+
orderStatus: params.orderStatus
|
|
687
|
+
}, {
|
|
685
688
|
new: true,
|
|
686
689
|
projection: {
|
|
687
690
|
__v: 0,
|
|
@@ -723,6 +726,7 @@ class MongoRepository {
|
|
|
723
726
|
orderStatus: { $eq: factory.orderStatus.OrderDelivered },
|
|
724
727
|
'project.id': { $eq: params.project.id }
|
|
725
728
|
}, {
|
|
729
|
+
previousOrderStatus: factory.orderStatus.OrderDelivered,
|
|
726
730
|
orderStatus: factory.orderStatus.OrderReturned,
|
|
727
731
|
dateReturned: params.dateReturned,
|
|
728
732
|
returner: params.returner
|
|
@@ -782,6 +786,35 @@ class MongoRepository {
|
|
|
782
786
|
return { updatedAt: doc.updatedAt };
|
|
783
787
|
});
|
|
784
788
|
}
|
|
789
|
+
/**
|
|
790
|
+
* 注文後に決済方法区分を確定する
|
|
791
|
+
*/
|
|
792
|
+
fixPaymentMethodIdentifier(params) {
|
|
793
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
794
|
+
const doc = yield this.orderModel.findOneAndUpdate({
|
|
795
|
+
orderNumber: { $eq: params.orderNumber },
|
|
796
|
+
'project.id': { $eq: params.project.id },
|
|
797
|
+
'paymentMethods.paymentMethodId': { $exists: true, $eq: params.invoice.paymentMethodId }
|
|
798
|
+
}, {
|
|
799
|
+
$set: {
|
|
800
|
+
'paymentMethods.$[invoice].paymentMethod.identifier': params.invoice.paymentMethod.identifier,
|
|
801
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
802
|
+
// TODO 互換性維持対応としてtypeOfも変更しているが、そのうち廃止(2023-08-30)
|
|
803
|
+
'paymentMethods.$[invoice].typeOf': params.invoice.paymentMethod.identifier
|
|
804
|
+
}
|
|
805
|
+
}, {
|
|
806
|
+
arrayFilters: [{ 'invoice.paymentMethodId': { $eq: params.invoice.paymentMethodId } }],
|
|
807
|
+
new: true,
|
|
808
|
+
projection: {
|
|
809
|
+
_id: 1
|
|
810
|
+
}
|
|
811
|
+
})
|
|
812
|
+
.exec();
|
|
813
|
+
if (doc === null) {
|
|
814
|
+
throw new factory.errors.NotFound(this.orderModel.modelName);
|
|
815
|
+
}
|
|
816
|
+
});
|
|
817
|
+
}
|
|
785
818
|
findById(params) {
|
|
786
819
|
return __awaiter(this, void 0, void 0, function* () {
|
|
787
820
|
let projection = {};
|
|
@@ -30,11 +30,17 @@ export declare class MongoRepository {
|
|
|
30
30
|
saveMany(taskAttributes: factory.task.IAttributes<factory.taskName>[], options: IOptionOnCreate): Promise<{
|
|
31
31
|
id: string;
|
|
32
32
|
}[]>;
|
|
33
|
+
/**
|
|
34
|
+
* タスク識別子から冪等作成する
|
|
35
|
+
*/
|
|
36
|
+
createIfNotExistByIdentifier(params: factory.task.IAttributes<factory.taskName>, options: IOptionOnCreate): Promise<void>;
|
|
33
37
|
createInformTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.TriggerWebhook>, options: IOptionOnCreate): Promise<void>;
|
|
34
38
|
/**
|
|
35
39
|
* 取引削除タスク冪等作成
|
|
36
40
|
*/
|
|
37
41
|
createDeleteTransactionTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.DeleteTransaction>, options: IOptionOnCreate): Promise<void>;
|
|
42
|
+
createConfirmReserveTransactionTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.ConfirmReserveTransaction>, options: IOptionOnCreate): Promise<void>;
|
|
43
|
+
createOnAssetTransactionStatusChangedTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.OnAssetTransactionStatusChanged>, options: IOptionOnCreate): Promise<void>;
|
|
38
44
|
createSendOrderTaskIfNotExist(params: factory.task.IAttributes<factory.taskName.SendOrder>, options: IOptionOnCreate): Promise<void>;
|
|
39
45
|
executeById(params: {
|
|
40
46
|
id: string;
|
|
@@ -68,7 +74,7 @@ export declare class MongoRepository {
|
|
|
68
74
|
*/
|
|
69
75
|
$nin?: factory.taskName[];
|
|
70
76
|
};
|
|
71
|
-
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
77
|
+
}): Promise<Pick<import("@chevre/factory/lib/task").ITask | import("@chevre/factory/lib/task/confirmMoneyTransfer").ITask | import("@chevre/factory/lib/task/confirmRegisterService").ITask | import("@chevre/factory/lib/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/task/createEvent").ITask | import("@chevre/factory/lib/task/deleteTransaction").ITask | import("@chevre/factory/lib/task/givePointAward").ITask | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/task/onEventChanged").ITask | import("@chevre/factory/lib/task/onResourceUpdated").ITask | import("@chevre/factory/lib/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/task/placeOrder").ITask | import("@chevre/factory/lib/task/returnOrder").ITask | import("@chevre/factory/lib/task/returnMoneyTransfer").ITask | import("@chevre/factory/lib/task/returnPayTransaction").ITask | import("@chevre/factory/lib/task/returnPointAward").ITask | import("@chevre/factory/lib/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/task/sendEmailMessage").ITask | import("@chevre/factory/lib/task/sendOrder").ITask | import("@chevre/factory/lib/task/syncAggregateOffer").ITask | import("@chevre/factory/lib/task/syncScreeningRooms").ITask | import("@chevre/factory/lib/task/triggerWebhook").ITask | import("@chevre/factory/lib/task/useReservation").ITask | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").ITask | import("@chevre/factory/lib/task/voidPayTransaction").ITask | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/task/voidReserveTransaction").ITask, "id" | "name" | "status">[]>;
|
|
72
78
|
retry(params: {
|
|
73
79
|
intervalInMinutes: number;
|
|
74
80
|
}): Promise<void>;
|
package/lib/chevre/repo/task.js
CHANGED
|
@@ -174,6 +174,30 @@ class MongoRepository {
|
|
|
174
174
|
}
|
|
175
175
|
});
|
|
176
176
|
}
|
|
177
|
+
/**
|
|
178
|
+
* タスク識別子から冪等作成する
|
|
179
|
+
*/
|
|
180
|
+
createIfNotExistByIdentifier(params, options) {
|
|
181
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
182
|
+
if (typeof params.identifier !== 'string' || params.identifier.length === 0) {
|
|
183
|
+
throw new factory.errors.ArgumentNull('identifier');
|
|
184
|
+
}
|
|
185
|
+
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
186
|
+
'project.id': { $eq: params.project.id },
|
|
187
|
+
name: { $eq: params.name },
|
|
188
|
+
identifier: { $exists: true, $eq: params.identifier }
|
|
189
|
+
}, { $setOnInsert: params }, { new: true, upsert: true })
|
|
190
|
+
.select({ _id: 1 })
|
|
191
|
+
.exec();
|
|
192
|
+
if (options.emitImmediately) {
|
|
193
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
194
|
+
id: createdTask.id,
|
|
195
|
+
name: params.name,
|
|
196
|
+
status: factory.taskStatus.Ready
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
}
|
|
177
201
|
createInformTaskIfNotExist(params, options) {
|
|
178
202
|
return __awaiter(this, void 0, void 0, function* () {
|
|
179
203
|
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
@@ -219,6 +243,56 @@ class MongoRepository {
|
|
|
219
243
|
}
|
|
220
244
|
});
|
|
221
245
|
}
|
|
246
|
+
createConfirmReserveTransactionTaskIfNotExist(params, options) {
|
|
247
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
248
|
+
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
249
|
+
'project.id': { $eq: params.project.id },
|
|
250
|
+
name: { $eq: params.name },
|
|
251
|
+
'data.object.transactionNumber': {
|
|
252
|
+
$exists: true,
|
|
253
|
+
$eq: String(params.data.object.transactionNumber)
|
|
254
|
+
},
|
|
255
|
+
'data.purpose.orderNumber': {
|
|
256
|
+
$exists: true,
|
|
257
|
+
$eq: String(params.data.purpose.orderNumber)
|
|
258
|
+
}
|
|
259
|
+
}, { $setOnInsert: params }, { new: true, upsert: true })
|
|
260
|
+
.select({ _id: 1 })
|
|
261
|
+
.exec();
|
|
262
|
+
if (options.emitImmediately) {
|
|
263
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
264
|
+
id: createdTask.id,
|
|
265
|
+
name: params.name,
|
|
266
|
+
status: factory.taskStatus.Ready
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
createOnAssetTransactionStatusChangedTaskIfNotExist(params, options) {
|
|
272
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
273
|
+
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
274
|
+
'project.id': { $eq: params.project.id },
|
|
275
|
+
name: { $eq: params.name },
|
|
276
|
+
'data.object.transactionNumber': {
|
|
277
|
+
$exists: true,
|
|
278
|
+
$eq: String(params.data.object.transactionNumber)
|
|
279
|
+
},
|
|
280
|
+
'data.purpose.orderNumber': {
|
|
281
|
+
$exists: true,
|
|
282
|
+
$eq: String(params.data.purpose.orderNumber)
|
|
283
|
+
}
|
|
284
|
+
}, { $setOnInsert: params }, { new: true, upsert: true })
|
|
285
|
+
.select({ _id: 1 })
|
|
286
|
+
.exec();
|
|
287
|
+
if (options.emitImmediately) {
|
|
288
|
+
task_2.taskEventEmitter.emitTaskStatusChanged({
|
|
289
|
+
id: createdTask.id,
|
|
290
|
+
name: params.name,
|
|
291
|
+
status: factory.taskStatus.Ready
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
222
296
|
createSendOrderTaskIfNotExist(params, options) {
|
|
223
297
|
return __awaiter(this, void 0, void 0, function* () {
|
|
224
298
|
const createdTask = yield this.taskModel.findOneAndUpdate({
|
|
@@ -240,6 +314,32 @@ class MongoRepository {
|
|
|
240
314
|
}
|
|
241
315
|
});
|
|
242
316
|
}
|
|
317
|
+
// public async createOnOrderPaymentCompletedTaskIfNotExist(
|
|
318
|
+
// params: factory.task.IAttributes<factory.taskName.OnOrderPaymentCompleted>,
|
|
319
|
+
// options: IOptionOnCreate
|
|
320
|
+
// ): Promise<void> {
|
|
321
|
+
// const createdTask = await this.taskModel.findOneAndUpdate(
|
|
322
|
+
// {
|
|
323
|
+
// 'project.id': { $eq: params.project.id },
|
|
324
|
+
// name: { $eq: params.name },
|
|
325
|
+
// 'data.object.orderNumber': {
|
|
326
|
+
// $exists: true,
|
|
327
|
+
// $eq: String(params.data.object.orderNumber)
|
|
328
|
+
// }
|
|
329
|
+
// },
|
|
330
|
+
// { $setOnInsert: params },
|
|
331
|
+
// { new: true, upsert: true }
|
|
332
|
+
// )
|
|
333
|
+
// .select({ _id: 1 })
|
|
334
|
+
// .exec();
|
|
335
|
+
// if (options.emitImmediately) {
|
|
336
|
+
// taskEventEmitter.emitTaskStatusChanged({
|
|
337
|
+
// id: createdTask.id,
|
|
338
|
+
// name: params.name,
|
|
339
|
+
// status: factory.taskStatus.Ready
|
|
340
|
+
// });
|
|
341
|
+
// }
|
|
342
|
+
// }
|
|
243
343
|
executeById(params) {
|
|
244
344
|
return __awaiter(this, void 0, void 0, function* () {
|
|
245
345
|
const doc = yield this.taskModel.findOneAndUpdate({
|
|
@@ -179,8 +179,8 @@ function findOffers(params) {
|
|
|
179
179
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
180
180
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
181
181
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
182
|
-
excludeAppliesToMovieTicket: false
|
|
183
|
-
sort: false // ソート不要(2023-01-27~)
|
|
182
|
+
excludeAppliesToMovieTicket: false
|
|
183
|
+
// sort: false // ソート不要(2023-01-27~) // 完全廃止(2023-09-04~)
|
|
184
184
|
});
|
|
185
185
|
availableOffers = findOffersByOfferCatalogIdResult.offers;
|
|
186
186
|
}
|
|
@@ -104,8 +104,8 @@ function findOffers(params) {
|
|
|
104
104
|
if (typeof ((_b = eventService.hasOfferCatalog) === null || _b === void 0 ? void 0 : _b.id) === 'string') {
|
|
105
105
|
const findOffersByOfferCatalogIdResult = yield repos.offer.findOffersByOfferCatalogId({
|
|
106
106
|
offerCatalog: { id: eventService.hasOfferCatalog.id },
|
|
107
|
-
excludeAppliesToMovieTicket: false
|
|
108
|
-
sort: false // ソート不要(2023-01-27~)
|
|
107
|
+
excludeAppliesToMovieTicket: false
|
|
108
|
+
// sort: false // ソート不要(2023-01-27~) // 完全廃止(2023-09-04~)
|
|
109
109
|
});
|
|
110
110
|
availableOffers = findOffersByOfferCatalogIdResult.offers;
|
|
111
111
|
}
|
|
@@ -15,9 +15,9 @@ function validateAccount(params) {
|
|
|
15
15
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
var _a, _b, _c, _d;
|
|
17
17
|
// 引き出し口座の存在を確認する
|
|
18
|
-
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
18
|
+
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
19
19
|
if (typeof paymentMethodType !== 'string') {
|
|
20
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
20
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
21
21
|
}
|
|
22
22
|
const accountNumber = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.accountId;
|
|
23
23
|
if (typeof accountNumber !== 'string') {
|
|
@@ -8,16 +8,16 @@ const factory = require("../../../factory");
|
|
|
8
8
|
const settings_1 = require("../../../settings");
|
|
9
9
|
// tslint:disable-next-line:cyclomatic-complexity max-func-body-length
|
|
10
10
|
function createStartParams(params) {
|
|
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
|
|
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;
|
|
12
12
|
const paymentServiceId = (params.paymentService !== undefined)
|
|
13
13
|
? String(params.paymentService.id)
|
|
14
14
|
: '';
|
|
15
15
|
const paymentMethodType = (params.paymentService !== undefined)
|
|
16
16
|
// FaceToFace以外は、プロダクトから決済方法タイプを自動取得
|
|
17
17
|
? (_a = params.paymentService.serviceType) === null || _a === void 0 ? void 0 : _a.codeValue
|
|
18
|
-
: (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
18
|
+
: (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
19
19
|
if (typeof paymentMethodType !== 'string') {
|
|
20
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
20
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
21
21
|
}
|
|
22
22
|
let totalPaymentDue;
|
|
23
23
|
switch (params.paymentServiceType) {
|
|
@@ -68,10 +68,16 @@ function createStartParams(params) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
else if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
71
|
+
const creditCardPaymentServiceOutput = (_l = params.paymentService) === null || _l === void 0 ? void 0 : _l.serviceOutput;
|
|
72
|
+
const invoiceAsServiceOutput = (Array.isArray(creditCardPaymentServiceOutput))
|
|
73
|
+
? creditCardPaymentServiceOutput.find((output) => output.typeOf === 'Invoice')
|
|
74
|
+
: creditCardPaymentServiceOutput;
|
|
71
75
|
// カード通貨区分が存在すれば適用
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
if ((invoiceAsServiceOutput === null || invoiceAsServiceOutput === void 0 ? void 0 : invoiceAsServiceOutput.typeOf) === 'Invoice') {
|
|
77
|
+
const creditCardAsPaymentServiceOutputCurrency = (_o = (_m = invoiceAsServiceOutput.paymentMethod) === null || _m === void 0 ? void 0 : _m.amount) === null || _o === void 0 ? void 0 : _o.currency;
|
|
78
|
+
if (typeof creditCardAsPaymentServiceOutputCurrency === 'string') {
|
|
79
|
+
paymentMethodCurrency = creditCardAsPaymentServiceOutputCurrency;
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
82
|
}
|
|
77
83
|
const paymentMethodAmount = {
|
|
@@ -79,22 +85,24 @@ function createStartParams(params) {
|
|
|
79
85
|
currency: paymentMethodCurrency,
|
|
80
86
|
value: params.amount
|
|
81
87
|
};
|
|
82
|
-
const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((
|
|
83
|
-
? (
|
|
84
|
-
: [], name: (typeof ((
|
|
88
|
+
const paymentMethod = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ additionalProperty: (Array.isArray((_p = params.object.paymentMethod) === null || _p === void 0 ? void 0 : _p.additionalProperty))
|
|
89
|
+
? (_q = params.object.paymentMethod) === null || _q === void 0 ? void 0 : _q.additionalProperty
|
|
90
|
+
: [], name: (typeof ((_r = params.object.paymentMethod) === null || _r === void 0 ? void 0 : _r.name) === 'string')
|
|
85
91
|
? params.object.paymentMethod.name
|
|
86
92
|
: paymentMethodType,
|
|
87
93
|
// MonetaryAmount対応(2023-08-14~)
|
|
88
|
-
amount: (settings_1.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT) ? paymentMethodAmount : params.amount,
|
|
89
|
-
|
|
94
|
+
amount: (settings_1.USE_OBJECT_AS_PAY_TRANSACTION_AMOUNT) ? paymentMethodAmount : params.amount,
|
|
95
|
+
// paymentMethodId: params.transactionNumber, // object.paymentMethodIdへ完全移行(2023-08-30~)
|
|
96
|
+
identifier: paymentMethodType }, (typeof ((_s = params.object.paymentMethod) === null || _s === void 0 ? void 0 : _s.description) === 'string')
|
|
97
|
+
? { description: (_t = params.object.paymentMethod) === null || _t === void 0 ? void 0 : _t.description }
|
|
90
98
|
: undefined), (totalPaymentDue !== undefined)
|
|
91
99
|
? { totalPaymentDue: totalPaymentDue }
|
|
92
|
-
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((
|
|
93
|
-
? { method: (
|
|
94
|
-
: undefined), (((
|
|
95
|
-
? { creditCard: (
|
|
96
|
-
: undefined), (Array.isArray((
|
|
97
|
-
? { movieTickets: (
|
|
100
|
+
: undefined), (typeof accountId === 'string') ? { accountId: accountId } : undefined), (typeof ((_u = params.object.paymentMethod) === null || _u === void 0 ? void 0 : _u.method) === 'string')
|
|
101
|
+
? { method: (_v = params.object.paymentMethod) === null || _v === void 0 ? void 0 : _v.method }
|
|
102
|
+
: undefined), (((_w = params.object.paymentMethod) === null || _w === void 0 ? void 0 : _w.creditCard) !== undefined)
|
|
103
|
+
? { creditCard: (_x = params.object.paymentMethod) === null || _x === void 0 ? void 0 : _x.creditCard }
|
|
104
|
+
: undefined), (Array.isArray((_y = params.object.paymentMethod) === null || _y === void 0 ? void 0 : _y.movieTickets))
|
|
105
|
+
? { movieTickets: (_z = params.object.paymentMethod) === null || _z === void 0 ? void 0 : _z.movieTickets }
|
|
98
106
|
: undefined);
|
|
99
107
|
const object = {
|
|
100
108
|
// パラメータから必要なもののみ取り込む
|
|
@@ -105,7 +113,7 @@ function createStartParams(params) {
|
|
|
105
113
|
onPaymentStatusChanged: { informPayment: informPaymentParams },
|
|
106
114
|
paymentMethod
|
|
107
115
|
};
|
|
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 ((
|
|
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 ((_0 = params.location) === null || _0 === void 0 ? void 0 : _0.typeOf) === 'string')
|
|
109
117
|
? { location: params.location }
|
|
110
118
|
: undefined);
|
|
111
119
|
}
|
|
@@ -33,9 +33,9 @@ function createPayObject(params) {
|
|
|
33
33
|
var _a;
|
|
34
34
|
const transaction = params.transaction;
|
|
35
35
|
const paymentMethod = transaction.object.paymentMethod;
|
|
36
|
-
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.
|
|
36
|
+
const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier);
|
|
37
37
|
const additionalProperty = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.additionalProperty;
|
|
38
|
-
const paymentMethodId =
|
|
38
|
+
const paymentMethodId = transaction.object.paymentMethodId;
|
|
39
39
|
const paymentMethodName = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name) === 'string') ? paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.name : paymentMethodType;
|
|
40
40
|
// MonetaryAmount対応(2023-08-13~)
|
|
41
41
|
const paymentMethodAmountValue = (typeof (paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.amount) === 'number')
|
|
@@ -139,7 +139,7 @@ function createPayObjectServiceOutput(params) {
|
|
|
139
139
|
// }
|
|
140
140
|
break;
|
|
141
141
|
case factory.service.paymentService.PaymentServiceType.MovieTicket:
|
|
142
|
-
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.
|
|
142
|
+
const paymentMethodType = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier;
|
|
143
143
|
const movieTickets = paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.movieTickets;
|
|
144
144
|
if (Array.isArray(movieTickets)) {
|
|
145
145
|
paymentServiceOutput = movieTickets.map((movieTicket) => {
|
|
@@ -12,8 +12,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.searchGMOTrade = exports.exportTasksById = exports.cancel = exports.confirm = exports.start = exports.check = exports.invalidatePaymentUrl = exports.publishPaymentUrl = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
|
-
const settings_1 = require("../../settings");
|
|
16
|
-
const payment_1 = require("../payment");
|
|
17
15
|
const CreditCardPayment = require("../payment/creditCard");
|
|
18
16
|
const MovieTicketPayment = require("../payment/movieTicket");
|
|
19
17
|
const PaymentCardPayment = require("../payment/paymentCard");
|
|
@@ -205,7 +203,7 @@ function fixPaymentService(params) {
|
|
|
205
203
|
}
|
|
206
204
|
function validateSeller(params) {
|
|
207
205
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
208
|
-
var _a, _b, _c;
|
|
206
|
+
var _a, _b, _c, _d;
|
|
209
207
|
const sellerId = (_a = params.recipient) === null || _a === void 0 ? void 0 : _a.id;
|
|
210
208
|
if (typeof sellerId !== 'string') {
|
|
211
209
|
throw new factory.errors.ArgumentNull('recipient.id');
|
|
@@ -219,14 +217,26 @@ function validateSeller(params) {
|
|
|
219
217
|
if (seller === undefined) {
|
|
220
218
|
throw new factory.errors.NotFound(factory.organizationType.Corporation);
|
|
221
219
|
}
|
|
222
|
-
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.
|
|
220
|
+
const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
223
221
|
if (typeof paymentMethodType !== 'string') {
|
|
224
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
222
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
225
223
|
}
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
224
|
+
// FaceToFaceの場合、決済方法区分未指定に対応(2023-08-29~)
|
|
225
|
+
if (params.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
226
|
+
if (paymentMethodType.length > 0) {
|
|
227
|
+
// 販売者の対応決済方法かどうか確認
|
|
228
|
+
const paymentAccepted = (_c = seller.paymentAccepted) === null || _c === void 0 ? void 0 : _c.some((a) => a.paymentMethodType === paymentMethodType);
|
|
229
|
+
if (paymentAccepted !== true) {
|
|
230
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else {
|
|
235
|
+
// 販売者の対応決済方法かどうか確認
|
|
236
|
+
const paymentAccepted = (_d = seller.paymentAccepted) === null || _d === void 0 ? void 0 : _d.some((a) => a.paymentMethodType === paymentMethodType);
|
|
237
|
+
if (paymentAccepted !== true) {
|
|
238
|
+
throw new factory.errors.Argument('object.paymentMethod.identifier', `payment not accepted`);
|
|
239
|
+
}
|
|
230
240
|
}
|
|
231
241
|
});
|
|
232
242
|
}
|
|
@@ -301,6 +311,7 @@ function saveAuthorizeResult(params) {
|
|
|
301
311
|
*/
|
|
302
312
|
function confirm(params) {
|
|
303
313
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
var _a, _b;
|
|
304
315
|
let transaction;
|
|
305
316
|
// 取引存在確認
|
|
306
317
|
if (typeof params.id === 'string') {
|
|
@@ -318,29 +329,24 @@ function confirm(params) {
|
|
|
318
329
|
else {
|
|
319
330
|
throw new factory.errors.ArgumentNull('Transaction ID or Transaction Number');
|
|
320
331
|
}
|
|
332
|
+
let overwritingPaymentMethodIdentifier;
|
|
333
|
+
if (transaction.object.typeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
334
|
+
const specifiedPaymentMethodIdentifire = (_b = (_a = params.object) === null || _a === void 0 ? void 0 : _a.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
|
|
335
|
+
if (typeof specifiedPaymentMethodIdentifire === 'string' && specifiedPaymentMethodIdentifire.length > 0) {
|
|
336
|
+
overwritingPaymentMethodIdentifier = specifiedPaymentMethodIdentifire;
|
|
337
|
+
transaction.object.paymentMethod.identifier = overwritingPaymentMethodIdentifier;
|
|
338
|
+
// transaction.object.paymentMethod.typeOf = overwritingPaymentMethodIdentifier;
|
|
339
|
+
}
|
|
340
|
+
}
|
|
321
341
|
const order = yield fixOrderAsPurpose(params, transaction)(repos);
|
|
322
342
|
const potentialActions = (0, potentialActions_1.createPotentialActions)({
|
|
323
343
|
transaction: transaction,
|
|
324
344
|
potentialActions: params.potentialActions,
|
|
325
345
|
order
|
|
326
346
|
});
|
|
327
|
-
yield repos.assetTransaction.confirm({
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
result: {},
|
|
331
|
-
// sync対応(2023-01-14~)
|
|
332
|
-
potentialActions: (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING)
|
|
333
|
-
? { pay: [] }
|
|
334
|
-
: potentialActions
|
|
335
|
-
});
|
|
336
|
-
// sync対応(2023-01-14~)
|
|
337
|
-
if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
338
|
-
if (Array.isArray(potentialActions.pay)) {
|
|
339
|
-
for (const payAction of potentialActions.pay) {
|
|
340
|
-
yield (0, payment_1.pay)(payAction)(repos);
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
}
|
|
347
|
+
yield repos.assetTransaction.confirm(Object.assign({ typeOf: factory.assetTransactionType.Pay, id: transaction.id, result: {}, potentialActions: potentialActions }, (typeof overwritingPaymentMethodIdentifier === 'string')
|
|
348
|
+
? { object: { paymentMethod: { identifier: overwritingPaymentMethodIdentifier } } }
|
|
349
|
+
: undefined));
|
|
344
350
|
});
|
|
345
351
|
}
|
|
346
352
|
exports.confirm = confirm;
|
|
@@ -373,23 +379,11 @@ function fixOrderAsPurpose(params, transaction) {
|
|
|
373
379
|
*/
|
|
374
380
|
function cancel(params) {
|
|
375
381
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
376
|
-
|
|
382
|
+
yield repos.assetTransaction.cancel({
|
|
377
383
|
typeOf: factory.assetTransactionType.Pay,
|
|
378
384
|
id: params.id,
|
|
379
385
|
transactionNumber: params.transactionNumber
|
|
380
386
|
});
|
|
381
|
-
// sync対応(2023-01-14~)
|
|
382
|
-
if (settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
383
|
-
const payTransactionAsObject = {
|
|
384
|
-
project: transaction.project,
|
|
385
|
-
typeOf: transaction.typeOf,
|
|
386
|
-
id: transaction.id,
|
|
387
|
-
transactionNumber: transaction.transactionNumber,
|
|
388
|
-
object: transaction.object,
|
|
389
|
-
recipient: transaction.recipient
|
|
390
|
-
};
|
|
391
|
-
yield (0, payment_1.voidPayment)({ object: payTransactionAsObject })(repos);
|
|
392
|
-
}
|
|
393
387
|
});
|
|
394
388
|
}
|
|
395
389
|
exports.cancel = cancel;
|
|
@@ -404,6 +398,9 @@ function exportTasksById(params) {
|
|
|
404
398
|
id: params.id
|
|
405
399
|
});
|
|
406
400
|
const potentialActions = transaction.potentialActions;
|
|
401
|
+
if (transaction.status === factory.transactionStatusType.InProgress) {
|
|
402
|
+
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
403
|
+
}
|
|
407
404
|
const taskAttributes = [];
|
|
408
405
|
// タスク実行日時バッファの指定があれば調整
|
|
409
406
|
let taskRunsAt = new Date();
|
|
@@ -430,6 +427,31 @@ function exportTasksById(params) {
|
|
|
430
427
|
executionResults: [],
|
|
431
428
|
data: { object: payTransactionAsObject }
|
|
432
429
|
};
|
|
430
|
+
// OnAssetTransactionStatusChangedを追加(2023-08-30~)
|
|
431
|
+
const onAssetTransactionStatusChangedTaskData = {
|
|
432
|
+
project: transaction.project,
|
|
433
|
+
object: {
|
|
434
|
+
typeOf: factory.assetTransactionType.Pay,
|
|
435
|
+
transactionNumber: transaction.transactionNumber,
|
|
436
|
+
status: transaction.status
|
|
437
|
+
},
|
|
438
|
+
purpose: {
|
|
439
|
+
confirmationNumber: '',
|
|
440
|
+
orderNumber: '',
|
|
441
|
+
typeOf: 'Order'
|
|
442
|
+
},
|
|
443
|
+
useOnOrderStatusChanged: true
|
|
444
|
+
};
|
|
445
|
+
const onAssetTransactionStatusChangedTask = {
|
|
446
|
+
project: transaction.project,
|
|
447
|
+
name: factory.taskName.OnAssetTransactionStatusChanged,
|
|
448
|
+
status: factory.taskStatus.Ready,
|
|
449
|
+
runsAt: taskRunsAt,
|
|
450
|
+
remainingNumberOfTries: 10,
|
|
451
|
+
numberOfTried: 0,
|
|
452
|
+
executionResults: [],
|
|
453
|
+
data: onAssetTransactionStatusChangedTaskData
|
|
454
|
+
};
|
|
433
455
|
switch (transaction.status) {
|
|
434
456
|
case factory.transactionStatusType.Confirmed:
|
|
435
457
|
const payActions = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.pay;
|
|
@@ -450,13 +472,10 @@ function exportTasksById(params) {
|
|
|
450
472
|
}
|
|
451
473
|
break;
|
|
452
474
|
case factory.transactionStatusType.Canceled:
|
|
453
|
-
|
|
454
|
-
if (!settings_1.USE_PAY_ASSET_TRANSACTION_SYNC_PROCESSING) {
|
|
455
|
-
taskAttributes.push(voidPaymentTasks);
|
|
456
|
-
}
|
|
475
|
+
taskAttributes.push(voidPaymentTasks, onAssetTransactionStatusChangedTask);
|
|
457
476
|
break;
|
|
458
477
|
case factory.transactionStatusType.Expired:
|
|
459
|
-
taskAttributes.push(voidPaymentTasks);
|
|
478
|
+
taskAttributes.push(voidPaymentTasks, onAssetTransactionStatusChangedTask);
|
|
460
479
|
break;
|
|
461
480
|
default:
|
|
462
481
|
throw new factory.errors.NotImplemented(`Transaction status "${transaction.status}" not implemented.`);
|
|
@@ -482,9 +501,9 @@ function searchGMOTrade(params) {
|
|
|
482
501
|
// throw new factory.errors.Argument('transactionNumber', 'must be confirmed');
|
|
483
502
|
// }
|
|
484
503
|
// CreditCard系統の決済方法タイプは動的
|
|
485
|
-
const paymentMethodType = (_a = assetTransaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.
|
|
504
|
+
const paymentMethodType = (_a = assetTransaction.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.identifier;
|
|
486
505
|
if (typeof paymentMethodType !== 'string') {
|
|
487
|
-
throw new factory.errors.ArgumentNull('object.paymentMethod.
|
|
506
|
+
throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
|
|
488
507
|
}
|
|
489
508
|
const paymentServiceId = String(assetTransaction.object.id);
|
|
490
509
|
const availableChannel = yield repos.product.findAvailableChannel({
|
|
@@ -6,7 +6,7 @@ exports.createStartParams = void 0;
|
|
|
6
6
|
*/
|
|
7
7
|
const factory = require("../../../factory");
|
|
8
8
|
function createStartParams(params) {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
10
10
|
const paymentMethodType = (_a = params.object.paymentMethod) === null || _a === void 0 ? void 0 : _a.typeOf;
|
|
11
11
|
if (typeof paymentMethodType !== 'string') {
|
|
12
12
|
throw new factory.errors.ArgumentNull('object.paymentMethod.typeOf');
|
|
@@ -23,7 +23,13 @@ function createStartParams(params) {
|
|
|
23
23
|
let refundFee;
|
|
24
24
|
if (((_g = params.paymentService) === null || _g === void 0 ? void 0 : _g.typeOf) === factory.service.paymentService.PaymentServiceType.CreditCard) {
|
|
25
25
|
// カード通貨区分の存在する決済サービスを考慮(2023-08-09~)
|
|
26
|
-
const
|
|
26
|
+
const invoiceAsServiceOutput = (Array.isArray(params.paymentService.serviceOutput))
|
|
27
|
+
? params.paymentService.serviceOutput.find((output) => output.typeOf === 'Invoice')
|
|
28
|
+
: params.paymentService.serviceOutput;
|
|
29
|
+
let paymentServiceOutputAmountCurrency;
|
|
30
|
+
if ((invoiceAsServiceOutput === null || invoiceAsServiceOutput === void 0 ? void 0 : invoiceAsServiceOutput.typeOf) === 'Invoice') {
|
|
31
|
+
paymentServiceOutputAmountCurrency = (_j = (_h = invoiceAsServiceOutput === null || invoiceAsServiceOutput === void 0 ? void 0 : invoiceAsServiceOutput.paymentMethod) === null || _h === void 0 ? void 0 : _h.amount) === null || _j === void 0 ? void 0 : _j.currency;
|
|
32
|
+
}
|
|
27
33
|
if (typeof paymentServiceOutputAmountCurrency !== 'string') {
|
|
28
34
|
if (typeof params.object.refundFee === 'number') {
|
|
29
35
|
refundFee = params.object.refundFee;
|