@chevre/domain 24.0.0-alpha.76 → 24.0.0-alpha.78
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/action/actionProcess.d.ts +2 -2
- package/lib/chevre/repo/action/actionProcess.js +18 -3
- package/lib/chevre/repo/assetTransaction.d.ts +3 -27
- package/lib/chevre/repo/assetTransaction.js +30 -30
- package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +1 -1
- package/lib/chevre/repo/product.d.ts +0 -10
- package/lib/chevre/repo/product.js +28 -22
- package/lib/chevre/repo/task.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/start/factory.js +7 -7
- package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +18 -16
- package/lib/chevre/service/assetTransaction/refund.js +19 -17
- package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +0 -7
- package/lib/chevre/service/assetTransaction/registerService/factory.js +0 -31
- package/lib/chevre/service/assetTransaction/registerService/potentialActions.js +63 -91
- package/lib/chevre/service/assetTransaction/registerService.js +21 -20
- package/lib/chevre/service/assetTransaction/reserve/start.js +8 -8
- package/lib/chevre/service/offer/event/authorize.js +7 -32
- package/lib/chevre/service/offer/product.js +28 -28
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.d.ts +1 -1
- package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +26 -25
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +18 -17
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
- package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
- package/lib/chevre/service/payment/factory.js +23 -23
- package/lib/chevre/service/product.js +16 -16
- package/lib/chevre/service/reserve/confirmReservation.js +19 -17
- package/lib/chevre/service/reserve/factory.d.ts +0 -6
- package/lib/chevre/service/reserve/factory.js +0 -59
- package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +16 -15
- package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +12 -10
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +4 -4
- package/package.json +2 -2
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +0 -15
- package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +0 -44
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -8
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +0 -89
|
@@ -7,41 +7,10 @@ exports.createPotentialActions = createPotentialActions;
|
|
|
7
7
|
const moment_1 = __importDefault(require("moment"));
|
|
8
8
|
const factory_1 = require("../../../factory");
|
|
9
9
|
const MAX_VALID_UNTIL = '3000-01-01T00:00:00Z';
|
|
10
|
-
function createMoneyTransferActions(__) {
|
|
11
|
-
return [];
|
|
12
|
-
// const transaction = params.transaction;
|
|
13
|
-
// const serviceOutputs = transaction.object.map((o) => o.itemOffered.serviceOutput);
|
|
14
|
-
// return serviceOutputs
|
|
15
|
-
// .filter((serviceOutput: any) => serviceOutput.typeOf === 'MoneyTransfer')
|
|
16
|
-
// .map((serviceOutput: any) => {
|
|
17
|
-
// return {
|
|
18
|
-
// project: transaction.project,
|
|
19
|
-
// typeOf: factory.actionType.MoneyTransfer,
|
|
20
|
-
// description: transaction.object.description,
|
|
21
|
-
// result: {
|
|
22
|
-
// amount: serviceOutput.amount
|
|
23
|
-
// },
|
|
24
|
-
// object: {
|
|
25
|
-
// pendingTransaction: {
|
|
26
|
-
// typeOf: factory.assetTransactionType.Deposit,
|
|
27
|
-
// transactionNumber: transaction.transactionNumber
|
|
28
|
-
// }
|
|
29
|
-
// },
|
|
30
|
-
// agent: transaction.agent,
|
|
31
|
-
// recipient: transaction.recipient,
|
|
32
|
-
// amount: serviceOutput.amount,
|
|
33
|
-
// toLocation: serviceOutput.toLocation,
|
|
34
|
-
// purpose: {
|
|
35
|
-
// typeOf: transaction.typeOf,
|
|
36
|
-
// id: transaction.id
|
|
37
|
-
// }
|
|
38
|
-
// };
|
|
39
|
-
// });
|
|
40
|
-
}
|
|
41
10
|
function createRegisterServiceActions(params) {
|
|
42
11
|
const validFrom = (params.endDate instanceof Date) ? params.endDate : new Date();
|
|
43
12
|
return params.transaction.object.map((o) => {
|
|
44
|
-
const pointAward = o.itemOffered.pointAward;
|
|
13
|
+
// const pointAward = o.itemOffered.pointAward;
|
|
45
14
|
const serviceOutput = o.itemOffered.serviceOutput;
|
|
46
15
|
// validFor:undefinedに対応
|
|
47
16
|
let validUntil;
|
|
@@ -55,58 +24,59 @@ function createRegisterServiceActions(params) {
|
|
|
55
24
|
validUntil = (0, moment_1.default)(MAX_VALID_UNTIL)
|
|
56
25
|
.toDate();
|
|
57
26
|
}
|
|
58
|
-
const moneyTransfer = [];
|
|
59
|
-
// ポイント特典があれば適用
|
|
60
|
-
const pointAwardToLocationIdentifier = pointAward?.toLocation?.identifier;
|
|
61
|
-
const pointAwardToLocationTypeOf = pointAward?.toLocation?.typeOf;
|
|
62
|
-
if (typeof pointAward?.amount?.value === 'number'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
27
|
+
// const moneyTransfer: factory.action.transfer.moneyTransfer.IAttributes[] = [];
|
|
28
|
+
// // ポイント特典があれば適用
|
|
29
|
+
// const pointAwardToLocationIdentifier = pointAward?.toLocation?.identifier;
|
|
30
|
+
// const pointAwardToLocationTypeOf = pointAward?.toLocation?.typeOf;
|
|
31
|
+
// if (typeof pointAward?.amount?.value === 'number'
|
|
32
|
+
// && typeof pointAwardToLocationIdentifier === 'string'
|
|
33
|
+
// && typeof pointAwardToLocationTypeOf === 'string'
|
|
34
|
+
// ) {
|
|
35
|
+
// const fromLocation: factory.action.transfer.moneyTransfer.IAnonymousLocation = {
|
|
36
|
+
// typeOf: (typeof serviceOutput?.issuedBy?.typeOf === 'string')
|
|
37
|
+
// ? serviceOutput?.issuedBy?.typeOf
|
|
38
|
+
// : params.transaction.typeOf,
|
|
39
|
+
// name: (serviceOutput?.issuedBy?.name !== undefined)
|
|
40
|
+
// ? (typeof serviceOutput?.issuedBy?.name === 'string')
|
|
41
|
+
// ? serviceOutput?.issuedBy?.name
|
|
42
|
+
// : serviceOutput?.issuedBy?.name.ja
|
|
43
|
+
// : params.transaction.id
|
|
44
|
+
// };
|
|
45
|
+
// const toLocation: factory.action.transfer.moneyTransfer.IPaymentCard = {
|
|
46
|
+
// identifier: pointAwardToLocationIdentifier,
|
|
47
|
+
// typeOf: factory.permit.PermitType.Permit,
|
|
48
|
+
// issuedThrough: { id: String(pointAward.toLocation?.issuedThrough?.id) }
|
|
49
|
+
// };
|
|
50
|
+
// const recipient: factory.action.transfer.moneyTransfer.IRecipient = {
|
|
51
|
+
// typeOf: factory.personType.Person,
|
|
52
|
+
// id: '',
|
|
53
|
+
// name: String(fromLocation)
|
|
54
|
+
// };
|
|
55
|
+
// moneyTransfer.push({
|
|
56
|
+
// project: params.transaction.project,
|
|
57
|
+
// typeOf: factory.actionType.MoneyTransfer,
|
|
58
|
+
// agent: params.transaction.project,
|
|
59
|
+
// recipient,
|
|
60
|
+
// object: {
|
|
61
|
+
// typeOf: factory.account.transactionType.Deposit
|
|
62
|
+
// },
|
|
63
|
+
// purpose: {
|
|
64
|
+
// typeOf: params.transaction.typeOf,
|
|
65
|
+
// id: params.transaction.id,
|
|
66
|
+
// // 入金取引に識別子を指定する
|
|
67
|
+
// ...(typeof pointAward.purpose?.identifier === 'string') ? { identifier: pointAward.purpose.identifier } : undefined
|
|
68
|
+
// },
|
|
69
|
+
// amount: {
|
|
70
|
+
// typeOf: 'MonetaryAmount',
|
|
71
|
+
// value: pointAward.amount?.value,
|
|
72
|
+
// currency: pointAward.amount?.currency
|
|
73
|
+
// },
|
|
74
|
+
// fromLocation: fromLocation,
|
|
75
|
+
// toLocation: toLocation,
|
|
76
|
+
// ...(typeof pointAward.description === 'string') ? { description: pointAward.description } : undefined,
|
|
77
|
+
// ...(pointAward.recipient !== undefined) ? { recipient: pointAward.recipient } : undefined
|
|
78
|
+
// });
|
|
79
|
+
// }
|
|
110
80
|
const object = {
|
|
111
81
|
...serviceOutput,
|
|
112
82
|
validFrom: validFrom,
|
|
@@ -121,7 +91,8 @@ function createRegisterServiceActions(params) {
|
|
|
121
91
|
// agent: <factory.creativeWork.softwareApplication.webApplication.ICreativeWork | factory.person.IPerson>params.transaction.agent,
|
|
122
92
|
agent: params.transaction.project,
|
|
123
93
|
potentialActions: {
|
|
124
|
-
|
|
94
|
+
// discontinue(2026-04-18~)
|
|
95
|
+
// moneyTransfer: moneyTransfer
|
|
125
96
|
},
|
|
126
97
|
purpose: {
|
|
127
98
|
typeOf: params.transaction.typeOf,
|
|
@@ -135,14 +106,15 @@ function createRegisterServiceActions(params) {
|
|
|
135
106
|
*/
|
|
136
107
|
async function createPotentialActions(params) {
|
|
137
108
|
// 通貨転送アクション属性作成
|
|
138
|
-
const moneyTransferActionAttributesList = createMoneyTransferActions(params);
|
|
139
|
-
// まずは1転送アクションのみ対応
|
|
140
|
-
if (moneyTransferActionAttributesList.length > 1) {
|
|
141
|
-
|
|
142
|
-
}
|
|
109
|
+
// const moneyTransferActionAttributesList = createMoneyTransferActions(params);
|
|
110
|
+
// // まずは1転送アクションのみ対応
|
|
111
|
+
// if (moneyTransferActionAttributesList.length > 1) {
|
|
112
|
+
// throw new factory.errors.Argument('Transaction', 'Number of moneyTransfer actions must be 1');
|
|
113
|
+
// }
|
|
143
114
|
const registerServiceActionAttributes = createRegisterServiceActions(params);
|
|
144
115
|
return {
|
|
145
|
-
|
|
116
|
+
// discontinue(2026-04-18~)
|
|
117
|
+
// moneyTransfer: moneyTransferActionAttributesList,
|
|
146
118
|
registerService: registerServiceActionAttributes
|
|
147
119
|
};
|
|
148
120
|
}
|
|
@@ -137,10 +137,10 @@ function createTransactionObject(params) {
|
|
|
137
137
|
}
|
|
138
138
|
// discontinue(2026-04-17~)
|
|
139
139
|
// await validatePointAward({ project: { id: params.project.id }, acceptedOffer })(repos);
|
|
140
|
-
const pointAward =
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
});
|
|
140
|
+
// const pointAward = createPointAward({
|
|
141
|
+
// acceptedOffer: acceptedOffer,
|
|
142
|
+
// offer: offer
|
|
143
|
+
// });
|
|
144
144
|
const serviceOutput = (0, factory_2.createServiceOutput)({
|
|
145
145
|
dateIssued: params.dateIssued,
|
|
146
146
|
product: params.product,
|
|
@@ -156,7 +156,8 @@ function createTransactionObject(params) {
|
|
|
156
156
|
typeOf: params.product.typeOf,
|
|
157
157
|
id: String(params.product.id),
|
|
158
158
|
serviceOutput: serviceOutput,
|
|
159
|
-
|
|
159
|
+
// discontinue(2026-04-18~)
|
|
160
|
+
// ...(pointAward !== undefined) ? { pointAward } : undefined
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
163
|
}
|
|
@@ -245,21 +246,21 @@ function exportTasksById(params) {
|
|
|
245
246
|
}
|
|
246
247
|
/* istanbul ignore else */
|
|
247
248
|
if (potentialActions !== undefined) {
|
|
248
|
-
|
|
249
|
-
if (potentialActions.moneyTransfer !== undefined) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
}
|
|
249
|
+
// discontinue(2026-04-18~)
|
|
250
|
+
// if (potentialActions.moneyTransfer !== undefined) {
|
|
251
|
+
// taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
|
|
252
|
+
// return {
|
|
253
|
+
// project: transaction.project,
|
|
254
|
+
// name: factory.taskName.MoneyTransfer as factory.taskName.MoneyTransfer,
|
|
255
|
+
// status: factory.taskStatus.Ready,
|
|
256
|
+
// runsAt: taskRunsAt,
|
|
257
|
+
// remainingNumberOfTries: 10,
|
|
258
|
+
// numberOfTried: 0,
|
|
259
|
+
// executionResults: [],
|
|
260
|
+
// data: a
|
|
261
|
+
// };
|
|
262
|
+
// }));
|
|
263
|
+
// }
|
|
263
264
|
}
|
|
264
265
|
break;
|
|
265
266
|
case factory_1.factory.transactionStatusType.Canceled:
|
|
@@ -12,7 +12,6 @@ const searchOffersByIds_1 = require("../../offer/event/searchOffersByIds");
|
|
|
12
12
|
const cancelReservation_1 = require("../../reserve/cancelReservation");
|
|
13
13
|
const onReservationsCreated_1 = require("../../reserve/potentialActions/onReservationsCreated");
|
|
14
14
|
const createSubReservations_1 = require("./start/createSubReservations");
|
|
15
|
-
const createPointAward_1 = require("./start/factory/createPointAward");
|
|
16
15
|
const createStartParams_1 = require("./start/factory/createStartParams");
|
|
17
16
|
const addOffers2seat_1 = require("./start/factory/addOffers2seat");
|
|
18
17
|
const validateStartRequest_1 = require("./validateStartRequest");
|
|
@@ -357,17 +356,18 @@ function createAcceptedOffers4transactionObject(params) {
|
|
|
357
356
|
const reservationId = `${reservationNumber}-${reservationIndex}`;
|
|
358
357
|
// 入金先検証
|
|
359
358
|
await validatePointAward({ project: { id: params.event.project.id }, acceptedOffer })(repos);
|
|
360
|
-
const pointAward =
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
});
|
|
359
|
+
// const pointAward = createPointAward({
|
|
360
|
+
// project: { id: params.event.project.id },
|
|
361
|
+
// acceptedOffer: acceptedOffer,
|
|
362
|
+
// offer: ticketOffer,
|
|
363
|
+
// reservation: { id: reservationId }
|
|
364
|
+
// });
|
|
366
365
|
// acceptedOffers4transactionObjectには必要な情報のみ保管する
|
|
367
366
|
acceptedOffers4transactionObject.push({
|
|
368
367
|
id: acceptedOffer.id,
|
|
369
368
|
itemOffered: {
|
|
370
|
-
|
|
369
|
+
// discontinue(2026-04-18~)
|
|
370
|
+
// ...(pointAward !== undefined) ? { pointAward } : undefined,
|
|
371
371
|
serviceOutput: { id: reservationId }
|
|
372
372
|
}
|
|
373
373
|
});
|
|
@@ -246,11 +246,11 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
246
246
|
if (offer === undefined) {
|
|
247
247
|
throw new factory_1.factory.errors.NotFound('Ticket Offer', `Ticket Offer ${offerWithoutDetail.id} not found`);
|
|
248
248
|
}
|
|
249
|
-
// ポイント特典入金先の指定があれば入金識別子を発行
|
|
250
|
-
const pointAward = createPointAwardByOfferWithoutDetail({
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
});
|
|
249
|
+
// // ポイント特典入金先の指定があれば入金識別子を発行
|
|
250
|
+
// const pointAward = createPointAwardByOfferWithoutDetail({
|
|
251
|
+
// offerWithoutDetail,
|
|
252
|
+
// transaction: params.transaction
|
|
253
|
+
// });
|
|
254
254
|
const acceptedAppliesToMovieTicket = offerWithoutDetail.priceSpecification?.appliesToMovieTicket;
|
|
255
255
|
// 承認アクションオブジェクトのacceptedOfferにappliesToMovieTicketを連携する(2022-08-02~)
|
|
256
256
|
// const priceSpecification: IAcceptedOfferPriceSpecification = {
|
|
@@ -358,7 +358,8 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
358
358
|
itemOffered: {
|
|
359
359
|
// typeOf: factory.product.ProductType.EventService,
|
|
360
360
|
...(itemOfferedServiceOutput !== undefined) ? { serviceOutput: itemOfferedServiceOutput } : undefined,
|
|
361
|
-
|
|
361
|
+
// discontinue(2026-04-18~)
|
|
362
|
+
// ...(pointAward !== undefined) ? { pointAward } : undefined
|
|
362
363
|
},
|
|
363
364
|
addOn: acceptedAddOns,
|
|
364
365
|
// 追加属性をマージ
|
|
@@ -372,29 +373,3 @@ function acceptedOfferWithoutDetail2acceptedOffer(params) {
|
|
|
372
373
|
};
|
|
373
374
|
};
|
|
374
375
|
}
|
|
375
|
-
function createPointAwardByOfferWithoutDetail(params) {
|
|
376
|
-
const offerWithoutDetail = params.offerWithoutDetail;
|
|
377
|
-
// ポイント特典入金先の指定があれば入金識別子を発行
|
|
378
|
-
let pointAward;
|
|
379
|
-
const pointAwardToLocationIdentifier = offerWithoutDetail.itemOffered?.pointAward?.toLocation?.identifier;
|
|
380
|
-
const pointAwardToLocationIssuedThroughId = offerWithoutDetail.itemOffered?.pointAward?.toLocation?.issuedThrough.id;
|
|
381
|
-
if (typeof pointAwardToLocationIdentifier === 'string' && pointAwardToLocationIdentifier.length > 0
|
|
382
|
-
&& typeof pointAwardToLocationIssuedThroughId === 'string' && pointAwardToLocationIssuedThroughId.length > 0) {
|
|
383
|
-
pointAward = {
|
|
384
|
-
toLocation: {
|
|
385
|
-
identifier: pointAwardToLocationIdentifier,
|
|
386
|
-
issuedThrough: { id: pointAwardToLocationIssuedThroughId }
|
|
387
|
-
},
|
|
388
|
-
typeOf: factory_1.factory.actionType.MoneyTransfer,
|
|
389
|
-
// purpose.identifierはChevre側で自動指定
|
|
390
|
-
// purpose: { identifier: pointAwardPurposeIdentifier },
|
|
391
|
-
// ひとまずrecipientは強制的に指定(指定しないと入金できない)
|
|
392
|
-
recipient: {
|
|
393
|
-
id: params.transaction.agent.id,
|
|
394
|
-
name: `${params.transaction.agent.name}`,
|
|
395
|
-
typeOf: params.transaction.agent.typeOf
|
|
396
|
-
}
|
|
397
|
-
};
|
|
398
|
-
}
|
|
399
|
-
return pointAward;
|
|
400
|
-
}
|
|
@@ -38,7 +38,6 @@ exports.search = search;
|
|
|
38
38
|
exports.authorize = authorize;
|
|
39
39
|
exports.voidTransaction = voidTransaction;
|
|
40
40
|
const factory_1 = require("../../factory");
|
|
41
|
-
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
42
41
|
const availableProductTypes_1 = require("../../factory/availableProductTypes");
|
|
43
42
|
const RegisterServiceTransaction = __importStar(require("../assetTransaction/registerService"));
|
|
44
43
|
const issueOrderNumberIfNotExist_1 = require("../transaction/placeOrder/issueOrderNumberIfNotExist");
|
|
@@ -341,32 +340,32 @@ function validateAcceptedOffers(params) {
|
|
|
341
340
|
if (offer === undefined) {
|
|
342
341
|
throw new factory_1.factory.errors.NotFound('Offer', `Offer ${offerWithoutDetail.id} not found`);
|
|
343
342
|
}
|
|
344
|
-
// ポイント特典入金先の指定があれば入金識別子を発行
|
|
345
|
-
let pointAward;
|
|
346
|
-
const pointAwardToLocationIdentifier = offerWithoutDetail.itemOffered?.pointAward?.toLocation?.identifier;
|
|
347
|
-
const pointAwardToLocationIssuedThroughId = offerWithoutDetail.itemOffered?.pointAward?.toLocation?.issuedThrough.id;
|
|
348
|
-
if (typeof pointAwardToLocationIdentifier === 'string' && pointAwardToLocationIdentifier.length > 0
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
343
|
+
// // ポイント特典入金先の指定があれば入金識別子を発行
|
|
344
|
+
// let pointAward: factory.action.transfer.moneyTransfer.IPointAward | undefined;
|
|
345
|
+
// const pointAwardToLocationIdentifier = offerWithoutDetail.itemOffered?.pointAward?.toLocation?.identifier;
|
|
346
|
+
// const pointAwardToLocationIssuedThroughId = offerWithoutDetail.itemOffered?.pointAward?.toLocation?.issuedThrough.id;
|
|
347
|
+
// if (typeof pointAwardToLocationIdentifier === 'string' && pointAwardToLocationIdentifier.length > 0
|
|
348
|
+
// && typeof pointAwardToLocationIssuedThroughId === 'string' && pointAwardToLocationIssuedThroughId.length > 0) {
|
|
349
|
+
// const pointAwardPurposeIdentifier = createPointAwardIdentifier({
|
|
350
|
+
// project: project,
|
|
351
|
+
// purpose: { orderNumber: params.orderNumber },
|
|
352
|
+
// toLocation: { identifier: pointAwardToLocationIdentifier }
|
|
353
|
+
// });
|
|
354
|
+
// pointAward = {
|
|
355
|
+
// recipient: offerWithoutDetail.itemOffered.pointAward?.recipient,
|
|
356
|
+
// toLocation: {
|
|
357
|
+
// identifier: pointAwardToLocationIdentifier,
|
|
358
|
+
// // toLocation.issuedThroughを保証する
|
|
359
|
+
// issuedThrough: { id: pointAwardToLocationIssuedThroughId },
|
|
360
|
+
// typeOf: factory.permit.PermitType.Permit
|
|
361
|
+
// },
|
|
362
|
+
// typeOf: factory.actionType.MoneyTransfer,
|
|
363
|
+
// purpose: { identifier: pointAwardPurposeIdentifier },
|
|
364
|
+
// ...(typeof offerWithoutDetail.itemOffered.pointAward?.description === 'string')
|
|
365
|
+
// ? { description: offerWithoutDetail.itemOffered.pointAward.description }
|
|
366
|
+
// : undefined
|
|
367
|
+
// };
|
|
368
|
+
// }
|
|
370
369
|
const itemOffered = {
|
|
371
370
|
// project: project,
|
|
372
371
|
typeOf: params.product.typeOf,
|
|
@@ -380,7 +379,8 @@ function validateAcceptedOffers(params) {
|
|
|
380
379
|
issuedBy: issuedBy,
|
|
381
380
|
typeOf: factory_1.factory.permit.PermitType.Permit
|
|
382
381
|
},
|
|
383
|
-
|
|
382
|
+
// discontinue(2026-04-18~)
|
|
383
|
+
// ...(pointAward !== undefined) ? { pointAward } : undefined
|
|
384
384
|
};
|
|
385
385
|
return {
|
|
386
386
|
...offerWithoutDetail,
|
|
@@ -7,7 +7,7 @@ declare function isDeliverable(params: {
|
|
|
7
7
|
id: string;
|
|
8
8
|
};
|
|
9
9
|
orderNumber: string;
|
|
10
|
-
assetTransactionType: factory.assetTransactionType.Reserve | factory.assetTransactionType.
|
|
10
|
+
assetTransactionType: factory.assetTransactionType.Reserve | factory.assetTransactionType.RegisterService;
|
|
11
11
|
}): (repos: {
|
|
12
12
|
acceptedOffer: AcceptedOfferRepo;
|
|
13
13
|
assetTransaction: AssetTransactionRepo;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
2
|
+
// import createDebug from 'debug';
|
|
5
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
4
|
exports.isDeliverable = isDeliverable;
|
|
7
|
-
const debug_1 = __importDefault(require("debug"));
|
|
8
5
|
const factory_1 = require("../../../factory");
|
|
9
|
-
const debug = (
|
|
6
|
+
// const debug = createDebug('chevre-domain:service:order');
|
|
10
7
|
function isDeliverable(params) {
|
|
11
8
|
return async (repos) => {
|
|
12
9
|
let allReserveTransactionConfirmed = false;
|
|
@@ -30,26 +27,30 @@ function isDeliverable(params) {
|
|
|
30
27
|
else {
|
|
31
28
|
allReserveTransactionConfirmed = true;
|
|
32
29
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
30
|
+
// } else if (params.assetTransactionType === factory.assetTransactionType.MoneyTransfer) {
|
|
31
|
+
// allReserveTransactionConfirmed = true;
|
|
32
|
+
// allRegisterServiceTransactionConfirmed = true;
|
|
33
|
+
// // 注文のMoneyTransferTransaction.transactionNumberを取得
|
|
34
|
+
// const moneyTransferTransactionNumbers = await repos.acceptedOffer.distinctValues(
|
|
35
|
+
// { orderNumber: { $in: [params.orderNumber] } },
|
|
36
|
+
// 'acceptedOffers.serialNumber'
|
|
37
|
+
// );
|
|
38
|
+
// if (moneyTransferTransactionNumbers.length > 0) {
|
|
39
|
+
// debug('is deliverable?...', params.orderNumber, 'moneyTransferTransactionNumbers:', moneyTransferTransactionNumbers);
|
|
40
|
+
// const referencedMoneyTransferTransactions = await repos.assetTransaction.search(
|
|
41
|
+
// {
|
|
42
|
+
// project: { id: { $eq: params.project.id } },
|
|
43
|
+
// typeOf: factory.assetTransactionType.MoneyTransfer,
|
|
44
|
+
// transactionNumber: { $in: moneyTransferTransactionNumbers }
|
|
45
|
+
// },
|
|
46
|
+
// ['status']
|
|
47
|
+
// ) as Pick<factory.assetTransaction.moneyTransfer.ITransaction, 'status'>[];
|
|
48
|
+
// allMoneyTransferTransactionConfirmed =
|
|
49
|
+
// referencedMoneyTransferTransactions.length === moneyTransferTransactionNumbers.length
|
|
50
|
+
// && referencedMoneyTransferTransactions.every(({ status }) => status === factory.transactionStatusType.Confirmed);
|
|
51
|
+
// } else {
|
|
52
|
+
// allMoneyTransferTransactionConfirmed = true;
|
|
53
|
+
// }
|
|
53
54
|
}
|
|
54
55
|
else if (params.assetTransactionType === factory_1.factory.assetTransactionType.RegisterService) {
|
|
55
56
|
allReserveTransactionConfirmed = true;
|
|
@@ -48,23 +48,24 @@ function onAssetTransactionStatusChanged(params) {
|
|
|
48
48
|
}
|
|
49
49
|
})(repos, settings);
|
|
50
50
|
break;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
51
|
+
// discontinue(2026-04-18~)
|
|
52
|
+
// case factory.assetTransactionType.MoneyTransfer:
|
|
53
|
+
// if (typeof orderNumber === 'string' && typeof confirmationNumber === 'string') {
|
|
54
|
+
// const deliverable = await isDeliverable({
|
|
55
|
+
// project: { id: params.project.id },
|
|
56
|
+
// orderNumber,
|
|
57
|
+
// assetTransactionType: params.object.typeOf
|
|
58
|
+
// })(repos);
|
|
59
|
+
// if (deliverable) {
|
|
60
|
+
// await processing2inTransit({
|
|
61
|
+
// project: { id: params.project.id },
|
|
62
|
+
// // confirmationNumber,
|
|
63
|
+
// orderNumber,
|
|
64
|
+
// useOnOrderStatusChanged: params.useOnOrderStatusChanged
|
|
65
|
+
// })(repos, settings);
|
|
66
|
+
// }
|
|
67
|
+
// }
|
|
68
|
+
// break;
|
|
68
69
|
case factory_1.factory.assetTransactionType.RegisterService:
|
|
69
70
|
if (typeof orderNumber === 'string' && typeof confirmationNumber === 'string') {
|
|
70
71
|
const deliverable = await (0, isDeliverable_1.isDeliverable)({
|
|
@@ -7,5 +7,5 @@ import { factory } from '../../../../factory';
|
|
|
7
7
|
*/
|
|
8
8
|
declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
9
9
|
transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf'>;
|
|
10
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
10
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").IAttributes)[];
|
|
11
11
|
export { createOnOrderCancelledTasksByTransaction };
|
package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ declare function createInformTasks(params: {
|
|
|
13
13
|
}, setting: Pick<ISetting, 'onOrderStatusChanged'> | null): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
14
14
|
declare function createNextSendOrderTasks(params: {
|
|
15
15
|
order: IInTransitOrder;
|
|
16
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
16
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").IAttributes)[];
|
|
17
17
|
export { createInformTasks, createNextSendOrderTasks, IInTransitOrder };
|
|
@@ -11,5 +11,5 @@ declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IRe
|
|
|
11
11
|
declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
12
12
|
order: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'customer' | 'price' | 'priceCurrency' | 'orderDate'>;
|
|
13
13
|
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
14
|
-
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/
|
|
14
|
+
}): (import("@chevre/factory/lib/chevre/task").ITaskAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/chevre/task/deletePerson").IAttributes | import("@chevre/factory/lib/chevre/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/chevre/task/onEventChanged").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/chevre/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/chevre/task/placeOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnOrder").IAttributes | import("@chevre/factory/lib/chevre/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/chevre/task/sendOrder").IAttributes | import("@chevre/factory/lib/chevre/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/chevre/task/useReservation").IAttributes | import("@chevre/factory/lib/chevre/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").IAttributes)[];
|
|
15
15
|
export { createInformTasks, createOnOrderReturnedTasksByTransaction, IReturnAction };
|