@chevre/domain 21.18.0-alpha.9 → 21.18.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.
- package/example/src/chevre/aggreateOwnershipInfosByOrder.ts +24 -0
- package/example/src/chevre/migratePaymentServicesToNewCollection.ts +21 -0
- package/example/src/chevre/offerCatalog2offerCatalogItem.ts +4 -0
- package/example/src/chevre/searchOffers.ts +41 -37
- package/example/src/chevre/searchOrderAcceptedOffers.ts +11 -11
- package/example/src/chevre/searchOrders.ts +11 -0
- package/example/src/chevre/searchProducts.ts +28 -0
- package/example/src/chevre/searchReservationsByOrder.ts +30 -0
- package/example/src/chevre/searchTransactions.ts +41 -0
- package/example/src/chevre/unsetUnnecessaryFields.ts +12 -6
- package/example/src/chevre/upsertMoviesByIdentifier.ts +5 -4
- package/example/src/chevre/upsertOfferCatalogsByIdentifier.ts +46 -0
- package/example/src/chevre/upsertOffersByIdentifier.ts +94 -0
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +104 -0
- package/lib/chevre/credentials.d.ts +0 -3
- package/lib/chevre/credentials.js +4 -3
- package/lib/chevre/repo/acceptedOffer.d.ts +31 -14
- package/lib/chevre/repo/acceptedOffer.js +56 -102
- package/lib/chevre/repo/creativeWork.d.ts +12 -2
- package/lib/chevre/repo/creativeWork.js +39 -25
- package/lib/chevre/repo/event.d.ts +15 -0
- package/lib/chevre/repo/event.js +66 -0
- package/lib/chevre/repo/mongoose/schemas/paymentService.d.ts +5 -0
- package/lib/chevre/repo/mongoose/schemas/paymentService.js +146 -0
- package/lib/chevre/repo/offer.d.ts +14 -5
- package/lib/chevre/repo/offer.js +94 -19
- package/lib/chevre/repo/offerCatalog.d.ts +18 -1
- package/lib/chevre/repo/offerCatalog.js +51 -39
- package/lib/chevre/repo/order.d.ts +14 -10
- package/lib/chevre/repo/order.js +20 -14
- package/lib/chevre/repo/paymentService.d.ts +62 -0
- package/lib/chevre/repo/paymentService.js +339 -0
- package/lib/chevre/repo/paymentServiceProvider.d.ts +27 -4
- package/lib/chevre/repo/paymentServiceProvider.js +85 -12
- package/lib/chevre/repo/place.js +14 -10
- package/lib/chevre/repo/product.d.ts +37 -24
- package/lib/chevre/repo/product.js +60 -150
- package/lib/chevre/repo/transaction.d.ts +5 -4
- package/lib/chevre/repository.d.ts +5 -7
- package/lib/chevre/repository.js +14 -17
- package/lib/chevre/service/aggregation/event/aggregateScreeningEvent.js +10 -1
- package/lib/chevre/service/aggregation/event/findEventOffers.js +10 -1
- package/lib/chevre/service/assetTransaction/moneyTransfer.js +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +7 -6
- package/lib/chevre/service/assetTransaction/pay.js +44 -36
- package/lib/chevre/service/assetTransaction/refund/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/refund/factory.js +0 -5
- package/lib/chevre/service/assetTransaction/refund.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/refund.js +16 -4
- package/lib/chevre/service/assetTransaction/registerService.js +18 -2
- package/lib/chevre/service/assetTransaction/reserve/factory/price.js +1 -1
- package/lib/chevre/service/assetTransaction/reserve.d.ts +6 -0
- package/lib/chevre/service/assetTransaction/reserve.js +32 -2
- package/lib/chevre/service/delivery/factory.d.ts +3 -1
- package/lib/chevre/service/delivery/factory.js +4 -2
- package/lib/chevre/service/delivery.d.ts +1 -2
- package/lib/chevre/service/delivery.js +1 -3
- package/lib/chevre/service/event.js +1 -1
- package/lib/chevre/service/moneyTransfer.js +11 -1
- package/lib/chevre/service/offer/event/authorize.d.ts +4 -0
- package/lib/chevre/service/offer/event/factory.d.ts +1 -1
- package/lib/chevre/service/offer/event/factory.js +4 -2
- package/lib/chevre/service/offer/event/processStartReserve4chevre.d.ts +4 -0
- package/lib/chevre/service/offer/event/searchEventTicketOffers.js +40 -5
- package/lib/chevre/service/offer/product/factory.js +1 -1
- package/lib/chevre/service/offer/product/searchProductOffers.js +10 -1
- package/lib/chevre/service/offer/product.d.ts +4 -15
- package/lib/chevre/service/offer/product.js +85 -57
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +0 -2
- package/lib/chevre/service/order/confirmPayTransaction.js +0 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.d.ts +3 -1
- package/lib/chevre/service/order/createAccountingReportIfNotExist.js +4 -1
- package/lib/chevre/service/order/deleteOrder.d.ts +2 -0
- package/lib/chevre/service/order/deleteOrder.js +15 -4
- package/lib/chevre/service/order/findPlaceOrderTransaction.d.ts +3 -1
- package/lib/chevre/service/order/findPlaceOrderTransaction.js +1 -2
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.d.ts +3 -0
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +13 -5
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +2 -4
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +13 -32
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +12 -12
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +17 -76
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +2 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +1 -3
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +2 -2
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +3 -3
- package/lib/chevre/service/order/payOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder.d.ts +2 -0
- package/lib/chevre/service/order/placeOrder.js +62 -14
- package/lib/chevre/service/order/returnOrder.js +28 -10
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.js +16 -4
- package/lib/chevre/service/payment/any.d.ts +5 -4
- package/lib/chevre/service/payment/any.js +1 -1
- package/lib/chevre/service/payment/creditCard.d.ts +5 -5
- package/lib/chevre/service/payment/creditCard.js +4 -4
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.d.ts +5 -3
- package/lib/chevre/service/payment/movieTicket/checkByIdentifier.js +3 -3
- package/lib/chevre/service/payment/movieTicket/getCredentials.d.ts +14 -5
- package/lib/chevre/service/payment/movieTicket/getCredentials.js +26 -9
- package/lib/chevre/service/payment/movieTicket/validation.d.ts +4 -2
- package/lib/chevre/service/payment/movieTicket.d.ts +11 -7
- package/lib/chevre/service/payment/movieTicket.js +4 -5
- package/lib/chevre/service/payment/paymentCard.js +9 -2
- package/lib/chevre/service/payment.d.ts +4 -0
- package/lib/chevre/service/reserve/searchByOrder.d.ts +21 -0
- package/lib/chevre/service/reserve/searchByOrder.js +113 -0
- package/lib/chevre/service/reserve/verifyToken4reservation.js +0 -11
- package/lib/chevre/service/reserve.d.ts +2 -1
- package/lib/chevre/service/reserve.js +3 -1
- package/lib/chevre/service/task/confirmPayTransaction.js +0 -2
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +2 -0
- package/lib/chevre/service/task/onAuthorizationCreated.js +0 -19
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +2 -0
- package/lib/chevre/service/task/onResourceUpdated/onResourceDeleted.js +3 -6
- package/lib/chevre/service/task/onResourceUpdated.js +1 -1
- package/lib/chevre/service/task/pay.js +2 -1
- package/lib/chevre/service/task/placeOrder.js +2 -0
- package/lib/chevre/service/task/refund.js +2 -1
- package/lib/chevre/service/task/returnPayTransaction.js +3 -2
- package/lib/chevre/service/task/sendOrder.js +10 -17
- package/lib/chevre/service/task/voidPayTransaction.js +2 -3
- package/lib/chevre/service/task/voidPayment.js +2 -0
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrderInProgress/potentialActions/registerService.js +0 -86
- package/lib/chevre/service/transaction/placeOrderInProgress/result.d.ts +1 -1
- package/lib/chevre/service/transaction/placeOrderInProgress/validation.d.ts +1 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnMoneyTransfer.js +3 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +1 -0
- package/lib/chevre/service/transaction/returnOrder.js +64 -58
- package/lib/chevre/settings.d.ts +2 -0
- package/lib/chevre/settings.js +3 -1
- package/package.json +3 -3
- package/example/src/chevre/transaction/findPaymentCardPermit.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.d.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.js +0 -58
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.d.ts +0 -26
- package/lib/chevre/service/transaction/orderProgramMembership/findPaymentCardPermit.js +0 -65
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import type { MongoRepository as AccountRepo } from '../../repo/account';
|
|
3
3
|
import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
4
|
-
import type { RedisRepository as RegisterServiceInProgressRepo } from '../../repo/action/registerServiceInProgress';
|
|
5
4
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
5
|
import type { MongoRepository as OfferRepo } from '../../repo/offer';
|
|
7
6
|
import type { MongoRepository as OfferCatalogRepo } from '../../repo/offerCatalog';
|
|
8
7
|
import type { RedisRepository as OrderNumberRepo } from '../../repo/orderNumber';
|
|
9
8
|
import type { MongoRepository as OwnershipInfoRepo } from '../../repo/ownershipInfo';
|
|
10
9
|
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
10
|
+
import type { MongoRepository as ProductOfferRepo } from '../../repo/productOffer';
|
|
11
11
|
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
12
12
|
import type { MongoRepository as ServiceOutputRepo } from '../../repo/serviceOutput';
|
|
13
13
|
import type { RedisRepository as ServiceOutputIdentifierRepo } from '../../repo/serviceOutputIdentifier';
|
|
@@ -22,8 +22,8 @@ export interface IAuthorizeOperationRepos {
|
|
|
22
22
|
orderNumber: OrderNumberRepo;
|
|
23
23
|
ownershipInfo: OwnershipInfoRepo;
|
|
24
24
|
product: ProductRepo;
|
|
25
|
+
productOffer: ProductOfferRepo;
|
|
25
26
|
project: ProjectRepo;
|
|
26
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
27
27
|
serviceOutput: ServiceOutputRepo;
|
|
28
28
|
serviceOutputIdentifier: ServiceOutputIdentifierRepo;
|
|
29
29
|
transaction: TransactionRepo;
|
|
@@ -63,9 +63,10 @@ export declare function search(params: {
|
|
|
63
63
|
offer: OfferRepo;
|
|
64
64
|
offerCatalog: OfferCatalogRepo;
|
|
65
65
|
product: ProductRepo;
|
|
66
|
+
productOffer: ProductOfferRepo;
|
|
66
67
|
}) => Promise<{
|
|
67
68
|
offers: factory.product.ITicketOffer[];
|
|
68
|
-
product: factory.product.IProduct
|
|
69
|
+
product: Omit<factory.product.IProduct, "offers">;
|
|
69
70
|
}>;
|
|
70
71
|
export type IAuthorizeOfferAction = factory.action.authorize.offer.product.IAction;
|
|
71
72
|
/**
|
|
@@ -94,17 +95,5 @@ export declare function authorize(params: {
|
|
|
94
95
|
export declare function voidTransaction(params: factory.task.IData<factory.taskName.VoidRegisterServiceTransaction>): (repos: {
|
|
95
96
|
action: ActionRepo;
|
|
96
97
|
assetTransaction: AssetTransactionRepo;
|
|
97
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
98
98
|
transaction: TransactionRepo;
|
|
99
99
|
}) => Promise<void>;
|
|
100
|
-
export declare function processUnlockRegisterMembershipService(params: {
|
|
101
|
-
agent: {
|
|
102
|
-
id: string;
|
|
103
|
-
};
|
|
104
|
-
product: {
|
|
105
|
-
id: string;
|
|
106
|
-
};
|
|
107
|
-
purpose: factory.action.authorize.offer.product.IPurpose;
|
|
108
|
-
}): (repos: {
|
|
109
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
110
|
-
}) => Promise<void>;
|
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
12
|
+
exports.voidTransaction = exports.authorize = exports.search = exports.ERROR_MESSAGE_ALREADY_REGISTERED = void 0;
|
|
13
13
|
const moment = require("moment");
|
|
14
14
|
const factory = require("../../factory");
|
|
15
15
|
const accountTransactionIdentifier_1 = require("../../factory/accountTransactionIdentifier");
|
|
@@ -26,7 +26,7 @@ function search(params) {
|
|
|
26
26
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
27
27
|
var _a;
|
|
28
28
|
const now = moment();
|
|
29
|
-
const searchProductsResult = yield repos.product.
|
|
29
|
+
const searchProductsResult = yield repos.product.searchProducts({
|
|
30
30
|
limit: 1,
|
|
31
31
|
page: 1,
|
|
32
32
|
project: { id: { $eq: params.project.id } },
|
|
@@ -39,14 +39,20 @@ function search(params) {
|
|
|
39
39
|
// 販売者指定の場合、検証
|
|
40
40
|
if (product.typeOf === factory.product.ProductType.MembershipService
|
|
41
41
|
|| product.typeOf === factory.product.ProductType.PaymentCard) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
42
|
+
const sellerId = (_a = params.seller) === null || _a === void 0 ? void 0 : _a.id;
|
|
43
|
+
if (typeof sellerId === 'string') {
|
|
44
|
+
// const productOffers = product.offers;
|
|
45
|
+
// if (!Array.isArray(productOffers)) {
|
|
46
|
+
// return { offers: [], product };
|
|
47
|
+
// }
|
|
48
|
+
const productOffers = yield repos.productOffer.search({
|
|
49
|
+
project: { id: { $eq: params.project.id } },
|
|
50
|
+
itemOffered: { id: { $eq: params.itemOffered.id } },
|
|
51
|
+
seller: { id: { $eq: sellerId } }
|
|
52
|
+
});
|
|
47
53
|
const hasValidOffer = productOffers.some((o) => {
|
|
48
|
-
var _a
|
|
49
|
-
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) ===
|
|
54
|
+
var _a;
|
|
55
|
+
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === sellerId
|
|
50
56
|
&& o.validFrom !== undefined
|
|
51
57
|
&& moment(o.validFrom)
|
|
52
58
|
.isSameOrBefore(now)
|
|
@@ -111,7 +117,7 @@ function authorize(params) {
|
|
|
111
117
|
availableOffers,
|
|
112
118
|
seller: transaction.seller,
|
|
113
119
|
orderNumber
|
|
114
|
-
})();
|
|
120
|
+
})(repos);
|
|
115
121
|
acceptedOffer = yield createServiceOutputIdentifier({ acceptedOffer, product })(repos);
|
|
116
122
|
let requestBody;
|
|
117
123
|
let responseBody;
|
|
@@ -129,11 +135,12 @@ function authorize(params) {
|
|
|
129
135
|
try {
|
|
130
136
|
// 会員の場合のみ排他ロック
|
|
131
137
|
if (params.agent.typeOf === factory.personType.Person) {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
138
|
+
// 廃止(2023-12-07~)
|
|
139
|
+
// await processLockRegisterMembershipService({
|
|
140
|
+
// agent: params.agent,
|
|
141
|
+
// product: product,
|
|
142
|
+
// purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
143
|
+
// })(repos);
|
|
137
144
|
}
|
|
138
145
|
// サービス登録開始
|
|
139
146
|
const startParams = (0, factory_1.createRegisterServiceStartParams)({
|
|
@@ -155,11 +162,12 @@ function authorize(params) {
|
|
|
155
162
|
// no op
|
|
156
163
|
}
|
|
157
164
|
try {
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
}
|
|
165
|
+
// 廃止(2023-12-07~)
|
|
166
|
+
// await processUnlockRegisterMembershipService({
|
|
167
|
+
// agent: params.agent,
|
|
168
|
+
// product: { id: String(product.id) },
|
|
169
|
+
// purpose: { typeOf: transaction.typeOf, id: transaction.id }
|
|
170
|
+
// })(repos);
|
|
163
171
|
}
|
|
164
172
|
catch (error) {
|
|
165
173
|
// 失敗したら仕方ない
|
|
@@ -176,7 +184,7 @@ function fixProductAndOffers(params) {
|
|
|
176
184
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
177
185
|
var _a, _b, _c;
|
|
178
186
|
const productId = String((_b = (_a = params.object[0]) === null || _a === void 0 ? void 0 : _a.itemOffered) === null || _b === void 0 ? void 0 : _b.id);
|
|
179
|
-
const searchProductsResult = yield repos.product.
|
|
187
|
+
const searchProductsResult = yield repos.product.searchProducts({
|
|
180
188
|
limit: 1,
|
|
181
189
|
page: 1,
|
|
182
190
|
project: { id: { $eq: params.project.id } },
|
|
@@ -233,11 +241,12 @@ function voidTransaction(params) {
|
|
|
233
241
|
var _b, _c;
|
|
234
242
|
const productId = (_c = (_b = action.object[0]) === null || _b === void 0 ? void 0 : _b.itemOffered) === null || _c === void 0 ? void 0 : _c.id;
|
|
235
243
|
if (typeof productId === 'string') {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
244
|
+
// 廃止(2023-12-07~)
|
|
245
|
+
// await processUnlockRegisterMembershipService({
|
|
246
|
+
// agent: { id: transaction.agent.id },
|
|
247
|
+
// product: { id: productId },
|
|
248
|
+
// purpose: params.purpose
|
|
249
|
+
// })(repos);
|
|
241
250
|
}
|
|
242
251
|
yield repos.action.cancel({ typeOf: action.typeOf, id: action.id });
|
|
243
252
|
yield processVoidRegisterServiceTransaction({
|
|
@@ -275,7 +284,7 @@ function processVoidRegisterServiceTransaction(params) {
|
|
|
275
284
|
* 受け入れらたオファーの内容を検証
|
|
276
285
|
*/
|
|
277
286
|
function validateAcceptedOffers(params) {
|
|
278
|
-
return () => __awaiter(this, void 0, void 0, function* () {
|
|
287
|
+
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
279
288
|
let acceptedOfferWithoutDetail = params.object;
|
|
280
289
|
if (!Array.isArray(acceptedOfferWithoutDetail)) {
|
|
281
290
|
acceptedOfferWithoutDetail = [acceptedOfferWithoutDetail];
|
|
@@ -290,10 +299,15 @@ function validateAcceptedOffers(params) {
|
|
|
290
299
|
typeOf: params.seller.typeOf
|
|
291
300
|
};
|
|
292
301
|
// 販売者を検証
|
|
293
|
-
const productOffers = params.product.offers;
|
|
294
|
-
if (!Array.isArray(productOffers)) {
|
|
295
|
-
|
|
296
|
-
}
|
|
302
|
+
// const productOffers = params.product.offers;
|
|
303
|
+
// if (!Array.isArray(productOffers)) {
|
|
304
|
+
// throw new factory.errors.Argument('Product', 'Product offers undefined');
|
|
305
|
+
// }
|
|
306
|
+
const productOffers = yield repos.productOffer.search({
|
|
307
|
+
project: { id: { $eq: params.product.project.id } },
|
|
308
|
+
itemOffered: { id: { $eq: String(params.product.id) } },
|
|
309
|
+
seller: { id: { $eq: params.seller.id } }
|
|
310
|
+
});
|
|
297
311
|
const hasValidOffer = productOffers.some((o) => {
|
|
298
312
|
var _a;
|
|
299
313
|
return ((_a = o.seller) === null || _a === void 0 ? void 0 : _a.id) === params.seller.id;
|
|
@@ -382,29 +396,43 @@ function createServiceOutputIdentifier(params) {
|
|
|
382
396
|
})));
|
|
383
397
|
});
|
|
384
398
|
}
|
|
385
|
-
function processLockRegisterMembershipService(params
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
399
|
+
// function processLockRegisterMembershipService(params: {
|
|
400
|
+
// agent: { id: string };
|
|
401
|
+
// product: factory.product.IProduct;
|
|
402
|
+
// purpose: factory.action.authorize.offer.product.IPurpose;
|
|
403
|
+
// }) {
|
|
404
|
+
// return async (repos: {
|
|
405
|
+
// registerActionInProgress: RegisterServiceInProgressRepo;
|
|
406
|
+
// }) => {
|
|
407
|
+
// if (params.product.typeOf === factory.product.ProductType.MembershipService) {
|
|
408
|
+
// await repos.registerActionInProgress.lock(
|
|
409
|
+
// {
|
|
410
|
+
// agent: { id: params.agent.id },
|
|
411
|
+
// product: { id: String(params.product.id) }
|
|
412
|
+
// },
|
|
413
|
+
// params.purpose.id
|
|
414
|
+
// );
|
|
415
|
+
// }
|
|
416
|
+
// };
|
|
417
|
+
// }
|
|
418
|
+
// export function processUnlockRegisterMembershipService(params: {
|
|
419
|
+
// agent: { id: string };
|
|
420
|
+
// product: { id: string };
|
|
421
|
+
// purpose: factory.action.authorize.offer.product.IPurpose;
|
|
422
|
+
// }) {
|
|
423
|
+
// return async (repos: {
|
|
424
|
+
// registerActionInProgress: RegisterServiceInProgressRepo;
|
|
425
|
+
// }) => {
|
|
426
|
+
// // 登録ロックIDが取引IDであればロック解除
|
|
427
|
+
// const holder = await repos.registerActionInProgress.getHolder({
|
|
428
|
+
// agent: { id: params.agent.id },
|
|
429
|
+
// product: { id: params.product.id }
|
|
430
|
+
// });
|
|
431
|
+
// if (holder === params.purpose.id) {
|
|
432
|
+
// await repos.registerActionInProgress.unlock({
|
|
433
|
+
// agent: { id: params.agent.id },
|
|
434
|
+
// product: { id: params.product.id }
|
|
435
|
+
// });
|
|
436
|
+
// }
|
|
437
|
+
// };
|
|
438
|
+
// }
|
|
@@ -5,7 +5,6 @@ import type { MongoRepository as ActionRepo } from '../../repo/action';
|
|
|
5
5
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
6
6
|
import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
7
7
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
8
|
-
import type { MongoRepository as ProductRepo } from '../../repo/product';
|
|
9
8
|
import type { MongoRepository as ProjectRepo } from '../../repo/project';
|
|
10
9
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
11
10
|
import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
@@ -16,7 +15,6 @@ declare function confirmPayTransaction(data: factory.task.IData<factory.taskName
|
|
|
16
15
|
order: OrderRepo;
|
|
17
16
|
accountingReport: AccountingReportRepo;
|
|
18
17
|
event: EventRepo;
|
|
19
|
-
product: ProductRepo;
|
|
20
18
|
project: ProjectRepo;
|
|
21
19
|
task: TaskRepo;
|
|
22
20
|
transaction: TransactionRepo;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
|
-
export declare function createAccountingReportIfNotExist(params: factory.order.IOrder
|
|
3
|
+
export declare function createAccountingReportIfNotExist(params: factory.order.IOrder & {
|
|
4
|
+
acceptedOffers: factory.order.IAcceptedOffer<factory.order.IItemOffered>[];
|
|
5
|
+
}): (repos: {
|
|
4
6
|
accountingReport: AccountingReportRepo;
|
|
5
7
|
}) => Promise<void>;
|
|
@@ -28,7 +28,10 @@ exports.createAccountingReportIfNotExist = createAccountingReportIfNotExist;
|
|
|
28
28
|
// 最適化(2023-06-30~)
|
|
29
29
|
function createOrder4report(params) {
|
|
30
30
|
var _a;
|
|
31
|
-
|
|
31
|
+
if (!Array.isArray(params.acceptedOffers)) {
|
|
32
|
+
throw new factory.errors.ArgumentNull('order.acceptedOffers');
|
|
33
|
+
}
|
|
34
|
+
const numItems = params.acceptedOffers.length;
|
|
32
35
|
// 必要な属性についてDate型に変換(でないと検索クエリを効率的に使えない)
|
|
33
36
|
const acceptedOffers = (Array.isArray(params.acceptedOffers))
|
|
34
37
|
? params.acceptedOffers.map((o) => {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { MongoRepository as AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
1
2
|
import type { MongoRepository as AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
3
|
import type { MongoRepository as EventRepo } from '../../repo/event';
|
|
3
4
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
@@ -11,6 +12,7 @@ import * as factory from '../../factory';
|
|
|
11
12
|
declare function deleteOrder(params: {
|
|
12
13
|
object: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'confirmationNumber' | 'orderDate' | 'orderNumber'>;
|
|
13
14
|
}): (repos: {
|
|
15
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
14
16
|
accountingReport: AccountingReportRepo;
|
|
15
17
|
event: EventRepo;
|
|
16
18
|
order: OrderRepo;
|
|
@@ -21,7 +21,7 @@ function deleteOrder(params) {
|
|
|
21
21
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const orders = yield repos.order.search({
|
|
23
23
|
orderNumbers: [params.object.orderNumber]
|
|
24
|
-
});
|
|
24
|
+
}, { orderDate: 1, project: 1, customer: 1, orderNumber: 1, seller: 1 });
|
|
25
25
|
const order = orders.shift();
|
|
26
26
|
if (order === undefined) {
|
|
27
27
|
// すでに削除済
|
|
@@ -50,7 +50,10 @@ function deleteOrder(params) {
|
|
|
50
50
|
exports.deleteOrder = deleteOrder;
|
|
51
51
|
function deleteReservationsByOrder(order) {
|
|
52
52
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
const acceptedOffers =
|
|
53
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
54
|
+
orderNumber: { $eq: order.orderNumber },
|
|
55
|
+
project: { id: { $eq: order.project.id } }
|
|
56
|
+
});
|
|
54
57
|
const reservationIds = acceptedOffers.filter((o) => {
|
|
55
58
|
return o.itemOffered.typeOf === factory.reservationType.EventReservation;
|
|
56
59
|
})
|
|
@@ -66,7 +69,12 @@ function deleteOwnershipInfosByOrder(order) {
|
|
|
66
69
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
67
70
|
const now = new Date();
|
|
68
71
|
// 所有権作成
|
|
69
|
-
const ownershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
|
|
72
|
+
const ownershipInfos = (0, factory_1.createOwnershipInfosFromOrder)({
|
|
73
|
+
order: Object.assign(Object.assign({}, order), { acceptedOffers: yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
74
|
+
orderNumber: { $eq: order.orderNumber },
|
|
75
|
+
project: { id: { $eq: order.project.id } }
|
|
76
|
+
}) })
|
|
77
|
+
});
|
|
70
78
|
const ownershipIdentifiers = ownershipInfos.map((o) => String(o.identifier));
|
|
71
79
|
if (ownershipIdentifiers.length > 0) {
|
|
72
80
|
yield repos.ownershipInfo.deleteExpiredByIdentifiers({
|
|
@@ -81,7 +89,10 @@ function deleteOwnershipInfosByOrder(order) {
|
|
|
81
89
|
function deleteEventsByOrder(order) {
|
|
82
90
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
83
91
|
const now = new Date();
|
|
84
|
-
const acceptedOffers =
|
|
92
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
93
|
+
orderNumber: { $eq: order.orderNumber },
|
|
94
|
+
project: { id: { $eq: order.project.id } }
|
|
95
|
+
});
|
|
85
96
|
const reservationForIds = acceptedOffers.filter((o) => {
|
|
86
97
|
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
87
98
|
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
|
+
type ITransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'potentialActions' | 'project' | 'typeOf'>;
|
|
3
4
|
export declare function findPlaceOrderTransaction(params: {
|
|
4
5
|
project: {
|
|
5
6
|
id: string;
|
|
@@ -8,4 +9,5 @@ export declare function findPlaceOrderTransaction(params: {
|
|
|
8
9
|
orderNumber: string;
|
|
9
10
|
}): (repos: {
|
|
10
11
|
transaction: TransactionRepo;
|
|
11
|
-
}) => Promise<
|
|
12
|
+
}) => Promise<ITransaction>;
|
|
13
|
+
export {};
|
|
@@ -13,7 +13,6 @@ exports.findPlaceOrderTransaction = void 0;
|
|
|
13
13
|
const factory = require("../../factory");
|
|
14
14
|
function findPlaceOrderTransaction(params) {
|
|
15
15
|
return (repos) => __awaiter(this, void 0, void 0, function* () {
|
|
16
|
-
// 注文取引検索
|
|
17
16
|
const placeOrderTransactions = yield repos.transaction.search({
|
|
18
17
|
limit: 1,
|
|
19
18
|
page: 1,
|
|
@@ -26,7 +25,7 @@ function findPlaceOrderTransaction(params) {
|
|
|
26
25
|
orderNumbers: [params.orderNumber]
|
|
27
26
|
}
|
|
28
27
|
},
|
|
29
|
-
inclusion: [],
|
|
28
|
+
inclusion: ['id', 'potentialActions', 'project', 'typeOf'],
|
|
30
29
|
exclusion: []
|
|
31
30
|
});
|
|
32
31
|
const placeOrderTransaction = placeOrderTransactions.shift();
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import type { MongoRepository as AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
1
2
|
import type { MongoRepository as AssetTransactionRepo } from '../../repo/assetTransaction';
|
|
2
3
|
import type { MongoRepository as OrderRepo } from '../../repo/order';
|
|
3
4
|
import type { MongoRepository as TaskRepo } from '../../repo/task';
|
|
4
5
|
import type { MongoRepository as TransactionRepo } from '../../repo/transaction';
|
|
5
6
|
import * as factory from '../../factory';
|
|
6
7
|
declare function onAssetTransactionStatusChanged(params: factory.task.IData<factory.taskName.OnAssetTransactionStatusChanged>): (repos: {
|
|
8
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
7
9
|
assetTransaction: AssetTransactionRepo;
|
|
8
10
|
order: OrderRepo;
|
|
9
11
|
task: TaskRepo;
|
|
@@ -17,6 +19,7 @@ declare function paymentDue2Processing(params: {
|
|
|
17
19
|
orderNumber: string;
|
|
18
20
|
useOnOrderStatusChanged: boolean;
|
|
19
21
|
}): (repos: {
|
|
22
|
+
acceptedOffer: AcceptedOfferRepo;
|
|
20
23
|
order: OrderRepo;
|
|
21
24
|
task: TaskRepo;
|
|
22
25
|
transaction: TransactionRepo;
|
|
@@ -138,7 +138,7 @@ function paymentDue2Processing(params) {
|
|
|
138
138
|
orderNumber: params.orderNumber,
|
|
139
139
|
project: { id: params.project.id },
|
|
140
140
|
inclusion: [],
|
|
141
|
-
exclusion: []
|
|
141
|
+
exclusion: ['acceptedOffers']
|
|
142
142
|
});
|
|
143
143
|
try {
|
|
144
144
|
order = yield repos.order.changeStatus({
|
|
@@ -155,7 +155,7 @@ function paymentDue2Processing(params) {
|
|
|
155
155
|
orderNumber: params.orderNumber,
|
|
156
156
|
project: { id: params.project.id },
|
|
157
157
|
inclusion: [],
|
|
158
|
-
exclusion: []
|
|
158
|
+
exclusion: ['acceptedOffers']
|
|
159
159
|
});
|
|
160
160
|
if (order.orderStatus === factory.orderStatus.OrderDelivered
|
|
161
161
|
|| order.orderStatus === factory.orderStatus.OrderReturned) {
|
|
@@ -166,8 +166,13 @@ function paymentDue2Processing(params) {
|
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
if (params.useOnOrderStatusChanged) {
|
|
169
|
+
// 全acceptedOffersを検索(2023-12-08~)
|
|
170
|
+
const acceptedOffers = yield repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
171
|
+
orderNumber: { $eq: order.orderNumber },
|
|
172
|
+
project: { id: { $eq: params.project.id } }
|
|
173
|
+
});
|
|
169
174
|
yield (0, onOrderStatusChanged_1.onOrderProcessing)({
|
|
170
|
-
order: Object.assign(Object.assign({}, order), { orderStatus: factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
175
|
+
order: Object.assign(Object.assign({}, order), { acceptedOffers, orderStatus: factory.orderStatus.OrderProcessing // 強制的にOrderProcessingとして処理する
|
|
171
176
|
}),
|
|
172
177
|
placeOrderTransaction
|
|
173
178
|
})({
|
|
@@ -212,8 +217,11 @@ function cancelOrderIfExist(params) {
|
|
|
212
217
|
}
|
|
213
218
|
if (params.useOnOrderStatusChanged) {
|
|
214
219
|
yield (0, onOrderStatusChanged_1.onOrderCancelled)({
|
|
215
|
-
order:
|
|
216
|
-
|
|
220
|
+
order: {
|
|
221
|
+
orderDate: order.orderDate,
|
|
222
|
+
orderNumber: order.orderNumber,
|
|
223
|
+
orderStatus: factory.orderStatus.OrderCancelled // 強制的にOrderCancelledとして処理する
|
|
224
|
+
},
|
|
217
225
|
placeOrderTransaction
|
|
218
226
|
})({
|
|
219
227
|
task: repos.task
|
|
@@ -6,6 +6,6 @@ import * as factory from '../../../../factory';
|
|
|
6
6
|
* 注文中止時のアクション
|
|
7
7
|
*/
|
|
8
8
|
declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
9
|
-
transaction?: factory.transaction.placeOrder.ITransaction
|
|
9
|
+
transaction?: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf'>;
|
|
10
10
|
}): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createEvent").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnMoneyTransfer").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/syncScreeningRooms").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidMoneyTransferTransaction").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
|
|
11
11
|
export { createOnOrderCancelledTasksByTransaction };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
|
-
type IPlaceOrderTransaction = factory.transaction.ITransaction
|
|
3
|
+
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf'>;
|
|
4
4
|
declare function onOrderCancelled(params: {
|
|
5
|
-
order: factory.order.IOrder
|
|
5
|
+
order: Pick<factory.order.IOrder, 'orderNumber' | 'orderDate' | 'orderStatus'>;
|
|
6
6
|
placeOrderTransaction?: IPlaceOrderTransaction;
|
|
7
7
|
}): (repos: {
|
|
8
8
|
task: TaskRepo;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as factory from '../../../../factory';
|
|
2
|
-
type IDeliveredOrder = factory.order.IOrder & {
|
|
2
|
+
type IDeliveredOrder = Pick<factory.order.IOrder, 'id' | 'customer' | 'orderNumber' | 'project' | 'typeOf'> & {
|
|
3
3
|
orderStatus: factory.orderStatus.OrderDelivered;
|
|
4
4
|
};
|
|
5
5
|
declare function createInformTasks(order: IDeliveredOrder): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
import type { RedisRepository as RegisterServiceInProgressRepo } from '../../../repo/action/registerServiceInProgress';
|
|
2
1
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
3
2
|
import * as factory from '../../../factory';
|
|
4
|
-
type IPlaceOrderTransaction = factory.transaction.ITransaction
|
|
3
|
+
type IPlaceOrderTransaction = Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf' | 'potentialActions'>;
|
|
5
4
|
declare function onOrderDelivered(params: {
|
|
6
|
-
order:
|
|
5
|
+
order: Pick<factory.order.IOrder, 'id' | 'customer' | 'orderDate' | 'orderNumber' | 'project' | 'typeOf'> & {
|
|
7
6
|
orderStatus: factory.orderStatus.OrderDelivered;
|
|
8
7
|
};
|
|
9
8
|
placeOrderTransaction?: IPlaceOrderTransaction;
|
|
10
9
|
}): (repos: {
|
|
11
|
-
registerActionInProgress: RegisterServiceInProgressRepo;
|
|
12
10
|
task: TaskRepo;
|
|
13
11
|
}) => Promise<void>;
|
|
14
12
|
export { onOrderDelivered };
|
|
@@ -15,7 +15,6 @@ exports.onOrderDelivered = void 0;
|
|
|
15
15
|
*/
|
|
16
16
|
const createDebug = require("debug");
|
|
17
17
|
const factory = require("../../../factory");
|
|
18
|
-
const product_1 = require("../../offer/product");
|
|
19
18
|
const factory_1 = require("./onOrderDelivered/factory");
|
|
20
19
|
const debug = createDebug('chevre-domain:service:order');
|
|
21
20
|
function onOrderDelivered(params) {
|
|
@@ -23,20 +22,6 @@ function onOrderDelivered(params) {
|
|
|
23
22
|
var _a, _b, _c, _d, _e;
|
|
24
23
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
25
24
|
let tasks = [];
|
|
26
|
-
// const maskedCustomer = createMaskedCustomer(params.order, { noProfile: true });
|
|
27
|
-
// const simpleOrder: factory.order.ISimpleOrder = {
|
|
28
|
-
// typeOf: params.order.typeOf,
|
|
29
|
-
// seller: {
|
|
30
|
-
// id: params.order.seller.id,
|
|
31
|
-
// typeOf: params.order.seller.typeOf,
|
|
32
|
-
// name: params.order.seller.name
|
|
33
|
-
// },
|
|
34
|
-
// customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id },
|
|
35
|
-
// orderNumber: params.order.orderNumber,
|
|
36
|
-
// price: params.order.price,
|
|
37
|
-
// priceCurrency: params.order.priceCurrency,
|
|
38
|
-
// orderDate: params.order.orderDate
|
|
39
|
-
// };
|
|
40
25
|
switch (params.order.orderStatus) {
|
|
41
26
|
case factory.orderStatus.OrderDelivered:
|
|
42
27
|
tasks = [
|
|
@@ -50,24 +35,20 @@ function onOrderDelivered(params) {
|
|
|
50
35
|
try {
|
|
51
36
|
const placeOrderTransaction = params.placeOrderTransaction;
|
|
52
37
|
if (typeof (placeOrderTransaction === null || placeOrderTransaction === void 0 ? void 0 : placeOrderTransaction.id) === 'string') {
|
|
38
|
+
// 廃止(2023-12-07~)
|
|
53
39
|
// プロダクト登録プロセスロック解除(orderからproductIdを抽出する)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
product: { id: productId },
|
|
67
|
-
purpose: { typeOf: placeOrderTransaction.typeOf, id: placeOrderTransaction.id }
|
|
68
|
-
})(repos);
|
|
69
|
-
})));
|
|
70
|
-
}
|
|
40
|
+
// const productIds4unlock = params.order.acceptedOffers
|
|
41
|
+
// .filter((o) => o.itemOffered.typeOf === factory.permit.PermitType.Permit
|
|
42
|
+
// && typeof o.itemOffered.issuedThrough?.id === 'string'
|
|
43
|
+
// && o.itemOffered.issuedThrough.id.length > 0)
|
|
44
|
+
// .map((o) => String((<factory.order.IPermit>o.itemOffered).issuedThrough?.id));
|
|
45
|
+
// await Promise.all(productIds4unlock.map(async (productId) => {
|
|
46
|
+
// await processUnlockRegisterMembershipService({
|
|
47
|
+
// agent: { id: String(params.order.customer.id) },
|
|
48
|
+
// product: { id: productId },
|
|
49
|
+
// purpose: { typeOf: placeOrderTransaction.typeOf, id: placeOrderTransaction.id }
|
|
50
|
+
// })(repos);
|
|
51
|
+
// }));
|
|
71
52
|
}
|
|
72
53
|
}
|
|
73
54
|
catch (error) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { MongoRepository as TaskRepo } from '../../../repo/task';
|
|
2
2
|
import * as factory from '../../../factory';
|
|
3
3
|
declare function onOrderPaymentDue(params: {
|
|
4
|
-
order:
|
|
4
|
+
order: Pick<factory.order.IOrder, 'paymentMethods' | 'project' | 'orderNumber' | 'confirmationNumber' | 'customer' | 'orderDate' | 'seller' | 'typeOf' | 'price' | 'priceCurrency'> & {
|
|
5
5
|
orderStatus: factory.orderStatus.OrderPaymentDue;
|
|
6
6
|
};
|
|
7
7
|
}): (repos: {
|