@chevre/domain 21.20.0-alpha.8 → 21.20.0

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.
Files changed (230) hide show
  1. package/example/src/chevre/findTransactionById.ts +21 -0
  2. package/example/src/chevre/importCategoryCodesFromCOA.ts +2 -1
  3. package/example/src/chevre/importOffersFromCOA.ts +2 -1
  4. package/example/src/chevre/migrateActionInstrumentTransactionNumber.ts +93 -0
  5. package/example/src/chevre/migrateDeleteTransactionTasks.ts +119 -0
  6. package/example/src/chevre/migrateEventMakesOfferAvailableAtOrFrom.ts +87 -0
  7. package/example/src/chevre/migrateIAMMemberPOSRoles.ts +3 -2
  8. package/example/src/chevre/migrateOfferAvailableAtOrFrom.ts +63 -0
  9. package/example/src/chevre/{migrateOrderPaymentMethodIdentifier.ts → migrateOrderAcceptedOfferSerialNumber.ts} +18 -19
  10. package/example/src/chevre/onAssetTransactionStatusChanged.ts +36 -0
  11. package/example/src/chevre/retryTasks.ts +39 -0
  12. package/example/src/chevre/searchActions.ts +13 -7
  13. package/example/src/chevre/searchOrderAcceptedOffers.ts +13 -3
  14. package/example/src/chevre/searchOrders.ts +13 -15
  15. package/example/src/chevre/searchSlicedAcceptedOffersByOrderNumber.ts +28 -0
  16. package/example/src/chevre/sendOrder.ts +37 -0
  17. package/example/src/chevre/transaction/processPlaceOrder.ts +2 -3
  18. package/example/src/verifyToken.ts +44 -0
  19. package/lib/chevre/credentials.d.ts +2 -0
  20. package/lib/chevre/credentials.js +4 -2
  21. package/lib/chevre/errorHandler.js +3 -0
  22. package/lib/chevre/factory/order.d.ts +1 -0
  23. package/lib/chevre/factory/order.js +2 -1
  24. package/lib/chevre/factory/reservedAgentIdentifireNames.js +2 -1
  25. package/lib/chevre/factory/transaction.d.ts +10 -1
  26. package/lib/chevre/repo/acceptedOffer.d.ts +58 -2
  27. package/lib/chevre/repo/acceptedOffer.js +100 -4
  28. package/lib/chevre/repo/accountingReport.d.ts +33 -7
  29. package/lib/chevre/repo/accountingReport.js +157 -5
  30. package/lib/chevre/repo/action.d.ts +32 -8
  31. package/lib/chevre/repo/action.js +114 -54
  32. package/lib/chevre/repo/event.d.ts +20 -0
  33. package/lib/chevre/repo/event.js +22 -0
  34. package/lib/chevre/repo/member.d.ts +8 -1
  35. package/lib/chevre/repo/member.js +7 -1
  36. package/lib/chevre/repo/mongoose/schemas/accountingReport.js +2 -1
  37. package/lib/chevre/repo/mongoose/schemas/action.d.ts +1 -1
  38. package/lib/chevre/repo/mongoose/schemas/action.js +25 -11
  39. package/lib/chevre/repo/mongoose/schemas/order.d.ts +1 -1
  40. package/lib/chevre/repo/mongoose/schemas/order.js +38 -11
  41. package/lib/chevre/repo/offer.d.ts +42 -0
  42. package/lib/chevre/repo/offer.js +35 -0
  43. package/lib/chevre/repo/order.js +43 -20
  44. package/lib/chevre/repo/orderInTransaction.d.ts +44 -0
  45. package/lib/chevre/repo/orderInTransaction.js +164 -0
  46. package/lib/chevre/repo/paymentServiceProvider.js +2 -1
  47. package/lib/chevre/repo/person.js +1 -4
  48. package/lib/chevre/repo/task.d.ts +26 -3
  49. package/lib/chevre/repo/task.js +61 -46
  50. package/lib/chevre/repo/transaction.d.ts +2 -2
  51. package/lib/chevre/repo/transaction.js +13 -36
  52. package/lib/chevre/repository.d.ts +5 -0
  53. package/lib/chevre/repository.js +15 -2
  54. package/lib/chevre/service/aggregation/event/importFromCOA.js +5 -5
  55. package/lib/chevre/service/assetTransaction/pay/factory.js +1 -6
  56. package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.d.ts +9 -0
  57. package/lib/chevre/service/assetTransaction/pay/potentialActions/createPayObjectServiceOutput.js +143 -0
  58. package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +11 -3
  59. package/lib/chevre/service/assetTransaction/pay/potentialActions.js +4 -165
  60. package/lib/chevre/service/assetTransaction/pay.d.ts +21 -6
  61. package/lib/chevre/service/assetTransaction/pay.js +64 -23
  62. package/lib/chevre/service/assetTransaction/reserve/factory.js +11 -14
  63. package/lib/chevre/service/assetTransaction/reserveCOA.d.ts +19 -0
  64. package/lib/chevre/service/assetTransaction/reserveCOA.js +46 -0
  65. package/lib/chevre/service/code.js +1 -1
  66. package/lib/chevre/service/delivery.js +2 -2
  67. package/lib/chevre/service/event/createEvent.js +1 -1
  68. package/lib/chevre/service/event.js +16 -24
  69. package/lib/chevre/service/moneyTransfer.js +1 -1
  70. package/lib/chevre/service/notification.js +71 -66
  71. package/lib/chevre/service/offer/any.d.ts +35 -0
  72. package/lib/chevre/service/offer/any.js +67 -0
  73. package/lib/chevre/service/offer/event/authorize.d.ts +7 -0
  74. package/lib/chevre/service/offer/event/authorize.js +27 -17
  75. package/lib/chevre/service/offer/event/cancel.d.ts +2 -0
  76. package/lib/chevre/service/offer/event/cancel.js +13 -1
  77. package/lib/chevre/service/offer/event/factory.d.ts +1 -1
  78. package/lib/chevre/service/offer/event/factory.js +11 -22
  79. package/lib/chevre/service/offer/event/importFromCOA.js +6 -8
  80. package/lib/chevre/service/offer/event/voidTransaction.d.ts +2 -0
  81. package/lib/chevre/service/offer/event/voidTransaction.js +24 -7
  82. package/lib/chevre/service/offer/eventServiceByCOA/authorize.d.ts +54 -0
  83. package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +138 -0
  84. package/lib/chevre/service/offer/eventServiceByCOA/cancel.d.ts +39 -0
  85. package/lib/chevre/service/offer/eventServiceByCOA/cancel.js +59 -0
  86. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.d.ts +25 -0
  87. package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +165 -0
  88. package/lib/chevre/service/offer/eventServiceByCOA/factory.js +10 -23
  89. package/lib/chevre/service/offer/eventServiceByCOA.d.ts +4 -89
  90. package/lib/chevre/service/offer/eventServiceByCOA.js +7 -292
  91. package/lib/chevre/service/offer/moneyTransfer/authorize.d.ts +10 -1
  92. package/lib/chevre/service/offer/moneyTransfer/authorize.js +49 -3
  93. package/lib/chevre/service/offer/moneyTransfer/returnMoneyTransfer.js +1 -1
  94. package/lib/chevre/service/offer/moneyTransfer/settleTransaction.d.ts +2 -0
  95. package/lib/chevre/service/offer/moneyTransfer/settleTransaction.js +47 -2
  96. package/lib/chevre/service/offer/moneyTransfer/voidTransaction.js +1 -1
  97. package/lib/chevre/service/offer/product/factory.js +2 -5
  98. package/lib/chevre/service/offer/product.d.ts +2 -0
  99. package/lib/chevre/service/offer/product.js +11 -23
  100. package/lib/chevre/service/order/confirmPayTransaction.d.ts +3 -1
  101. package/lib/chevre/service/order/confirmPayTransaction.js +5 -5
  102. package/lib/chevre/service/order/createAccountingReportIfNotExist.js +1 -1
  103. package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +12 -1
  104. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +206 -7
  105. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  106. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +1 -1
  107. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +51 -53
  108. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +1 -1
  109. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +10 -25
  110. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +16 -0
  111. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.js +91 -0
  112. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.d.ts +8 -0
  113. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially.js +37 -0
  114. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.d.ts +12 -0
  115. package/lib/chevre/service/order/onOrderStatusChanged/onOrderInTransit.js +115 -0
  116. package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +19 -1
  117. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.d.ts +8 -0
  118. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/createSendEmailMessageTaskIfNotExist.js +41 -0
  119. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +6 -10
  120. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +116 -92
  121. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +4 -1
  122. package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +81 -84
  123. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  124. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
  125. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +62 -1
  126. package/lib/chevre/service/order/onOrderStatusChanged.d.ts +3 -1
  127. package/lib/chevre/service/order/onOrderStatusChanged.js +5 -1
  128. package/lib/chevre/service/order/placeOrder.d.ts +3 -1
  129. package/lib/chevre/service/order/placeOrder.js +157 -50
  130. package/lib/chevre/service/order/returnOrder.js +25 -16
  131. package/lib/chevre/service/order/sendOrder.d.ts +5 -0
  132. package/lib/chevre/service/order/sendOrder.js +67 -33
  133. package/lib/chevre/service/payment/any/onPaid.js +1 -1
  134. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.d.ts +3 -1
  135. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onPaid.js +15 -9
  136. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.d.ts +3 -1
  137. package/lib/chevre/service/payment/any/onPaymentStatusChanged/onRefunded.js +8 -5
  138. package/lib/chevre/service/payment/any/onPaymentStatusChanged.js +2 -2
  139. package/lib/chevre/service/payment/any/onRefund.js +1 -1
  140. package/lib/chevre/service/payment/any.d.ts +6 -5
  141. package/lib/chevre/service/payment/any.js +3 -2
  142. package/lib/chevre/service/payment/creditCard.d.ts +1 -1
  143. package/lib/chevre/service/payment/creditCard.js +62 -68
  144. package/lib/chevre/service/payment/faceToFace.d.ts +1 -5
  145. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +0 -2
  146. package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +1 -0
  147. package/lib/chevre/service/payment/movieTicket/validation.d.ts +0 -2
  148. package/lib/chevre/service/payment/movieTicket.d.ts +1 -7
  149. package/lib/chevre/service/payment/movieTicket.js +1 -1
  150. package/lib/chevre/service/payment/paymentCard.d.ts +1 -3
  151. package/lib/chevre/service/payment/paymentCard.js +6 -6
  152. package/lib/chevre/service/payment.d.ts +5 -0
  153. package/lib/chevre/service/payment.js +40 -5
  154. package/lib/chevre/service/product.js +1 -1
  155. package/lib/chevre/service/reserve/cancelReservation.js +2 -2
  156. package/lib/chevre/service/reserve/checkInReservation.d.ts +1 -3
  157. package/lib/chevre/service/reserve/checkInReservation.js +6 -5
  158. package/lib/chevre/service/reserve/confirmReservation.js +1 -1
  159. package/lib/chevre/service/reserve/factory.js +0 -8
  160. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.d.ts +1 -1
  161. package/lib/chevre/service/reserve/potentialActions/onReservationUsed.js +4 -4
  162. package/lib/chevre/service/reserve/searchByOrder.js +2 -1
  163. package/lib/chevre/service/reserve/useReservation.d.ts +1 -3
  164. package/lib/chevre/service/reserve/useReservation.js +10 -9
  165. package/lib/chevre/service/reserve/verifyToken4reservation.js +2 -0
  166. package/lib/chevre/service/task/confirmMoneyTransfer.js +4 -4
  167. package/lib/chevre/service/task/confirmPayTransaction.js +2 -1
  168. package/lib/chevre/service/task/confirmRegisterServiceTransaction.d.ts +1 -1
  169. package/lib/chevre/service/task/confirmRegisterServiceTransaction.js +30 -8
  170. package/lib/chevre/service/task/confirmReserveTransaction.d.ts +6 -1
  171. package/lib/chevre/service/task/confirmReserveTransaction.js +176 -29
  172. package/lib/chevre/service/task/createAccountingReport.d.ts +6 -0
  173. package/lib/chevre/service/task/createAccountingReport.js +80 -0
  174. package/lib/chevre/service/task/importOffersFromCOA.js +2 -1
  175. package/lib/chevre/service/task/onAuthorizationCreated.js +0 -1
  176. package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +7 -7
  177. package/lib/chevre/service/task/pay.js +6 -0
  178. package/lib/chevre/service/task/placeOrder.js +9 -10
  179. package/lib/chevre/service/task/returnOrder.js +0 -3
  180. package/lib/chevre/service/task/returnPayTransaction.js +1 -1
  181. package/lib/chevre/service/task/returnReserveTransaction.js +3 -2
  182. package/lib/chevre/service/task/sendOrder.js +8 -4
  183. package/lib/chevre/service/task/useReservation.js +1 -1
  184. package/lib/chevre/service/task/voidReserveTransaction.js +8 -12
  185. package/lib/chevre/service/transaction/deleteTransaction.js +1 -1
  186. package/lib/chevre/service/transaction/moneyTransfer/potentialActions.js +2 -18
  187. package/lib/chevre/service/transaction/moneyTransfer.js +7 -6
  188. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.d.ts +2 -2
  189. package/lib/chevre/service/transaction/placeOrder/exportTasks/factory.js +17 -20
  190. package/lib/chevre/service/transaction/placeOrder.js +2 -1
  191. package/lib/chevre/service/transaction/placeOrderInProgress/confirm.d.ts +51 -0
  192. package/lib/chevre/service/transaction/placeOrderInProgress/confirm.js +268 -0
  193. package/lib/chevre/service/transaction/placeOrderInProgress/factory.d.ts +1 -1
  194. package/lib/chevre/service/transaction/placeOrderInProgress/factory.js +3 -2
  195. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/moneyTransfer.js +1 -1
  196. package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions.js +22 -44
  197. package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.d.ts +14 -0
  198. package/lib/chevre/service/transaction/placeOrderInProgress/publishCode.js +41 -0
  199. package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.d.ts +18 -0
  200. package/lib/chevre/service/transaction/placeOrderInProgress/publishConfirmationNumberIfNotExist.js +42 -0
  201. package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.d.ts +23 -0
  202. package/lib/chevre/service/transaction/placeOrderInProgress/publishOrderNumberIfNotExist.js +46 -0
  203. package/lib/chevre/service/transaction/placeOrderInProgress/result/acceptedOffers.js +34 -37
  204. package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +3 -1
  205. package/lib/chevre/service/transaction/placeOrderInProgress/result.js +13 -4
  206. package/lib/chevre/service/transaction/placeOrderInProgress/start.d.ts +19 -0
  207. package/lib/chevre/service/transaction/placeOrderInProgress/start.js +46 -0
  208. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.d.ts +26 -0
  209. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateStartRequest.js +109 -0
  210. package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +10 -23
  211. package/lib/chevre/service/transaction/placeOrderInProgress/validation.js +20 -1
  212. package/lib/chevre/service/transaction/placeOrderInProgress.d.ts +11 -73
  213. package/lib/chevre/service/transaction/placeOrderInProgress.js +13 -286
  214. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +1 -2
  215. package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
  216. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +8 -3
  217. package/lib/chevre/service/transaction/returnOrder/preStart.js +78 -50
  218. package/lib/chevre/service/transaction/returnOrder.js +3 -10
  219. package/lib/chevre/service.js +0 -10
  220. package/lib/chevre/settings.d.ts +7 -3
  221. package/lib/chevre/settings.js +13 -4
  222. package/package.json +5 -9
  223. package/example/src/chevre/cleanAccountingReports.ts +0 -57
  224. package/example/src/chevre/migratePayTransactionPaymentMethodIdentifier.ts +0 -78
  225. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.d.ts +0 -11
  226. package/lib/chevre/service/transaction/placeOrderInProgress/validation/validateSeller.js +0 -30
  227. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +0 -7
  228. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +0 -82
  229. package/lib/chevre/service/util.d.ts +0 -19
  230. package/lib/chevre/service/util.js +0 -126
