@chevre/domain 21.18.0-alpha.2 → 21.18.0-alpha.20
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/searchAcceptedOfferIds.ts +57 -0
- package/example/src/chevre/searchOrderAcceptedOffers.ts +12 -12
- package/example/src/chevre/searchOrders.ts +36 -19
- package/example/src/chevre/searchReservationsByOrder.ts +30 -0
- package/example/src/chevre/searchTransactions.ts +41 -0
- package/example/src/chevre/transaction/processReturnOrder.ts +1 -0
- package/example/src/chevre/upsertMoviesByIdentifier.ts +57 -0
- package/example/src/chevre/upsertScreeningEventSeriesByVersion.ts +141 -0
- package/example/src/duration.ts +22 -0
- package/lib/chevre/repo/acceptedOffer.d.ts +60 -0
- package/lib/chevre/repo/acceptedOffer.js +158 -0
- package/lib/chevre/repo/creativeWork.d.ts +5 -1
- package/lib/chevre/repo/creativeWork.js +42 -22
- package/lib/chevre/repo/event.d.ts +12 -0
- package/lib/chevre/repo/event.js +61 -0
- package/lib/chevre/repo/offerCatalog.d.ts +8 -2
- package/lib/chevre/repo/offerCatalog.js +8 -8
- package/lib/chevre/repo/order.d.ts +14 -54
- package/lib/chevre/repo/order.js +46 -180
- package/lib/chevre/repo/place.js +14 -10
- 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/assetTransaction/pay/potentialActions.d.ts +3 -1
- package/lib/chevre/service/assetTransaction/pay/potentialActions.js +3 -3
- package/lib/chevre/service/assetTransaction/pay.d.ts +2 -0
- package/lib/chevre/service/assetTransaction/pay.js +10 -6
- 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/offer/product.d.ts +0 -14
- package/lib/chevre/service/offer/product.js +59 -42
- package/lib/chevre/service/order/confirmPayTransaction.d.ts +2 -0
- package/lib/chevre/service/order/confirmPayTransaction.js +1 -0
- 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 -3
- package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +15 -9
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +11 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.js +54 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled.js +38 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered/factory.js +111 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.d.ts +12 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderDelivered.js +64 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +103 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.d.ts +30 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing/factory.js +227 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +216 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +10 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +110 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.d.ts +14 -0
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned.js +164 -0
- package/lib/chevre/service/order/onOrderStatusChanged.d.ts +9 -15
- package/lib/chevre/service/order/onOrderStatusChanged.js +11 -446
- package/lib/chevre/service/order/onOrderUpdated/factory.d.ts +6 -0
- package/lib/chevre/service/order/onOrderUpdated/factory.js +45 -0
- package/lib/chevre/service/order/onOrderUpdated.js +1 -1
- package/lib/chevre/service/order/payOrder.d.ts +2 -2
- package/lib/chevre/service/order/placeOrder.d.ts +2 -3
- package/lib/chevre/service/order/placeOrder.js +65 -22
- package/lib/chevre/service/order/returnOrder.d.ts +2 -2
- package/lib/chevre/service/order/returnOrder.js +34 -13
- package/lib/chevre/service/order/sendOrder.d.ts +2 -2
- package/lib/chevre/service/order/sendOrder.js +19 -6
- package/lib/chevre/service/order.d.ts +2 -2
- package/lib/chevre/service/order.js +2 -2
- package/lib/chevre/service/payment/any.js +1 -1
- 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 +2 -1
- package/lib/chevre/service/task/deleteTransaction.js +2 -0
- package/lib/chevre/service/task/onAssetTransactionStatusChanged.js +5 -6
- package/lib/chevre/service/task/onAuthorizationCreated.js +9 -18
- package/lib/chevre/service/task/onOrderPaymentCompleted.js +5 -6
- package/lib/chevre/service/task/placeOrder.js +10 -17
- package/lib/chevre/service/task/returnOrder.js +10 -17
- package/lib/chevre/service/task/sendOrder.js +10 -17
- package/lib/chevre/service/task/voidRegisterServiceTransaction.js +3 -7
- package/lib/chevre/service/transaction/deleteTransaction.d.ts +2 -0
- package/lib/chevre/service/transaction/moneyTransfer.js +3 -4
- 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 +3 -0
- package/lib/chevre/service/transaction/returnOrder.js +73 -55
- package/package.json +2 -2
- package/lib/chevre/repo/action/registerServiceInProgress.d.ts +0 -29
- package/lib/chevre/repo/action/registerServiceInProgress.js +0 -58
- package/lib/chevre/service/order/onOrderStatusChanged/factory.d.ts +0 -42
- package/lib/chevre/service/order/onOrderStatusChanged/factory.js +0 -467
|
@@ -1,58 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.RedisRepository = void 0;
|
|
13
|
-
/**
|
|
14
|
-
* 進行中サービス登録アクションリポジトリ
|
|
15
|
-
*/
|
|
16
|
-
class RedisRepository {
|
|
17
|
-
constructor(redisClient) {
|
|
18
|
-
this.redisClient = redisClient;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* ロックする
|
|
22
|
-
*/
|
|
23
|
-
lock(progressKey, holder) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
26
|
-
const ttl = 7200;
|
|
27
|
-
const [setNXReply] = yield this.redisClient.multi()
|
|
28
|
-
.setNX(key, holder)
|
|
29
|
-
.expire(key, ttl)
|
|
30
|
-
.exec();
|
|
31
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
32
|
-
/* istanbul ignore else: please write tests */
|
|
33
|
-
if (setNXReply === 1 || setNXReply === true) {
|
|
34
|
-
return true;
|
|
35
|
-
}
|
|
36
|
-
else {
|
|
37
|
-
throw new Error('Already in progress.');
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* メンバーシップ登録進行ロックを解除する
|
|
43
|
-
*/
|
|
44
|
-
unlock(progressKey) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
-
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
47
|
-
yield this.redisClient.del([key]);
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
getHolder(progressKey) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
-
const key = `${RedisRepository.KEY_PREFIX}:${progressKey.agent.id}:${progressKey.product.id}`;
|
|
53
|
-
return this.redisClient.get(key);
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
RedisRepository.KEY_PREFIX = 'cinerino:registerProgramMembershipActionInProgress';
|
|
58
|
-
exports.RedisRepository = RedisRepository;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import * as factory from '../../../factory';
|
|
2
|
-
type IOrderWithToken = factory.order.IOrder & {
|
|
3
|
-
token: string;
|
|
4
|
-
};
|
|
5
|
-
export declare function getOrderWithToken(params: {
|
|
6
|
-
order: factory.order.IOrder;
|
|
7
|
-
expiresIn: number;
|
|
8
|
-
}): Promise<factory.order.IOrder | IOrderWithToken>;
|
|
9
|
-
export type IUpdatedOrder4inform = Pick<factory.order.IOrder, 'typeOf' | 'orderNumber' | 'name' | 'additionalProperty' | 'project'> & {
|
|
10
|
-
orderStatus?: undefined;
|
|
11
|
-
updatedAt: Date;
|
|
12
|
-
};
|
|
13
|
-
export declare function createInformTasks(order: factory.order.IOrder | IOrderWithToken | IUpdatedOrder4inform): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
|
|
14
|
-
export declare function createConfirmReservationActionObject4ChevreByOrder(params: {
|
|
15
|
-
order: factory.order.IOrder;
|
|
16
|
-
}): factory.action.interact.confirm.reservation.IObject<factory.service.webAPI.Identifier.Chevre>[];
|
|
17
|
-
export declare function createConfirmReservationActionObject4COAByOrder(params: {
|
|
18
|
-
order: factory.order.IOrder;
|
|
19
|
-
}): factory.action.interact.confirm.reservation.IObject<factory.service.webAPI.Identifier.COA>[];
|
|
20
|
-
export declare function createConfirmRegisterServiceActionObjectByOrder(params: {
|
|
21
|
-
order: factory.order.IOrder;
|
|
22
|
-
}): factory.action.interact.confirm.registerService.IObject[];
|
|
23
|
-
export type IExternalOrder = Pick<factory.order.IOrder, 'project' | 'typeOf' | 'seller' | 'customer' | 'confirmationNumber' | 'orderNumber' | 'price' | 'priceCurrency' | 'orderDate' | 'name' | 'orderStatus' | 'orderedItem' | 'paymentMethods'>;
|
|
24
|
-
/**
|
|
25
|
-
* 注文配送後のアクション
|
|
26
|
-
*/
|
|
27
|
-
export declare function createOnOrderSentTasksByTransaction(params: {
|
|
28
|
-
potentialActions?: factory.action.transfer.send.order.IPotentialActions;
|
|
29
|
-
}): (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)[];
|
|
30
|
-
/**
|
|
31
|
-
* 注文返品後のアクション
|
|
32
|
-
*/
|
|
33
|
-
export declare function createOnOrderReturnedTasksByTransaction(params: {
|
|
34
|
-
potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
|
|
35
|
-
}): (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)[];
|
|
36
|
-
/**
|
|
37
|
-
* 注文中止時のアクション
|
|
38
|
-
*/
|
|
39
|
-
export declare function createOnOrderCancelledTasksByTransaction(params: {
|
|
40
|
-
transaction?: factory.transaction.placeOrder.ITransaction;
|
|
41
|
-
}): (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)[];
|
|
42
|
-
export {};
|
|
@@ -1,467 +0,0 @@
|
|
|
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
|
-
var _a;
|
|
12
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
-
exports.createOnOrderCancelledTasksByTransaction = exports.createOnOrderReturnedTasksByTransaction = exports.createOnOrderSentTasksByTransaction = exports.createConfirmRegisterServiceActionObjectByOrder = exports.createConfirmReservationActionObject4COAByOrder = exports.createConfirmReservationActionObject4ChevreByOrder = exports.createInformTasks = exports.getOrderWithToken = void 0;
|
|
14
|
-
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
15
|
-
const jwt = require("jsonwebtoken");
|
|
16
|
-
const util_1 = require("util");
|
|
17
|
-
const credentials_1 = require("../../../credentials");
|
|
18
|
-
const factory = require("../../../factory");
|
|
19
|
-
const order_1 = require("../../../factory/order");
|
|
20
|
-
const reservedAgentIdentifireNames_1 = require("../../../factory/reservedAgentIdentifireNames");
|
|
21
|
-
const settings_1 = require("../../../settings");
|
|
22
|
-
const informOrder = (_a = settings_1.settings.onOrderStatusChanged) === null || _a === void 0 ? void 0 : _a.informOrder;
|
|
23
|
-
function getOrderWithToken(params) {
|
|
24
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
if (typeof credentials_1.credentials.hub.clientId !== 'string') {
|
|
26
|
-
return params.order;
|
|
27
|
-
}
|
|
28
|
-
// 最適化(2023-01-31~)
|
|
29
|
-
const order4token = {
|
|
30
|
-
typeOf: params.order.typeOf,
|
|
31
|
-
orderNumber: params.order.orderNumber
|
|
32
|
-
};
|
|
33
|
-
const token = yield new Promise((resolve, reject) => {
|
|
34
|
-
// 所有権を暗号化する
|
|
35
|
-
jwt.sign(order4token, credentials_1.credentials.jwt.secret, {
|
|
36
|
-
audience: [credentials_1.credentials.hub.clientId],
|
|
37
|
-
issuer: credentials_1.credentials.jwt.issuer,
|
|
38
|
-
expiresIn: params.expiresIn
|
|
39
|
-
}, (err, encoded) => {
|
|
40
|
-
if (err instanceof Error) {
|
|
41
|
-
reject(err);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
if (typeof encoded !== 'string') {
|
|
45
|
-
reject(new factory.errors.ServiceUnavailable('order cannot be signed unexpectedly'));
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
resolve(encoded);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
return Object.assign(Object.assign({}, params.order), {
|
|
54
|
-
// 注文トークンを情報付加
|
|
55
|
-
token });
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
exports.getOrderWithToken = getOrderWithToken;
|
|
59
|
-
const ASTERISK_CHARACTER = '*';
|
|
60
|
-
function createInformTasks(order) {
|
|
61
|
-
var _a;
|
|
62
|
-
const taskRunsAt = new Date();
|
|
63
|
-
let informTasks = [];
|
|
64
|
-
if (Array.isArray(informOrder) && informOrder.length > 0) {
|
|
65
|
-
const order4inform = creteOrder4inform(order);
|
|
66
|
-
let recipientId = '';
|
|
67
|
-
if (typeof order.orderStatus === 'string') {
|
|
68
|
-
recipientId = order.customer.id;
|
|
69
|
-
if (order.orderStatus === factory.orderStatus.OrderReturned) {
|
|
70
|
-
if (typeof ((_a = order.returner) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
71
|
-
recipientId = order.returner.id;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
informTasks = informOrder.map((informOrderParams) => {
|
|
76
|
-
var _a, _b;
|
|
77
|
-
const informActionAttributes = {
|
|
78
|
-
agent: order.project,
|
|
79
|
-
object: order4inform,
|
|
80
|
-
project: order.project,
|
|
81
|
-
recipient: {
|
|
82
|
-
url: (_a = informOrderParams.recipient) === null || _a === void 0 ? void 0 : _a.url,
|
|
83
|
-
id: recipientId,
|
|
84
|
-
name: (_b = informOrderParams.recipient) === null || _b === void 0 ? void 0 : _b.name,
|
|
85
|
-
typeOf: factory.creativeWorkType.WebApplication
|
|
86
|
-
},
|
|
87
|
-
typeOf: factory.actionType.InformAction
|
|
88
|
-
};
|
|
89
|
-
return {
|
|
90
|
-
project: order.project,
|
|
91
|
-
name: factory.taskName.TriggerWebhook,
|
|
92
|
-
status: factory.taskStatus.Ready,
|
|
93
|
-
runsAt: taskRunsAt,
|
|
94
|
-
remainingNumberOfTries: 10,
|
|
95
|
-
numberOfTried: 0,
|
|
96
|
-
executionResults: [],
|
|
97
|
-
data: informActionAttributes
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
return informTasks;
|
|
102
|
-
}
|
|
103
|
-
exports.createInformTasks = createInformTasks;
|
|
104
|
-
function creteOrder4inform(order) {
|
|
105
|
-
if (typeof order.orderStatus === 'string') {
|
|
106
|
-
if (order.orderStatus === factory.orderStatus.OrderReturned) {
|
|
107
|
-
// 返品注文通知内容を最適化(2022-12-28~)
|
|
108
|
-
return Object.assign(Object.assign({ project: order.project, typeOf: order.typeOf, orderNumber: order.orderNumber, orderStatus: order.orderStatus }, (order.dateReturned !== undefined) ? { dateReturned: order.dateReturned } : undefined), (typeof order.id === 'string') ? { id: order.id } : undefined);
|
|
109
|
-
}
|
|
110
|
-
else if (order.orderStatus === factory.orderStatus.OrderDelivered) {
|
|
111
|
-
// 配送済注文通知内容を最適化(2022-12-29~)
|
|
112
|
-
return Object.assign({ project: order.project, typeOf: order.typeOf, orderNumber: order.orderNumber, orderStatus: order.orderStatus }, (typeof order.id === 'string') ? { id: order.id } : undefined);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
// 冗長な個人情報をmask
|
|
116
|
-
return Object.assign(Object.assign({
|
|
117
|
-
// whitelistで作成する(2022-07-19~)
|
|
118
|
-
project: order.project, typeOf: order.typeOf, seller: order.seller, price: order.price, priceCurrency: order.priceCurrency, confirmationNumber: order.confirmationNumber, orderNumber: order.orderNumber, acceptedOffers: order.acceptedOffers, orderStatus: order.orderStatus, orderDate: order.orderDate,
|
|
119
|
-
// mask
|
|
120
|
-
customer: Object.assign(Object.assign({}, (0, order_1.createMaskedCustomer)(order, { noProfile: false })), { additionalProperty: (Array.isArray(order.customer.additionalProperty)) ? order.customer.additionalProperty : [],
|
|
121
|
-
// identifierは必要
|
|
122
|
-
// 予約後を隠蔽(2022-12-24~)
|
|
123
|
-
identifier: (Array.isArray(order.customer.identifier))
|
|
124
|
-
? order.customer.identifier.filter((p) => {
|
|
125
|
-
return !reservedAgentIdentifireNames_1.RESERVED_AGENT_IDENTIFIER_NAMES.includes(p.name);
|
|
126
|
-
})
|
|
127
|
-
: [] }),
|
|
128
|
-
// paymentMethodsに関してもmask(2022-05-30~)
|
|
129
|
-
paymentMethods: order.paymentMethods.map((p) => {
|
|
130
|
-
return Object.assign(Object.assign({}, p), (typeof p.accountId === 'string' && p.accountId.length > 0)
|
|
131
|
-
? { accountId: ASTERISK_CHARACTER.repeat(p.accountId.length) }
|
|
132
|
-
: undefined);
|
|
133
|
-
}) }, (typeof order.token === 'string')
|
|
134
|
-
? { token: order.token }
|
|
135
|
-
: undefined), (typeof order.id === 'string') ? { id: order.id } : undefined);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else {
|
|
139
|
-
return order;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
function createConfirmReservationActionObject4ChevreByOrder(params) {
|
|
143
|
-
const chevreReservationNumbers = (Array.isArray(params.order.acceptedOffers))
|
|
144
|
-
? params.order.acceptedOffers.filter((o) => {
|
|
145
|
-
var _a;
|
|
146
|
-
return (o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
147
|
-
|| o.itemOffered.typeOf === factory.reservationType.BusReservation)
|
|
148
|
-
&& ((_a = o.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.Chevre;
|
|
149
|
-
})
|
|
150
|
-
.map((o) => {
|
|
151
|
-
return o.itemOffered.reservationNumber;
|
|
152
|
-
})
|
|
153
|
-
: [];
|
|
154
|
-
return [...new Set(chevreReservationNumbers)].map((reservationNumber) => {
|
|
155
|
-
return {
|
|
156
|
-
potentialActions: {
|
|
157
|
-
reserve: {
|
|
158
|
-
purpose: {
|
|
159
|
-
confirmationNumber: params.order.confirmationNumber,
|
|
160
|
-
orderNumber: params.order.orderNumber,
|
|
161
|
-
typeOf: factory.order.OrderType.Order
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
},
|
|
165
|
-
transactionNumber: reservationNumber,
|
|
166
|
-
typeOf: factory.assetTransactionType.Reserve
|
|
167
|
-
};
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
exports.createConfirmReservationActionObject4ChevreByOrder = createConfirmReservationActionObject4ChevreByOrder;
|
|
171
|
-
function createConfirmReservationActionObject4COAByOrder(params) {
|
|
172
|
-
// COA予約のみ
|
|
173
|
-
const coaReservationOffers = (Array.isArray(params.order.acceptedOffers))
|
|
174
|
-
? params.order.acceptedOffers.filter((o) => {
|
|
175
|
-
var _a;
|
|
176
|
-
return o.itemOffered.typeOf === factory.reservationType.EventReservation
|
|
177
|
-
&& ((_a = o.offeredThrough) === null || _a === void 0 ? void 0 : _a.identifier) === factory.service.webAPI.Identifier.COA;
|
|
178
|
-
})
|
|
179
|
-
: [];
|
|
180
|
-
const coaReservationNumbers = [...new Set(coaReservationOffers
|
|
181
|
-
.map((o) => {
|
|
182
|
-
return o.itemOffered.reservationNumber;
|
|
183
|
-
}))];
|
|
184
|
-
const customer = params.order.customer;
|
|
185
|
-
// 電話番号のフォーマットを日本人にリーダブルに調整(COAではこのフォーマットで扱うので)
|
|
186
|
-
const phoneUtil = google_libphonenumber_1.PhoneNumberUtil.getInstance();
|
|
187
|
-
const phoneNumber = phoneUtil.parse(customer.telephone, 'JP');
|
|
188
|
-
let telNum = phoneUtil.format(phoneNumber, google_libphonenumber_1.PhoneNumberFormat.NATIONAL);
|
|
189
|
-
// COAでは数字のみ受け付けるので数字以外を除去
|
|
190
|
-
telNum = telNum.replace(/[^\d]/g, '');
|
|
191
|
-
const mailAddr = customer.email;
|
|
192
|
-
if (mailAddr === undefined) {
|
|
193
|
-
throw new factory.errors.Argument('order', 'order.customer.email undefined');
|
|
194
|
-
}
|
|
195
|
-
return coaReservationNumbers.map((reservationNumber) => {
|
|
196
|
-
const coaReservations = coaReservationOffers
|
|
197
|
-
.filter((o) => o.itemOffered.reservationNumber === reservationNumber)
|
|
198
|
-
.map((o) => {
|
|
199
|
-
return o.itemOffered;
|
|
200
|
-
});
|
|
201
|
-
const coaReservation = coaReservations[0];
|
|
202
|
-
const reservationForCOAInfo = coaReservation.reservationFor.coaInfo;
|
|
203
|
-
if (reservationForCOAInfo === undefined) {
|
|
204
|
-
throw new factory.errors.NotFound('reservationFor.coaInfo');
|
|
205
|
-
}
|
|
206
|
-
const totalPrice = coaReservation.reservedTicket.coaReserveAmount;
|
|
207
|
-
if (totalPrice === undefined) {
|
|
208
|
-
throw new factory.errors.NotFound('reservedTicket.coaReserveAmount');
|
|
209
|
-
}
|
|
210
|
-
const listTicket = coaReservations.map((r) => {
|
|
211
|
-
var _a;
|
|
212
|
-
if (typeof ((_a = r.reservedTicket.coaTicketInfo) === null || _a === void 0 ? void 0 : _a.ticketCode) !== 'string') {
|
|
213
|
-
throw new factory.errors.NotFound('reservedTicket.coaTicketInfo');
|
|
214
|
-
}
|
|
215
|
-
// 冗長な属性を排除(2023-03-20~)
|
|
216
|
-
const { ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2, disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn, seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken, mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk } = r.reservedTicket.coaTicketInfo;
|
|
217
|
-
return {
|
|
218
|
-
ticketCode, stdPrice, addPrice, spseatAdd1, spseatAdd2,
|
|
219
|
-
disPrice, salePrice, mvtkAppPrice, ticketCount, spseatKbn,
|
|
220
|
-
seatNum, addGlasses, kbnEisyahousiki, mvtkNum, mvtkKbnDenshiken,
|
|
221
|
-
mvtkKbnMaeuriken, mvtkKbnKensyu, mvtkSalesPrice, kbnMgtk
|
|
222
|
-
};
|
|
223
|
-
});
|
|
224
|
-
return {
|
|
225
|
-
theaterCode: reservationForCOAInfo.theaterCode,
|
|
226
|
-
dateJouei: reservationForCOAInfo.dateJouei,
|
|
227
|
-
titleCode: reservationForCOAInfo.titleCode,
|
|
228
|
-
titleBranchNum: reservationForCOAInfo.titleBranchNum,
|
|
229
|
-
timeBegin: reservationForCOAInfo.timeBegin,
|
|
230
|
-
tmpReserveNum: reservationNumber,
|
|
231
|
-
// tslint:disable-next-line:no-irregular-whitespace
|
|
232
|
-
reserveName: (0, util_1.format)('%s %s', customer.familyName, customer.givenName),
|
|
233
|
-
// tslint:disable-next-line:no-irregular-whitespace
|
|
234
|
-
reserveNameJkana: (0, util_1.format)('%s %s', customer.familyName, customer.givenName),
|
|
235
|
-
telNum: telNum,
|
|
236
|
-
mailAddr: mailAddr,
|
|
237
|
-
reserveAmount: totalPrice,
|
|
238
|
-
listTicket,
|
|
239
|
-
transactionNumber: reservationNumber,
|
|
240
|
-
typeOf: 'COAReserveTransaction'
|
|
241
|
-
};
|
|
242
|
-
});
|
|
243
|
-
}
|
|
244
|
-
exports.createConfirmReservationActionObject4COAByOrder = createConfirmReservationActionObject4COAByOrder;
|
|
245
|
-
function createConfirmRegisterServiceActionObjectByOrder(params) {
|
|
246
|
-
// いったん保留
|
|
247
|
-
const chevreTransactionNumbers = [];
|
|
248
|
-
// const chevreReservationNumbers: string[] = (Array.isArray(params.order.acceptedOffers))
|
|
249
|
-
// ? params.order.acceptedOffers.filter((o) => {
|
|
250
|
-
// return o.itemOffered.typeOf === factory.permit.PermitType.Permit;
|
|
251
|
-
// })
|
|
252
|
-
// .map((o) => {
|
|
253
|
-
// return (<factory.order.IPermit>o.itemOffered).identifier;
|
|
254
|
-
// })
|
|
255
|
-
// : [];
|
|
256
|
-
return [...new Set(chevreTransactionNumbers)].map((transactionNumber) => {
|
|
257
|
-
return {
|
|
258
|
-
endDate: params.order.orderDate,
|
|
259
|
-
transactionNumber,
|
|
260
|
-
typeOf: factory.assetTransactionType.RegisterService
|
|
261
|
-
};
|
|
262
|
-
});
|
|
263
|
-
}
|
|
264
|
-
exports.createConfirmRegisterServiceActionObjectByOrder = createConfirmRegisterServiceActionObjectByOrder;
|
|
265
|
-
// export function createOnPlaceOrderTasksByTransaction(params: {
|
|
266
|
-
// object: factory.order.IOrder | IExternalOrder;
|
|
267
|
-
// potentialActions?: factory.action.trade.order.IPotentialActions;
|
|
268
|
-
// }): factory.task.IAttributes<factory.taskName>[] {
|
|
269
|
-
// const potentialActions = params.potentialActions;
|
|
270
|
-
// const now = new Date();
|
|
271
|
-
// // potentialActionsのためのタスクを生成
|
|
272
|
-
// const taskAttributes: factory.task.IAttributes<factory.taskName>[] = [];
|
|
273
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
274
|
-
// /* istanbul ignore else */
|
|
275
|
-
// if (potentialActions !== undefined) {
|
|
276
|
-
// // ポイント付与
|
|
277
|
-
// // tslint:disable-next-line:no-single-line-block-comment
|
|
278
|
-
// /* istanbul ignore else */
|
|
279
|
-
// if (Array.isArray(potentialActions.givePointAward)) {
|
|
280
|
-
// taskAttributes.push(...potentialActions.givePointAward.map(
|
|
281
|
-
// (a): factory.task.IAttributes<factory.taskName.GivePointAward> => {
|
|
282
|
-
// return {
|
|
283
|
-
// project: a.project,
|
|
284
|
-
// name: factory.taskName.GivePointAward,
|
|
285
|
-
// status: factory.taskStatus.Ready,
|
|
286
|
-
// runsAt: now, // なるはやで実行
|
|
287
|
-
// remainingNumberOfTries: 10,
|
|
288
|
-
// numberOfTried: 0,
|
|
289
|
-
// executionResults: [],
|
|
290
|
-
// data: a
|
|
291
|
-
// };
|
|
292
|
-
// }));
|
|
293
|
-
// }
|
|
294
|
-
// }
|
|
295
|
-
// return taskAttributes;
|
|
296
|
-
// }
|
|
297
|
-
/**
|
|
298
|
-
* 注文配送後のアクション
|
|
299
|
-
*/
|
|
300
|
-
function createOnOrderSentTasksByTransaction(params) {
|
|
301
|
-
const potentialActions = params.potentialActions;
|
|
302
|
-
const now = new Date();
|
|
303
|
-
const taskAttributes = [];
|
|
304
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
305
|
-
/* istanbul ignore else */
|
|
306
|
-
if (potentialActions !== undefined) {
|
|
307
|
-
if (Array.isArray(potentialActions.registerService)) {
|
|
308
|
-
taskAttributes.push(...potentialActions.registerService.map((a) => {
|
|
309
|
-
return {
|
|
310
|
-
project: a.project,
|
|
311
|
-
name: factory.taskName.ConfirmRegisterService,
|
|
312
|
-
status: factory.taskStatus.Ready,
|
|
313
|
-
runsAt: now,
|
|
314
|
-
remainingNumberOfTries: 10,
|
|
315
|
-
numberOfTried: 0,
|
|
316
|
-
executionResults: [],
|
|
317
|
-
data: a
|
|
318
|
-
};
|
|
319
|
-
}));
|
|
320
|
-
}
|
|
321
|
-
// 通貨転送
|
|
322
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
323
|
-
/* istanbul ignore else */
|
|
324
|
-
if (Array.isArray(potentialActions.moneyTransfer)) {
|
|
325
|
-
taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
|
|
326
|
-
return {
|
|
327
|
-
project: a.project,
|
|
328
|
-
name: factory.taskName.ConfirmMoneyTransfer,
|
|
329
|
-
status: factory.taskStatus.Ready,
|
|
330
|
-
runsAt: now,
|
|
331
|
-
remainingNumberOfTries: 10,
|
|
332
|
-
numberOfTried: 0,
|
|
333
|
-
executionResults: [],
|
|
334
|
-
data: a
|
|
335
|
-
};
|
|
336
|
-
}));
|
|
337
|
-
}
|
|
338
|
-
// tslint:disable-next-line:no-single-line-block-comment
|
|
339
|
-
/* istanbul ignore else */
|
|
340
|
-
if (Array.isArray(potentialActions.sendEmailMessage)) {
|
|
341
|
-
potentialActions.sendEmailMessage.forEach((s) => {
|
|
342
|
-
const sendEmailMessageTask = {
|
|
343
|
-
project: s.project,
|
|
344
|
-
name: factory.taskName.SendEmailMessage,
|
|
345
|
-
status: factory.taskStatus.Ready,
|
|
346
|
-
runsAt: now,
|
|
347
|
-
remainingNumberOfTries: 3,
|
|
348
|
-
numberOfTried: 0,
|
|
349
|
-
executionResults: [],
|
|
350
|
-
data: {
|
|
351
|
-
actionAttributes: s
|
|
352
|
-
}
|
|
353
|
-
};
|
|
354
|
-
taskAttributes.push(sendEmailMessageTask);
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
return taskAttributes;
|
|
359
|
-
}
|
|
360
|
-
exports.createOnOrderSentTasksByTransaction = createOnOrderSentTasksByTransaction;
|
|
361
|
-
/**
|
|
362
|
-
* 注文返品後のアクション
|
|
363
|
-
*/
|
|
364
|
-
function createOnOrderReturnedTasksByTransaction(params) {
|
|
365
|
-
const now = new Date();
|
|
366
|
-
const taskAttributes = [];
|
|
367
|
-
const potentialActions = params.potentialActions;
|
|
368
|
-
// 入金返却タスク
|
|
369
|
-
const returnMoneyTransferAttributes = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.returnMoneyTransfer;
|
|
370
|
-
if (Array.isArray(returnMoneyTransferAttributes)) {
|
|
371
|
-
taskAttributes.push(...returnMoneyTransferAttributes.map((a) => {
|
|
372
|
-
return {
|
|
373
|
-
project: a.project,
|
|
374
|
-
name: factory.taskName.ReturnMoneyTransfer,
|
|
375
|
-
status: factory.taskStatus.Ready,
|
|
376
|
-
runsAt: now,
|
|
377
|
-
remainingNumberOfTries: 10,
|
|
378
|
-
numberOfTried: 0,
|
|
379
|
-
executionResults: [],
|
|
380
|
-
data: a
|
|
381
|
-
};
|
|
382
|
-
}));
|
|
383
|
-
}
|
|
384
|
-
// ポイント特典返却タスク
|
|
385
|
-
const returnPointAwardAttributes = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.returnPointAward;
|
|
386
|
-
if (Array.isArray(returnPointAwardAttributes)) {
|
|
387
|
-
taskAttributes.push(...returnPointAwardAttributes.map((a) => {
|
|
388
|
-
return {
|
|
389
|
-
project: a.project,
|
|
390
|
-
name: factory.taskName.ReturnPointAward,
|
|
391
|
-
status: factory.taskStatus.Ready,
|
|
392
|
-
runsAt: now,
|
|
393
|
-
remainingNumberOfTries: 10,
|
|
394
|
-
numberOfTried: 0,
|
|
395
|
-
executionResults: [],
|
|
396
|
-
data: a
|
|
397
|
-
};
|
|
398
|
-
}));
|
|
399
|
-
}
|
|
400
|
-
const sendEmailMessageAttributes = potentialActions === null || potentialActions === void 0 ? void 0 : potentialActions.sendEmailMessage;
|
|
401
|
-
if (Array.isArray(sendEmailMessageAttributes)) {
|
|
402
|
-
sendEmailMessageAttributes.forEach((s) => {
|
|
403
|
-
const sendEmailMessageTask = {
|
|
404
|
-
project: s.project,
|
|
405
|
-
name: factory.taskName.SendEmailMessage,
|
|
406
|
-
status: factory.taskStatus.Ready,
|
|
407
|
-
runsAt: now,
|
|
408
|
-
remainingNumberOfTries: 3,
|
|
409
|
-
numberOfTried: 0,
|
|
410
|
-
executionResults: [],
|
|
411
|
-
data: {
|
|
412
|
-
actionAttributes: s
|
|
413
|
-
}
|
|
414
|
-
};
|
|
415
|
-
taskAttributes.push(sendEmailMessageTask);
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
return taskAttributes;
|
|
419
|
-
}
|
|
420
|
-
exports.createOnOrderReturnedTasksByTransaction = createOnOrderReturnedTasksByTransaction;
|
|
421
|
-
/**
|
|
422
|
-
* 注文中止時のアクション
|
|
423
|
-
*/
|
|
424
|
-
function createOnOrderCancelledTasksByTransaction(params) {
|
|
425
|
-
var _a;
|
|
426
|
-
const now = new Date();
|
|
427
|
-
const taskAttributes = [];
|
|
428
|
-
if (typeof ((_a = params.transaction) === null || _a === void 0 ? void 0 : _a.id) === 'string') {
|
|
429
|
-
const voidPaymentTaskAttributes = {
|
|
430
|
-
project: params.transaction.project,
|
|
431
|
-
name: factory.taskName.VoidPayTransaction,
|
|
432
|
-
status: factory.taskStatus.Ready,
|
|
433
|
-
runsAt: now,
|
|
434
|
-
remainingNumberOfTries: 10,
|
|
435
|
-
numberOfTried: 0,
|
|
436
|
-
executionResults: [],
|
|
437
|
-
data: {
|
|
438
|
-
project: params.transaction.project,
|
|
439
|
-
purpose: {
|
|
440
|
-
typeOf: params.transaction.typeOf,
|
|
441
|
-
id: params.transaction.id,
|
|
442
|
-
result: { order: { orderStatus: factory.orderStatus.OrderCancelled } }
|
|
443
|
-
}
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
const voidReserveTaskAttributes = {
|
|
447
|
-
project: params.transaction.project,
|
|
448
|
-
name: factory.taskName.VoidReserveTransaction,
|
|
449
|
-
status: factory.taskStatus.Ready,
|
|
450
|
-
runsAt: now,
|
|
451
|
-
remainingNumberOfTries: 10,
|
|
452
|
-
numberOfTried: 0,
|
|
453
|
-
executionResults: [],
|
|
454
|
-
data: {
|
|
455
|
-
project: params.transaction.project,
|
|
456
|
-
purpose: {
|
|
457
|
-
typeOf: params.transaction.typeOf,
|
|
458
|
-
id: params.transaction.id,
|
|
459
|
-
result: { order: { orderStatus: factory.orderStatus.OrderCancelled } }
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
};
|
|
463
|
-
taskAttributes.push(voidPaymentTaskAttributes, voidReserveTaskAttributes);
|
|
464
|
-
}
|
|
465
|
-
return taskAttributes;
|
|
466
|
-
}
|
|
467
|
-
exports.createOnOrderCancelledTasksByTransaction = createOnOrderCancelledTasksByTransaction;
|