@@ -1,89 +1,4 @@
1
- import type { MongoRepository as ActionRepo } from '../../repo/action';
2
- import type { MongoRepository as CategoryCodeRepo } from '../../repo/categoryCode';
3
- import type { MongoRepository as EventRepo } from '../../repo/event';
4
- import type { MongoRepository as OfferRepo } from '../../repo/offer';
5
- import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
6
- import { IAcceptedOfferBeforeAuthorize4COA } from './eventServiceByCOA/validateAcceptedOffers';
7
- import * as factory from '../../factory';
8
- export import WebAPIIdentifier = factory.service.webAPI.Identifier;
9
- interface IAuthorizeRepos {
10
- action: ActionRepo;
11
- categoryCode: CategoryCodeRepo;
12
- event: EventRepo;
13
- offer: OfferRepo;
14
- transaction: TransactionRepo;
15
- }
16
- export type IAuthorizeOperation<T> = (repos: IAuthorizeRepos) => Promise<T>;
17
- export type IAuthorizeOfferAction = factory.action.authorize.offer.eventService.IAction<WebAPIIdentifier.COA>;
18
- /**
19
- * COA興行オファー承認
20
- */
21
- export declare function authorize(params: {
22
- object: {
23
- acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
24
- event: {
25
- id: string;
26
- };
27
- };
28
- agent: {
29
- id: string;
30
- };
31
- transaction: {
32
- id: string;
33
- };
34
- result: {
35
- requestBody: factory.action.authorize.offer.eventService.IRequestBody<WebAPIIdentifier.COA>;
36
- responseBody: factory.action.authorize.offer.eventService.IResponseBody<WebAPIIdentifier.COA>;
37
- };
38
- }): IAuthorizeOperation<IAuthorizeOfferAction>;
39
- interface ICancelResult {
40
- theaterCode: string;
41
- dateJouei: string;
42
- titleCode: string;
43
- titleBranchNum: string;
44
- timeBegin: string;
45
- tmpReserveNum: string;
46
- }
47
- /**
48
- * COA興行オファー承認取消
49
- */
50
- export declare function cancel(params: {
51
- /**
52
- * 承認アクションID
53
- */
54
- id: string;
55
- /**
56
- * 取引進行者
57
- */
58
- agent: {
59
- id: string;
60
- };
61
- /**
62
- * 取引
63
- */
64
- transaction: {
65
- id: string;
66
- };
67
- }): (repos: {
68
- action: ActionRepo;
69
- transaction: TransactionRepo;
70
- }) => Promise<ICancelResult | undefined>;
71
- /**
72
- * COA興行オファー承認のオファーを変更
73
- */
74
- export declare function changeOffers(params: {
75
- id: string;
76
- object: {
77
- acceptedOffer: IAcceptedOfferBeforeAuthorize4COA[];
78
- event: {
79
- id: string;
80
- };
81
- };
82
- agent: {
83
- id: string;
84
- };
85
- transaction: {
86
- id: string;
87
- };
88
- }): IAuthorizeOperation<IAuthorizeOfferAction>;
89
- export {};
1
+ import { authorize } from './eventServiceByCOA/authorize';
2
+ import { cancel } from './eventServiceByCOA/cancel';
3
+ import { changeOffers } from './eventServiceByCOA/changeOffers';
4
+ export { authorize, cancel, changeOffers };
@@ -1,294 +1,9 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
2
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.changeOffers = exports.cancel = exports.authorize = exports.WebAPIIdentifier = void 0;
13
- const moment = require("moment");
14
- const factory_1 = require("./eventServiceByCOA/factory");
15
- const validateAcceptedOffers_1 = require("./eventServiceByCOA/validateAcceptedOffers");
16
- const factory = require("../../factory");
17
- exports.WebAPIIdentifier = factory.service.webAPI.Identifier;
18
- /**
19
- * COA興行オファー承認
20
- */
21
- function authorize(params) {
22
- // tslint:disable-next-line:max-func-body-length
23
- return (repos) => __awaiter(this, void 0, void 0, function* () {
24
- const transaction = yield repos.transaction.findInProgressById({
25
- typeOf: factory.transactionType.PlaceOrder,
26
- id: params.transaction.id
27
- });
28
- if (transaction.agent.id !== params.agent.id) {
29
- throw new factory.errors.Forbidden('Transaction not yours');
30
- }
31
- let screeningEvent;
32
- let acceptedOffers;
33
- const pendingTransaction = {
34
- theaterCode: params.result.requestBody.theaterCode,
35
- dateJouei: params.result.requestBody.dateJouei,
36
- titleCode: params.result.requestBody.titleCode,
37
- titleBranchNum: params.result.requestBody.titleBranchNum,
38
- timeBegin: params.result.requestBody.timeBegin,
39
- tmpReserveNum: params.result.responseBody.tmpReserveNum,
40
- transactionNumber: params.result.responseBody.tmpReserveNum,
41
- typeOf: 'COAReserveTransaction'
42
- };
43
- try {
44
- // イベント取得属性最適化(2023-01-23~)
45
- screeningEvent =
46
- yield repos.event.findMinimizedIndividualEventById({ id: params.object.event.id });
47
- const availablePaymentMethodTypes = yield repos.categoryCode.search({
48
- project: { id: { $eq: transaction.project.id } },
49
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
50
- }, [], []);
51
- const seatingTypes = yield repos.categoryCode.search({
52
- project: { id: { $eq: transaction.project.id } },
53
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
54
- }, [], []);
55
- const videoFormatTypes = yield repos.categoryCode.search({
56
- project: { id: { $eq: transaction.project.id } },
57
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
58
- }, [], []);
59
- // COA仮予約後にリクエストが来る前提
60
- const validateAcceptedOffersResult = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
61
- object: params.object,
62
- project: { id: transaction.project.id },
63
- screeningEvent,
64
- availablePaymentMethodTypes,
65
- seatingTypes,
66
- videoFormatTypes
67
- })(repos);
68
- acceptedOffers = validateAcceptedOffersResult.acceptedOffers;
69
- }
70
- catch (error) {
71
- // アクション開始前に例外がthrowされてもCOA仮予約を取り消す機会をつくるためにFailedアクションを作成する(2023-09-12~)
72
- const failedActionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
73
- acceptedOffers: [],
74
- event: { id: params.object.event.id, typeOf: factory.eventType.ScreeningEvent },
75
- transaction,
76
- pendingTransaction
77
- });
78
- const failedAction = yield repos.action.start(failedActionAttributes);
79
- yield repos.action.giveUp({ typeOf: failedAction.typeOf, id: failedAction.id, error });
80
- throw error;
81
- }
82
- // 承認アクションを開始
83
- const actionAttributes = (0, factory_1.createAuthorizeSeatReservationActionAttributes)({
84
- acceptedOffers,
85
- event: screeningEvent,
86
- transaction,
87
- pendingTransaction
88
- });
89
- const action = yield repos.action.start(actionAttributes);
90
- try {
91
- // no op
92
- }
93
- catch (error) {
94
- try {
95
- yield repos.action.giveUp({ typeOf: action.typeOf, id: action.id, error });
96
- }
97
- catch (__) {
98
- // no op
99
- }
100
- throw error;
101
- }
102
- // 座席仮予約からオファー情報を生成する
103
- const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
104
- const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
105
- responseBody: params.result.responseBody,
106
- object: action.object,
107
- event: screeningEvent,
108
- seller: transaction.seller,
109
- bookingTime: moment(action.startDate)
110
- .toDate(),
111
- totalPrice: price
112
- });
113
- const result = {
114
- price: price,
115
- priceCurrency: factory.priceCurrency.JPY,
116
- // eligibleMonetaryAmountを使用(2023-03-08~)
117
- // amount: (requiredPoint > 0)
118
- // ? [{
119
- // typeOf: 'MonetaryAmount',
120
- // currency: 'Point',
121
- // value: requiredPoint
122
- // }]
123
- // : [],
124
- amount: eligibleMonetaryAmount,
125
- requestBody: params.result.requestBody,
126
- responseBody: params.result.responseBody,
127
- acceptedOffers: acceptedOffers4result
128
- };
129
- return yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
130
- });
131
- }
132
- exports.authorize = authorize;
133
- /**
134
- * COA興行オファー承認取消
135
- */
136
- function cancel(params) {
137
- return (repos) => __awaiter(this, void 0, void 0, function* () {
138
- const transaction = yield repos.transaction.findInProgressById({
139
- typeOf: factory.transactionType.PlaceOrder,
140
- id: params.transaction.id
141
- });
142
- if (transaction.agent.id !== params.agent.id) {
143
- throw new factory.errors.Forbidden('Transaction not yours');
144
- }
145
- // 取引内のアクションかどうか確認
146
- let action = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
147
- if (action.purpose.typeOf !== transaction.typeOf || action.purpose.id !== transaction.id) {
148
- throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
149
- }
150
- // MongoDBでcompleteステータスであるにも関わらず、COAでは削除されている、というのが最悪の状況
151
- // それだけは回避するためにMongoDBを先に変更
152
- action = yield repos.action.cancel({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
153
- let cancelResult;
154
- const actionResult = action.result;
155
- if ((actionResult === null || actionResult === void 0 ? void 0 : actionResult.requestBody) !== undefined && actionResult.responseBody !== undefined) {
156
- cancelResult = {
157
- theaterCode: actionResult.requestBody.theaterCode,
158
- dateJouei: actionResult.requestBody.dateJouei,
159
- titleCode: actionResult.requestBody.titleCode,
160
- titleBranchNum: actionResult.requestBody.titleBranchNum,
161
- timeBegin: actionResult.requestBody.timeBegin,
162
- tmpReserveNum: actionResult.responseBody.tmpReserveNum
163
- };
164
- }
165
- return cancelResult;
166
- });
167
- }
168
- exports.cancel = cancel;
169
- /**
170
- * COA興行オファー承認のオファーを変更
171
- */
172
- function changeOffers(params) {
173
- // tslint:disable-next-line:max-func-body-length
174
- return (repos) => __awaiter(this, void 0, void 0, function* () {
175
- var _a;
176
- const transaction = yield repos.transaction.findInProgressById({
177
- typeOf: factory.transactionType.PlaceOrder,
178
- id: params.transaction.id
179
- });
180
- if (transaction.agent.id !== params.agent.id) {
181
- throw new factory.errors.Forbidden('Transaction not yours');
182
- }
183
- // 取引内のアクションかどうか確認
184
- const authorizeAction = yield repos.action.findById({ typeOf: factory.actionType.AuthorizeAction, id: params.id });
185
- if (authorizeAction.purpose.typeOf !== transaction.typeOf || authorizeAction.purpose.id !== transaction.id) {
186
- throw new factory.errors.Argument('Transaction', 'Action not found in the transaction');
187
- }
188
- validate4changeOffer({ action: authorizeAction, object: params.object });
189
- // 座席情報に関しては元のacceptedOffersで自動補完する(リクエストでは正しく指定されないので注意)(2023-03-20~)
190
- params.object.acceptedOffer = params.object.acceptedOffer.map((offer) => {
191
- const originalAcceptedOfferBySeatNumber = authorizeAction.object.acceptedOffer.find((originalOffer) => {
192
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
193
- return ((_d = (_c = (_b = (_a = originalOffer.itemOffered) === null || _a === void 0 ? void 0 : _a.serviceOutput) === null || _b === void 0 ? void 0 : _b.reservedTicket) === null || _c === void 0 ? void 0 : _c.ticketedSeat) === null || _d === void 0 ? void 0 : _d.seatSection)
194
- === ((_g = (_f = (_e = offer.itemOffered.serviceOutput) === null || _e === void 0 ? void 0 : _e.reservedTicket) === null || _f === void 0 ? void 0 : _f.ticketedSeat) === null || _g === void 0 ? void 0 : _g.seatSection)
195
- && ((_k = (_j = (_h = originalOffer.itemOffered.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatNumber)
196
- === ((_o = (_m = (_l = offer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber);
197
- });
198
- if (originalAcceptedOfferBySeatNumber === undefined) {
199
- throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
200
- }
201
- return Object.assign(Object.assign({}, offer), { ticketInfo: Object.assign(Object.assign({}, offer.ticketInfo), { spseatAdd1: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd1, spseatAdd2: originalAcceptedOfferBySeatNumber.ticketInfo.spseatAdd2, spseatKbn: originalAcceptedOfferBySeatNumber.ticketInfo.spseatKbn }) });
202
- });
203
- // イベント取得属性最適化(2023-01-23~)
204
- const screeningEvent = yield repos.event.findMinimizedIndividualEventById({
205
- id: params.object.event.id
206
- });
207
- const availablePaymentMethodTypes = yield repos.categoryCode.search({
208
- project: { id: { $eq: transaction.project.id } },
209
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.PaymentMethodType } }
210
- }, [], []);
211
- const seatingTypes = yield repos.categoryCode.search({
212
- project: { id: { $eq: transaction.project.id } },
213
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.SeatingType } }
214
- }, [], []);
215
- const videoFormatTypes = yield repos.categoryCode.search({
216
- project: { id: { $eq: transaction.project.id } },
217
- inCodeSet: { identifier: { $eq: factory.categoryCode.CategorySetIdentifier.VideoFormatType } }
218
- }, [], []);
219
- // COA仮予約後にリクエストが来る前提
220
- const { acceptedOffers } = yield (0, validateAcceptedOffers_1.validateAcceptedOffers)({
221
- object: params.object,
222
- project: { id: transaction.project.id },
223
- screeningEvent,
224
- availablePaymentMethodTypes,
225
- seatingTypes,
226
- videoFormatTypes
227
- })(repos);
228
- // 供給情報と価格を変更してからDB更新
229
- authorizeAction.object.acceptedOffer = acceptedOffers;
230
- const updTmpReserveSeatResult = (_a = authorizeAction.result) === null || _a === void 0 ? void 0 : _a.responseBody;
231
- if (updTmpReserveSeatResult === undefined) {
232
- throw new factory.errors.NotFound('action.result.responseBody');
233
- }
234
- const { price, eligibleMonetaryAmount } = (0, factory_1.offers2resultPrice)(acceptedOffers);
235
- const acceptedOffers4result = (0, factory_1.responseBody2acceptedOffers4result)({
236
- responseBody: updTmpReserveSeatResult,
237
- object: authorizeAction.object,
238
- event: screeningEvent,
239
- seller: transaction.seller,
240
- bookingTime: moment(authorizeAction.startDate)
241
- .toDate(),
242
- totalPrice: price
243
- });
244
- const actionResult = Object.assign(Object.assign({}, authorizeAction.result), { price: price,
245
- // eligibleMonetaryAmountを使用(2023-03-08~)
246
- // amount: (requiredPoint > 0)
247
- // ? [{
248
- // typeOf: 'MonetaryAmount',
249
- // currency: 'Point',
250
- // value: requiredPoint
251
- // }]
252
- // : [],
253
- amount: eligibleMonetaryAmount, acceptedOffers: acceptedOffers4result });
254
- // 座席予約承認アクションの供給情報を変更する
255
- return repos.action.updateAuthorizeEventOfferAction({
256
- id: params.id,
257
- object: authorizeAction.object,
258
- result: actionResult
259
- });
260
- });
261
- }
262
- exports.changeOffers = changeOffers;
263
- function validate4changeOffer(params) {
264
- // アクション中のイベント識別子と座席リストが合っているかどうか確認
265
- const authorizeAction = params.action;
266
- // 完了ステータスのアクションのみ更新可能
267
- if (authorizeAction.actionStatus !== factory.actionStatusType.CompletedActionStatus) {
268
- throw new factory.errors.NotFound('authorizeAction');
269
- }
270
- // tslint:disable-next-line:no-single-line-block-comment
271
- /* istanbul ignore if */
272
- if (authorizeAction.object.event === undefined) {
273
- throw new factory.errors.NotFound('authorizeAction.object.event');
274
- }
275
- // イベントが一致しているかどうか
276
- if (authorizeAction.object.event.id !== params.object.event.id) {
277
- throw new factory.errors.Argument('Event', 'Event ID not matched.');
278
- }
279
- // 座席セクションと座席番号が一致しているかどうか
280
- const acceptedOfferParams = (Array.isArray(params.object.acceptedOffer)) ? params.object.acceptedOffer : [];
281
- const allSeatsExisted = authorizeAction.object.acceptedOffer.every((originalAcceptedOffer) => {
282
- return acceptedOfferParams.some((o) => {
283
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
284
- const newSeatSection = (_c = (_b = (_a = o.itemOffered.serviceOutput) === null || _a === void 0 ? void 0 : _a.reservedTicket) === null || _b === void 0 ? void 0 : _b.ticketedSeat) === null || _c === void 0 ? void 0 : _c.seatSection;
285
- const newSeatNumber = (_f = (_e = (_d = o.itemOffered.serviceOutput) === null || _d === void 0 ? void 0 : _d.reservedTicket) === null || _e === void 0 ? void 0 : _e.ticketedSeat) === null || _f === void 0 ? void 0 : _f.seatNumber;
286
- return ((_k = (_j = (_h = (_g = originalAcceptedOffer.itemOffered) === null || _g === void 0 ? void 0 : _g.serviceOutput) === null || _h === void 0 ? void 0 : _h.reservedTicket) === null || _j === void 0 ? void 0 : _j.ticketedSeat) === null || _k === void 0 ? void 0 : _k.seatSection) === newSeatSection
287
- && ((_o = (_m = (_l = originalAcceptedOffer.itemOffered.serviceOutput) === null || _l === void 0 ? void 0 : _l.reservedTicket) === null || _m === void 0 ? void 0 : _m.ticketedSeat) === null || _o === void 0 ? void 0 : _o.seatNumber) === newSeatNumber;
288
- });
289
- });
290
- const allSeatsMatched = (acceptedOfferParams.length === authorizeAction.object.acceptedOffer.length) && allSeatsExisted;
291
- if (!allSeatsMatched) {
292
- throw new factory.errors.Argument('offers', 'seatSection or seatNumber not matched.');
293
- }
294
- }
3
+ exports.changeOffers = exports.cancel = exports.authorize = void 0;
4
+ const authorize_1 = require("./eventServiceByCOA/authorize");
5
+ Object.defineProperty(exports, "authorize", { enumerable: true, get: function () { return authorize_1.authorize; } });
6
+ const cancel_1 = require("./eventServiceByCOA/cancel");
7
+ Object.defineProperty(exports, "cancel", { enumerable: true, get: function () { return cancel_1.cancel; } });
8
+ const changeOffers_1 = require("./eventServiceByCOA/changeOffers");
9
+ Object.defineProperty(exports, "changeOffers", { enumerable: true, get: function () { return changeOffers_1.changeOffers; } });
@@ -1,6 +1,8 @@
1
1
  import * as factory from '../../../factory';
2
2
  import type { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import type { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
4
+ import type { MongoRepository as OrderInTransactionRepo } from '../../../repo/orderInTransaction';
5
+ import type { RedisRepository as OrderNumberRepo } from '../../../repo/orderNumber';
4
6
  import type { MongoRepository as ProductRepo } from '../../../repo/product';
5
7
  import type { MongoRepository as ProjectRepo } from '../../../repo/project';
6
8
  import type { MongoRepository as TransactionRepo } from '../../../repo/transaction';
@@ -10,6 +12,8 @@ interface IAuthorizeRepos {
10
12
  product: ProductRepo;
11
13
  project: ProjectRepo;
12
14
  assetTransaction: AssetTransactionRepo;
15
+ orderInTransaction: OrderInTransactionRepo;
16
+ orderNumber: OrderNumberRepo;
13
17
  transaction: TransactionRepo;
14
18
  transactionNumber: TransactionNumberRepo;
15
19
  }
@@ -24,5 +28,10 @@ export declare function authorize(params: {
24
28
  };
25
29
  object: factory.action.authorize.offer.moneyTransfer.IObject;
26
30
  purpose: factory.action.authorize.offer.moneyTransfer.IPurpose;
27
- }): IAuthorizeOperation<factory.action.authorize.offer.moneyTransfer.IAction>;
31
+ }): IAuthorizeOperation<{
32
+ /**
33
+ * 承認アクションID
34
+ */
35
+ id: string;
36
+ }>;
28
37
  export {};
@@ -13,6 +13,7 @@ exports.authorize = void 0;
13
13
  const moment = require("moment");
14
14
  const factory = require("../../../factory");
15
15
  const MoneyTransferAssetTransactionService = require("../../assetTransaction/moneyTransfer");
16
+ const any_1 = require("../any");
16
17
  function authorize(params) {
17
18
  return (repos) => __awaiter(this, void 0, void 0, function* () {
18
19
  const transaction = yield repos.transaction.findInProgressById({
@@ -26,6 +27,7 @@ function authorize(params) {
26
27
  const { transactionNumber } = yield repos.transactionNumber.publishByTimestamp({ startDate: new Date() });
27
28
  let requestBody;
28
29
  let responseBody;
30
+ let acceptedOffers4result = [];
29
31
  // 承認アクションを開始
30
32
  const actionAttributes = createAuthorizeMoneyTransferOfferActionattributes({
31
33
  transaction,
@@ -48,6 +50,12 @@ function authorize(params) {
48
50
  if (responseBody.object.amount.currency === factory.priceCurrency.JPY) {
49
51
  price = Number(responseBody.object.amount.value);
50
52
  }
53
+ acceptedOffers4result = responseBody2resultAcceptedOffer({ responseBody, object: actionAttributes.object });
54
+ yield (0, any_1.acceptOffer)({
55
+ project: transaction.project,
56
+ purpose: { id: transaction.id },
57
+ acceptedOffers: acceptedOffers4result
58
+ })(repos);
51
59
  }
52
60
  catch (error) {
53
61
  try {
@@ -61,13 +69,47 @@ function authorize(params) {
61
69
  const result = {
62
70
  price,
63
71
  priceCurrency: factory.priceCurrency.JPY,
64
- requestBody: requestBody,
65
- responseBody: responseBody
72
+ requestBody,
73
+ responseBody,
74
+ acceptedOffers: acceptedOffers4result
66
75
  };
67
- return repos.action.complete({ typeOf: action.typeOf, id: action.id, result: result });
76
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
77
+ return { id: action.id };
68
78
  });
69
79
  }
70
80
  exports.authorize = authorize;
81
+ function responseBody2resultAcceptedOffer(params) {
82
+ var _a;
83
+ const acceptedOffers = [];
84
+ const { typeOf, transactionNumber } = params.responseBody;
85
+ const amountValue = params.responseBody.object.amount.value;
86
+ const currency = params.responseBody.object.amount.currency;
87
+ const itemOffered = {
88
+ typeOf: factory.actionType.MoneyTransfer,
89
+ amount: {
90
+ typeOf: 'MonetaryAmount',
91
+ value: amountValue,
92
+ currency
93
+ },
94
+ toLocation: {
95
+ typeOf: params.object.itemOffered.toLocation.typeOf,
96
+ // いったんマスク
97
+ identifier: 'xxx',
98
+ issuedThrough: { id: (_a = params.object.itemOffered.toLocation.issuedThrough) === null || _a === void 0 ? void 0 : _a.id }
99
+ },
100
+ object: {
101
+ // MonetaryAmountの識別子として、MoneyTransfer取引番号をセットする
102
+ pendingTransaction: { typeOf, transactionNumber }
103
+ },
104
+ name: `${amountValue} ${currency}`
105
+ };
106
+ acceptedOffers.push({
107
+ typeOf: factory.offerType.Offer,
108
+ itemOffered,
109
+ serialNumber: transactionNumber
110
+ });
111
+ return acceptedOffers;
112
+ }
71
113
  function createAuthorizeMoneyTransferOfferActionattributes(params) {
72
114
  var _a, _b;
73
115
  const transaction = params.transaction;
@@ -75,6 +117,10 @@ function createAuthorizeMoneyTransferOfferActionattributes(params) {
75
117
  return {
76
118
  project: transaction.project,
77
119
  typeOf: factory.actionType.AuthorizeAction,
120
+ instrument: {
121
+ typeOf: factory.assetTransactionType.MoneyTransfer,
122
+ transactionNumber: params.transactionNumber
123
+ },
78
124
  object: {
79
125
  project: { typeOf: transaction.project.typeOf, id: transaction.project.id },
80
126
  typeOf: factory.offerType.Offer,
@@ -74,7 +74,7 @@ function returnMoneyTransfer(params) {
74
74
  throw error;
75
75
  }
76
76
  const actionResult = {};
77
- yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
77
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
78
78
  });
79
79
  }
80
80
  exports.returnMoneyTransfer = returnMoneyTransfer;
@@ -1,7 +1,9 @@
1
1
  import * as factory from '../../../factory';
2
2
  import type { MongoRepository as ActionRepo } from '../../../repo/action';
3
3
  import type { MongoRepository as AssetTransactionRepo } from '../../../repo/assetTransaction';
4
+ import type { MongoRepository as TaskRepo } from '../../../repo/task';
4
5
  export declare function settleTransaction(params: factory.task.IData<factory.taskName.ConfirmMoneyTransfer>): (repos: {
5
6
  action: ActionRepo;
6
7
  assetTransaction: AssetTransactionRepo;
8
+ task: TaskRepo;
7
9
  }) => Promise<void>;
@@ -10,12 +10,22 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.settleTransaction = void 0;
13
+ const factory = require("../../../factory");
13
14
  const MoneyTransferAssetTransactionService = require("../../assetTransaction/moneyTransfer");
14
15
  function settleTransaction(params) {
15
16
  return (repos) => __awaiter(this, void 0, void 0, function* () {
16
17
  const action = yield repos.action.start(params);
17
18
  try {
18
- yield MoneyTransferAssetTransactionService.confirm({ id: params.object.pendingTransaction.id })(repos);
19
+ // 廃止(2024-01-30~)
20
+ // if (typeof params.object.pendingTransaction.id === 'string' && params.object.pendingTransaction.id.length > 0) {
21
+ // await MoneyTransferAssetTransactionService.confirm({ id: params.object.pendingTransaction.id })(repos);
22
+ // }
23
+ if (typeof params.object.transactionNumber === 'string' && params.object.transactionNumber.length > 0) {
24
+ yield MoneyTransferAssetTransactionService.confirm({ transactionNumber: params.object.transactionNumber })(repos);
25
+ }
26
+ else {
27
+ throw new factory.errors.ArgumentNull('object.transactionNumber');
28
+ }
19
29
  }
20
30
  catch (error) {
21
31
  try {
@@ -27,7 +37,42 @@ function settleTransaction(params) {
27
37
  throw error;
28
38
  }
29
39
  const actionResult = {};
30
- yield repos.action.complete({ typeOf: action.typeOf, id: action.id, result: actionResult });
40
+ yield repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
41
+ yield onConfirmed(params)({
42
+ task: repos.task
43
+ });
31
44
  });
32
45
  }
33
46
  exports.settleTransaction = settleTransaction;
47
+ function onConfirmed(params) {
48
+ return (repos) => __awaiter(this, void 0, void 0, function* () {
49
+ if (params.purpose.typeOf === factory.order.OrderType.Order) {
50
+ // タスク冪等作成
51
+ const onAssetTransactionStatusChangedTaskData = {
52
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
53
+ object: {
54
+ typeOf: params.object.typeOf,
55
+ transactionNumber: params.object.transactionNumber,
56
+ status: factory.transactionStatusType.Confirmed
57
+ },
58
+ purpose: {
59
+ confirmationNumber: '',
60
+ orderNumber: params.purpose.orderNumber,
61
+ typeOf: factory.order.OrderType.Order
62
+ },
63
+ useOnOrderStatusChanged: true
64
+ };
65
+ const onAssetTransactionStatusChangedTask = {
66
+ project: { id: params.project.id, typeOf: factory.organizationType.Project },
67
+ name: factory.taskName.OnAssetTransactionStatusChanged,
68
+ status: factory.taskStatus.Ready,
69
+ runsAt: new Date(),
70
+ remainingNumberOfTries: 10,
71
+ numberOfTried: 0,
72
+ executionResults: [],
73
+ data: onAssetTransactionStatusChangedTaskData
74
+ };
75
+ yield repos.task.createOnAssetTransactionStatusChangedTaskIfNotExist(onAssetTransactionStatusChangedTask, { emitImmediately: true });
76
+ }
77
+ });
78
+ }
@@ -45,7 +45,7 @@ function voidTransaction(params) {
45
45
  }
46
46
  yield Promise.all(authorizeActions.map((action) => __awaiter(this, void 0, void 0, function* () {
47
47
  var _a, _b;
48
- yield repos.action.cancel({ typeOf: action.typeOf, id: action.id });
48
+ yield repos.action.cancelWithVoid({ typeOf: action.typeOf, id: action.id });
49
49
  const pendingTransactionTransactionNumber = (_b = (_a = action.object.itemOffered.object) === null || _a === void 0 ? void 0 : _a.pendingTransaction) === null || _b === void 0 ? void 0 : _b.transactionNumber;
50
50
  if (typeof pendingTransactionTransactionNumber === 'string') {
51
51
  // 取引が存在すれば中止
@@ -142,11 +142,8 @@ function responseBody2resultAcceptedOffer(params) {
142
142
  id: offer.id,
143
143
  name: offer.name,
144
144
  itemOffered,
145
- priceSpecification
146
- // 不要なので廃止(2023-07-01~)
147
- // priceCurrency: offer.priceCurrency,
148
- // 不要なので廃止(2023-07-01~)
149
- // seller: { name: offer.seller.name, typeOf: offer.seller.typeOf }
145
+ priceSpecification,
146
+ serialNumber: params.responseBody.transactionNumber
150
147
  };
151
148
  return permitAcceptedOffer;
152
149
  });
@@ -4,6 +4,7 @@ import type { MongoRepository as ActionRepo } from '../../repo/action';
4
4
  import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
5
5
  import type { MongoRepository as OfferRepo } from '../../repo/offer';
6
6
  import type { MongoRepository as OfferCatalogRepo } from '../../repo/offerCatalog';
7
+ import type { MongoRepository as OrderInTransactionRepo } from '../../repo/orderInTransaction';
7
8
  import type { RedisRepository as OrderNumberRepo } from '../../repo/orderNumber';
8
9
  import type { MongoRepository as OwnershipInfoRepo } from '../../repo/ownershipInfo';
9
10
  import type { MongoRepository as ProductRepo } from '../../repo/product';
@@ -19,6 +20,7 @@ export interface IAuthorizeOperationRepos {
19
20
  assetTransaction: AssetTransactionRepo;
20
21
  offer: OfferRepo;
21
22
  offerCatalog: OfferCatalogRepo;
23
+ orderInTransaction: OrderInTransactionRepo;
22
24
  orderNumber: OrderNumberRepo;
23
25
  ownershipInfo: OwnershipInfoRepo;
24
26
  product: ProductRepo;