@chevre/domain 25.0.0-alpha.2 → 25.0.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/lib/chevre/emailMessageBuilder.d.ts +10 -4
- package/lib/chevre/emailMessageBuilder.js +48 -73
- package/lib/chevre/repo/acceptedOffer.d.ts +1 -5
- package/lib/chevre/repo/acceptedOffer.js +5 -5
- package/lib/chevre/repo/acceptedOfferInReserve.d.ts +1 -5
- package/lib/chevre/repo/acceptedOfferInReserve.js +4 -4
- package/lib/chevre/repo/emailMessage.d.ts +18 -9
- package/lib/chevre/repo/emailMessage.js +26 -36
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.d.ts +1 -3
- package/lib/chevre/repo/factory/acceptedOffer/reserveTransaction2itemOffered.js +2 -3
- package/lib/chevre/repo/mongoose/schemas/emailMessages.d.ts +9 -1
- package/lib/chevre/repo/mongoose/schemas/emailMessages.js +5 -20
- package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
- package/lib/chevre/repo/mongoose/schemas/order.js +11 -110
- package/lib/chevre/repo/mongoose/schemas/setting.d.ts +0 -6
- package/lib/chevre/repo/order.d.ts +9 -6
- package/lib/chevre/repo/order.js +45 -26
- package/lib/chevre/repo/orderInTransaction.d.ts +50 -32
- package/lib/chevre/repo/orderInTransaction.js +109 -73
- package/lib/chevre/repo/orderNumber.d.ts +4 -0
- package/lib/chevre/repo/orderNumber.js +32 -60
- package/lib/chevre/repo/passport.d.ts +5 -2
- package/lib/chevre/repo/transaction/placeOrder.js +12 -10
- package/lib/chevre/repo/transaction.d.ts +6 -2
- package/lib/chevre/repo/transaction.js +6 -2
- package/lib/chevre/service/assetTransaction/reserve/start.d.ts +0 -2
- package/lib/chevre/service/offer/any.d.ts +3 -8
- package/lib/chevre/service/offer/any.js +7 -6
- package/lib/chevre/service/offer/event/authorize/processStartReserve4chevre.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +5 -6
- package/lib/chevre/service/offer/event/voidTransaction.js +29 -17
- package/lib/chevre/service/offer/event/voidTransactionByActionId.js +16 -12
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.d.ts +0 -6
- package/lib/chevre/service/offer/eventServiceByCOA/acceptOffer.js +10 -12
- package/lib/chevre/service/offer/eventServiceByCOA/authorize/factory.d.ts +1 -1
- package/lib/chevre/service/offer/eventServiceByCOA/authorize.js +7 -7
- package/lib/chevre/service/offer/eventServiceByCOA/changeOffers.js +21 -17
- package/lib/chevre/service/order/deleteOrder.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.d.ts +4 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderPaymentDue.js +1 -26
- package/lib/chevre/service/order/placeOrder/createPlacingOrderFromExistingTransaction.js +3 -2
- package/lib/chevre/service/order/placeOrder/factory.d.ts +1 -1
- package/lib/chevre/service/order/placeOrder/factory.js +10 -8
- package/lib/chevre/service/order/placeOrder/voidAcceptedOfferIfNecessary.d.ts +1 -3
- package/lib/chevre/service/order/placeOrder/voidAcceptedOfferIfNecessary.js +3 -15
- package/lib/chevre/service/order/placeOrder.js +6 -6
- package/lib/chevre/service/order.d.ts +1 -2
- package/lib/chevre/service/order.js +1 -5
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.d.ts +2 -4
- package/lib/chevre/service/payment/any/authorize/fixOrderAsNeeded.js +4 -6
- package/lib/chevre/service/payment/any/authorize.d.ts +2 -0
- package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +0 -4
- package/lib/chevre/service/payment/any/publishPaymentUrl.js +5 -8
- package/lib/chevre/service/reserve/findByCode.js +1 -1
- package/lib/chevre/service/reserve/searchByOrder.js +1 -1
- package/lib/chevre/service/task/acceptCOAOffer.js +8 -10
- package/lib/chevre/service/task/authorizePayment.js +2 -6
- package/lib/chevre/service/task/confirmReserveTransaction.js +1 -1
- package/lib/chevre/service/task/payment/payByTask.js +1 -1
- package/lib/chevre/service/task/publishPaymentUrl.js +6 -9
- package/lib/chevre/service/transaction/placeOrder/confirm/factory/result.d.ts +7 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +8 -23
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +3 -3
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +1 -6
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +2 -7
- package/lib/chevre/service/transaction/placeOrder/confirm.js +38 -35
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.d.ts +2 -0
- package/lib/chevre/service/transaction/placeOrder/issueOrderNumberIfNotExist.js +1 -0
- package/lib/chevre/service/transaction/placeOrder/start/factory.d.ts +19 -4
- package/lib/chevre/service/transaction/placeOrder/start/factory.js +23 -12
- package/lib/chevre/service/transaction/placeOrder/start.d.ts +7 -4
- package/lib/chevre/service/transaction/placeOrder/start.js +23 -2
- package/lib/chevre/service/transaction/placeOrder/updateAgent.d.ts +0 -4
- package/lib/chevre/service/transaction/placeOrder/updateAgent.js +20 -22
- package/lib/chevre/service/transaction/placeOrder.d.ts +1 -2
- package/lib/chevre/service/transaction/placeOrder.js +1 -3
- package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPaymentMethod.js +2 -37
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.d.ts +2 -2
- package/lib/chevre/service/transaction/returnOrder/potentialActions/sendEmailMessage.js +3 -18
- package/lib/chevre/service/transaction/returnOrder/potentialActions.d.ts +0 -1
- package/lib/chevre/service/transaction/returnOrder/potentialActions.js +0 -4
- package/lib/chevre/service/transaction/returnOrder/preStart.js +1 -1
- package/lib/chevre/service/transaction/returnOrder.d.ts +0 -2
- package/lib/chevre/service/transaction/returnOrder.js +13 -12
- package/lib/chevre/service/validation/validateOrder.js +1 -1
- package/lib/chevre/service.d.ts +0 -2
- package/lib/chevre/service.js +0 -2
- package/package.json +2 -2
- package/lib/chevre/factory/order.d.ts +0 -2
- package/lib/chevre/factory/order.js +0 -5
- package/lib/chevre/service/order/placeOrderWithoutTransaction.d.ts +0 -22
- package/lib/chevre/service/order/placeOrderWithoutTransaction.js +0 -51
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.issueOrderNumberIfNotExist = issueOrderNumberIfNotExist;
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
|
+
// const USE_LEGACY_ISSUE_ORDER_NUMBER = process.env.USE_LEGACY_ISSUE_ORDER_NUMBER === '1';
|
|
5
6
|
/**
|
|
6
7
|
* 未発行であれば、注文番号を発行して取引に保管する
|
|
7
8
|
*/
|
|
@@ -6,14 +6,29 @@ type IVerifiedPassport = factory.waiter.passport.IPassport & {
|
|
|
6
6
|
*/
|
|
7
7
|
identifier: string;
|
|
8
8
|
};
|
|
9
|
-
type
|
|
10
|
-
|
|
9
|
+
type ICustomerInObject = Pick<factory.order.ICustomer, 'id' | 'identifier' | 'typeOf'>;
|
|
10
|
+
interface IStartPlaceOrderParams {
|
|
11
|
+
project: Pick<factory.project.IProject, 'id' | 'typeOf'>;
|
|
12
|
+
agent: factory.transaction.placeOrder.IAgent;
|
|
13
|
+
seller: {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
object: {
|
|
11
17
|
/**
|
|
12
18
|
* api経由で取引が開始されれば必ず存在するはず
|
|
13
19
|
*/
|
|
14
20
|
clientUser: factory.transaction.placeOrder.IClientUserBeforeStart;
|
|
21
|
+
/**
|
|
22
|
+
* 注文ドキュメントに保管するcustomer
|
|
23
|
+
*/
|
|
24
|
+
customer?: ICustomerInObject;
|
|
25
|
+
passport?: factory.transaction.IPassportBeforeStart;
|
|
26
|
+
name?: never;
|
|
15
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* 注文ドキュメントに保管する代理人
|
|
30
|
+
*/
|
|
16
31
|
broker?: factory.order.IBroker;
|
|
17
|
-
}
|
|
18
|
-
declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project'
|
|
32
|
+
}
|
|
33
|
+
declare function createStartParams(params: IStartPlaceOrderParams, expiresInSeconds: number, passport: IVerifiedPassport | undefined, seller: Pick<factory.seller.ISeller, 'id' | 'name' | 'typeOf' | 'project'>, customerType?: string): factory.transaction.placeOrder.IStartParams;
|
|
19
34
|
export { AGENT_IDENTIFIER_NAME_PASSPORT, createStartParams, IStartPlaceOrderParams };
|
|
@@ -5,10 +5,9 @@ exports.createStartParams = createStartParams;
|
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
6
|
const AGENT_IDENTIFIER_NAME_PASSPORT = 'passport';
|
|
7
7
|
exports.AGENT_IDENTIFIER_NAME_PASSPORT = AGENT_IDENTIFIER_NAME_PASSPORT;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const { broker } = params;
|
|
8
|
+
;
|
|
9
|
+
function createStartParams(params, expiresInSeconds, passport, seller, customerType) {
|
|
10
|
+
// const { broker } = params;
|
|
12
11
|
// let clientUser: Omit<factory.clientUser.IClientUser, 'scope' | 'scopes'> | undefined;
|
|
13
12
|
let instrument;
|
|
14
13
|
if (typeof params.object.clientUser?.client_id === 'string') {
|
|
@@ -21,8 +20,8 @@ customerType) {
|
|
|
21
20
|
// ...(typeof passport?.scope === 'string') ? { passport } : undefined, // discontinue(2026-06-10~)
|
|
22
21
|
// ...(typeof clientUser?.client_id === 'string') ? { clientUser } : undefined, // discontinue(2026-06-10~)
|
|
23
22
|
// ...(typeof params.object?.name === 'string') ? { name: params.object?.name } : undefined, // discontinue(2026-06-11~)
|
|
24
|
-
...(typeof broker?.typeOf === 'string') ? { broker: broker } : undefined,
|
|
25
|
-
...(typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined,
|
|
23
|
+
// ...(typeof broker?.typeOf === 'string') ? { broker: broker } : undefined, // discontinue(2026-06-22~)
|
|
24
|
+
// ...(!minimizeStartPlaceOrderParams && typeof params.object.customer?.typeOf === 'string') ? { customer: params.object.customer } : undefined, // discontinue(2026-06-26~)
|
|
26
25
|
...(typeof customerType === 'string') ? { customerType } : undefined
|
|
27
26
|
};
|
|
28
27
|
if (typeof seller.id !== 'string') {
|
|
@@ -41,16 +40,28 @@ customerType) {
|
|
|
41
40
|
// ...(memeberOfPayload !== undefined) ? { memeberOfPayload } : undefined, // discontinue(2026-06-10~)
|
|
42
41
|
identifier: agentIdentifier
|
|
43
42
|
};
|
|
43
|
+
const sellerOfPlaceOrder = {
|
|
44
|
+
id: seller.id,
|
|
45
|
+
name: { ja: String(seller.name.ja) },
|
|
46
|
+
typeOf: seller.typeOf
|
|
47
|
+
};
|
|
44
48
|
return {
|
|
45
49
|
project: { typeOf: seller.project.typeOf, id: seller.project.id },
|
|
46
50
|
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
47
51
|
agent,
|
|
48
|
-
seller:
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
seller: sellerOfPlaceOrder, // sellerを最小化(2026-06-26~)
|
|
53
|
+
// seller: (minimizeStartPlaceOrderParams)
|
|
54
|
+
// ? {
|
|
55
|
+
// id: seller.id,
|
|
56
|
+
// name: { ja: String(seller.name.ja) },
|
|
57
|
+
// typeOf: seller.typeOf
|
|
58
|
+
// }
|
|
59
|
+
// : {
|
|
60
|
+
// id: seller.id,
|
|
61
|
+
// name: seller.name,
|
|
62
|
+
// typeOf: seller.typeOf,
|
|
63
|
+
// additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
|
|
64
|
+
// },
|
|
54
65
|
object: transactionObject,
|
|
55
66
|
expiresInSeconds,
|
|
56
67
|
...(typeof instrument?.id === 'string') ? { instrument } : undefined
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { IssuerRepo } from '../../../repo/issuer';
|
|
2
2
|
import type { MemberRepo } from '../../../repo/member';
|
|
3
3
|
import type { MemberProgramRepo } from '../../../repo/memberProgram';
|
|
4
|
+
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
5
|
+
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
4
6
|
import type { PassportRepo } from '../../../repo/passport';
|
|
7
|
+
import type { ProjectRepo } from '../../../repo/project';
|
|
5
8
|
import type { ProjectMakesOfferRepo } from '../../../repo/projectMakesOffer';
|
|
6
9
|
import type { SellerRepo } from '../../../repo/seller';
|
|
7
10
|
import type { IStartedPlaceOrder, PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
@@ -14,13 +17,13 @@ interface IStartOperationRepos {
|
|
|
14
17
|
projectMakesOffer: ProjectMakesOfferRepo;
|
|
15
18
|
seller: SellerRepo;
|
|
16
19
|
placeOrder: PlaceOrderRepo;
|
|
20
|
+
orderInTransaction: OrderInTransactionRepo;
|
|
21
|
+
project: ProjectRepo;
|
|
22
|
+
orderNumber: OrderNumberRepo;
|
|
17
23
|
}
|
|
18
24
|
type IStartOperation<T> = (repos: IStartOperationRepos) => Promise<T>;
|
|
19
|
-
interface IStartOptions {
|
|
20
|
-
lockPassport: boolean;
|
|
21
|
-
}
|
|
22
25
|
/**
|
|
23
26
|
* 取引開始
|
|
24
27
|
*/
|
|
25
|
-
declare function start(params: IStartPlaceOrderParams
|
|
28
|
+
declare function start(params: IStartPlaceOrderParams): IStartOperation<IStartedPlaceOrder>;
|
|
26
29
|
export { start, IStartPlaceOrderParams };
|
|
@@ -4,10 +4,11 @@ exports.start = start;
|
|
|
4
4
|
const factory_1 = require("../../../factory");
|
|
5
5
|
const factory_2 = require("./start/factory");
|
|
6
6
|
const validateStartRequest_1 = require("./start/validateStartRequest");
|
|
7
|
+
const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
|
|
7
8
|
/**
|
|
8
9
|
* 取引開始
|
|
9
10
|
*/
|
|
10
|
-
function start(params
|
|
11
|
+
function start(params) {
|
|
11
12
|
return async (repos) => {
|
|
12
13
|
const { passport, customerType } = await repos.passport.validatePassportTokenIfExist(params);
|
|
13
14
|
const { sellerMakesOffer, seller } = await (0, validateStartRequest_1.validateStartRequest)({
|
|
@@ -25,7 +26,7 @@ function start(params, options) {
|
|
|
25
26
|
const startParams = (0, factory_2.createStartParams)(params, expiresInSeconds, passport, seller, customerType);
|
|
26
27
|
let transaction;
|
|
27
28
|
// lock passport(2024-07-05~)
|
|
28
|
-
if (
|
|
29
|
+
if (passport !== undefined) {
|
|
29
30
|
try {
|
|
30
31
|
await repos.passport.lock(passport);
|
|
31
32
|
}
|
|
@@ -51,6 +52,26 @@ function start(params, options) {
|
|
|
51
52
|
if (transaction === undefined) {
|
|
52
53
|
transaction = await repos.placeOrder.startPlaceOrder(startParams);
|
|
53
54
|
}
|
|
55
|
+
// support createOrderDocument(2026-06-23~)
|
|
56
|
+
const orderNumber = await (0, issueOrderNumberIfNotExist_1.issueOrderNumberIfNotExist)({
|
|
57
|
+
project: { id: params.project.id },
|
|
58
|
+
id: transaction.id,
|
|
59
|
+
object: { orderDate: new Date() }
|
|
60
|
+
})(repos);
|
|
61
|
+
await repos.orderInTransaction.createPlaceOrderIfNotExists({
|
|
62
|
+
orderNumber,
|
|
63
|
+
project: { id: params.project.id, typeOf: factory_1.factory.organizationType.Project },
|
|
64
|
+
identifier: transaction.id,
|
|
65
|
+
seller: {
|
|
66
|
+
id: seller.id,
|
|
67
|
+
name: (typeof seller.name === 'string') ? seller.name : String(seller.name?.ja),
|
|
68
|
+
typeOf: seller.typeOf,
|
|
69
|
+
additionalProperty: (Array.isArray(seller.additionalProperty)) ? seller.additionalProperty : [] // 追加特性を追加(2023-08-08~)
|
|
70
|
+
},
|
|
71
|
+
...((typeof params.object.customer?.typeOf === 'string') && { customer: params.object.customer }),
|
|
72
|
+
...((typeof params.broker?.typeOf === 'string') && { broker: params.broker })
|
|
73
|
+
});
|
|
74
|
+
// console.log('createPlaceOrderResult:', createPlaceOrderResult);
|
|
54
75
|
return transaction;
|
|
55
76
|
};
|
|
56
77
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../../factory';
|
|
2
2
|
import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
|
|
3
|
-
import type { OrderNumberRepo } from '../../../repo/orderNumber';
|
|
4
|
-
import type { ProjectRepo } from '../../../repo/project';
|
|
5
3
|
import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
6
4
|
/**
|
|
7
5
|
* 取引人プロフィール更新
|
|
@@ -17,7 +15,5 @@ export declare function updateAgent(params: {
|
|
|
17
15
|
};
|
|
18
16
|
}): (repos: {
|
|
19
17
|
orderInTransaction: OrderInTransactionRepo;
|
|
20
|
-
orderNumber: OrderNumberRepo;
|
|
21
|
-
project: ProjectRepo;
|
|
22
18
|
placeOrder: PlaceOrderRepo;
|
|
23
19
|
}) => Promise<void>;
|
|
@@ -3,8 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.updateAgent = updateAgent;
|
|
4
4
|
const google_libphonenumber_1 = require("google-libphonenumber");
|
|
5
5
|
const factory_1 = require("../../../factory");
|
|
6
|
-
const issueOrderNumberIfNotExist_1 = require("./issueOrderNumberIfNotExist");
|
|
7
|
-
// export type ITransactionOperation<T> = (repos: { transaction: TransactionRepo }) => Promise<T>;
|
|
8
6
|
function fixCustomer(params) {
|
|
9
7
|
return async (repos) => {
|
|
10
8
|
let formattedTelephone;
|
|
@@ -20,7 +18,7 @@ function fixCustomer(params) {
|
|
|
20
18
|
throw new factory_1.factory.errors.Argument('telephone', (error instanceof Error) ? error.message : String(error));
|
|
21
19
|
}
|
|
22
20
|
const transaction = await repos.placeOrder.findPlaceOrderInProgressById({
|
|
23
|
-
typeOf:
|
|
21
|
+
typeOf: factory_1.factory.transactionType.PlaceOrder,
|
|
24
22
|
id: params.id
|
|
25
23
|
}, ['agent', 'object', 'typeOf', 'project']);
|
|
26
24
|
if (transaction.agent.id !== params.agent.id) {
|
|
@@ -29,20 +27,20 @@ function fixCustomer(params) {
|
|
|
29
27
|
// 注文取引の場合、object.customerにも適用
|
|
30
28
|
let customer;
|
|
31
29
|
if (transaction.typeOf === factory_1.factory.transactionType.PlaceOrder) {
|
|
32
|
-
//
|
|
33
|
-
const
|
|
34
|
-
|
|
30
|
+
// orderInTransaction.customer?.typeOfは取引開始時にセットされている前提で再実装(2026-06-24~)
|
|
31
|
+
const customerByTransaction = await repos.orderInTransaction.findCustomerByOrderIdentifier({
|
|
32
|
+
identifier: params.id,
|
|
33
|
+
// project: { id: transaction.project.id }
|
|
34
|
+
});
|
|
35
|
+
// // いったんtransaction.object.customer?.typeOfは取引開始時にセットされている前提
|
|
36
|
+
// const customerByTransaction = transaction.object.customer;
|
|
37
|
+
if (typeof customerByTransaction?.typeOf === 'string') {
|
|
35
38
|
customer = {
|
|
36
|
-
typeOf:
|
|
37
|
-
id:
|
|
38
|
-
...(Array.isArray(
|
|
39
|
-
? { identifier:
|
|
39
|
+
typeOf: customerByTransaction.typeOf,
|
|
40
|
+
id: customerByTransaction.id,
|
|
41
|
+
...(Array.isArray(customerByTransaction.identifier))
|
|
42
|
+
? { identifier: customerByTransaction.identifier }
|
|
40
43
|
: /* istanbul ignore next */ undefined,
|
|
41
|
-
// discontinue(2024-05-16~)
|
|
42
|
-
// ...(transaction.object.customer.typeOf === factory.personType.Person
|
|
43
|
-
// && typeof transaction.object.customer.memberOf?.typeOf === 'string')
|
|
44
|
-
// ? { memberOf: transaction.object.customer.memberOf }
|
|
45
|
-
// : undefined,
|
|
46
44
|
...(Array.isArray(params.agent.additionalProperty))
|
|
47
45
|
? { additionalProperty: params.agent.additionalProperty }
|
|
48
46
|
: /* istanbul ignore next */ undefined,
|
|
@@ -75,11 +73,11 @@ function updateAgent(params) {
|
|
|
75
73
|
const { customer, transaction } = await fixCustomer(params)(repos);
|
|
76
74
|
// also save in orderInTransaction(2024-06-20~)
|
|
77
75
|
if (customer !== undefined) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
76
|
+
// // 注文ドキュメントを参照(2026-06-24~)
|
|
77
|
+
// const orderNumber = await repos.orderInTransaction.findOrderNumberByIdentifier({
|
|
78
|
+
// identifier: params.id,
|
|
79
|
+
// project: { id: transaction.project.id },
|
|
80
|
+
// }, { onlyPlaceOrder: true });
|
|
83
81
|
const customerName = (typeof customer.name === 'string' && customer.name !== '')
|
|
84
82
|
? customer.name
|
|
85
83
|
: (typeof customer.givenName === 'string' && typeof customer.familyName === 'string'
|
|
@@ -91,9 +89,9 @@ function updateAgent(params) {
|
|
|
91
89
|
identifier: (Array.isArray(customer.identifier)) ? customer.identifier : [],
|
|
92
90
|
...(typeof customerName === 'string') ? { name: customerName } : undefined
|
|
93
91
|
};
|
|
94
|
-
await repos.orderInTransaction.
|
|
95
|
-
orderNumber,
|
|
92
|
+
await repos.orderInTransaction.setCustomerByIdentifier({
|
|
96
93
|
project: transaction.project,
|
|
94
|
+
identifier: params.id,
|
|
97
95
|
customer: customerInOrder
|
|
98
96
|
});
|
|
99
97
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* 注文取引サービス
|
|
3
3
|
*/
|
|
4
|
-
import { POINT_AWARD_IDENTIFIER_NAME } from '../../factory/order';
|
|
5
4
|
import { confirm } from './placeOrder/confirm';
|
|
6
5
|
import { exportTasksById } from './placeOrder/exportTasksById';
|
|
7
6
|
import { start, IStartPlaceOrderParams } from './placeOrder/start';
|
|
8
7
|
import { updateAgent } from './placeOrder/updateAgent';
|
|
9
|
-
export { confirm,
|
|
8
|
+
export { confirm, start, IStartPlaceOrderParams, exportTasksById, updateAgent };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateAgent = exports.exportTasksById = exports.start = exports.
|
|
3
|
+
exports.updateAgent = exports.exportTasksById = exports.start = exports.confirm = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* 注文取引サービス
|
|
6
6
|
*/
|
|
7
|
-
const order_1 = require("../../factory/order");
|
|
8
|
-
Object.defineProperty(exports, "POINT_AWARD_IDENTIFIER_NAME", { enumerable: true, get: function () { return order_1.POINT_AWARD_IDENTIFIER_NAME; } });
|
|
9
7
|
const confirm_1 = require("./placeOrder/confirm");
|
|
10
8
|
Object.defineProperty(exports, "confirm", { enumerable: true, get: function () { return confirm_1.confirm; } });
|
|
11
9
|
const exportTasksById_1 = require("./placeOrder/exportTasksById");
|
|
@@ -3,9 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createReturnPaymentMethodActions = createReturnPaymentMethodActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../emailMessageBuilder");
|
|
5
5
|
const factory_1 = require("../../../../factory");
|
|
6
|
-
async function createReturnInvoicePotentialActions(params,
|
|
7
|
-
// settings: Settings
|
|
8
|
-
setting) {
|
|
6
|
+
async function createReturnInvoicePotentialActions(params, setting) {
|
|
9
7
|
const order = params.order;
|
|
10
8
|
const emailMessagesOnReturnEachPaymentMethodId = [];
|
|
11
9
|
const sendEmailMessageOnRefund = [];
|
|
@@ -32,21 +30,10 @@ setting) {
|
|
|
32
30
|
}, setting);
|
|
33
31
|
emailMessagesOnReturnEachPaymentMethodId.push(emailMessage);
|
|
34
32
|
sendEmailMessageOnRefund.push({
|
|
35
|
-
// project: order.project, // discontinue(2024-06-26~)
|
|
36
|
-
// typeOf: factory.actionType.SendAction, // discontinue(2024-06-26~)
|
|
37
|
-
// standardize object(2024-06-27~)
|
|
38
|
-
// object: emailMessage
|
|
39
33
|
object: {
|
|
40
34
|
identifier: emailMessage.identifier,
|
|
41
35
|
typeOf: factory_1.factory.creativeWorkType.EmailMessage
|
|
42
36
|
}
|
|
43
|
-
// agent: order.project, // discontinue(2024-06-26~)
|
|
44
|
-
// recipient: { // discontinue(2024-06-26~)
|
|
45
|
-
// typeOf: order.customer.typeOf,
|
|
46
|
-
// id: order.customer.id
|
|
47
|
-
// },
|
|
48
|
-
// potentialActions: {}, // discontinue(2024-06-25~)
|
|
49
|
-
// purpose: sendActionPurpose // discontinue(2024-06-26~)
|
|
50
37
|
});
|
|
51
38
|
}
|
|
52
39
|
return {
|
|
@@ -56,18 +43,9 @@ setting) {
|
|
|
56
43
|
}
|
|
57
44
|
};
|
|
58
45
|
}
|
|
59
|
-
async function createReturnPaymentMethodActions(params,
|
|
60
|
-
// settings: Settings
|
|
61
|
-
setting) {
|
|
46
|
+
async function createReturnPaymentMethodActions(params, setting) {
|
|
62
47
|
const emailMessagesOnReturnInvoice = [];
|
|
63
48
|
const potentialReturnInvoiceActions = [];
|
|
64
|
-
// const returnPaymentMethodPurpose: factory.order.ISimpleOrder = {
|
|
65
|
-
// typeOf: order.typeOf,
|
|
66
|
-
// orderNumber: order.orderNumber,
|
|
67
|
-
// price: order.price,
|
|
68
|
-
// priceCurrency: order.priceCurrency,
|
|
69
|
-
// orderDate: order.orderDate
|
|
70
|
-
// };
|
|
71
49
|
// MovieTicket決済以外について返品ポリシーのreturnFeesを適用する(2022-08-10~)
|
|
72
50
|
const returnFees = params.transaction.object.returnPolicy.returnFees;
|
|
73
51
|
// ReturnFeesCustomerResponsibilityであれば返金はなし、それ以外は返金する
|
|
@@ -95,19 +73,6 @@ setting) {
|
|
|
95
73
|
};
|
|
96
74
|
// optimize(2024-06-19~)
|
|
97
75
|
return { object, potentialActions: potentialActionsOnRefund };
|
|
98
|
-
// return {
|
|
99
|
-
// project: order.project,
|
|
100
|
-
// typeOf: factory.actionType.ReturnAction,
|
|
101
|
-
// object,
|
|
102
|
-
// agent: order.project,
|
|
103
|
-
// recipient: {
|
|
104
|
-
// typeOf: order.customer.typeOf,
|
|
105
|
-
// id: order.customer.id,
|
|
106
|
-
// name: String(order.customer.name)
|
|
107
|
-
// },
|
|
108
|
-
// purpose: returnPaymentMethodPurpose,
|
|
109
|
-
// potentialActions: potentialActionsOnRefund
|
|
110
|
-
// };
|
|
111
76
|
})));
|
|
112
77
|
}
|
|
113
78
|
// 決済カード決済について
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { IOrderAsCreateEmailParams } from '../../../../emailMessageBuilder';
|
|
1
2
|
import { factory } from '../../../../factory';
|
|
2
3
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
4
|
type IPotentialSendEmailMessageAction = factory.action.transfer.returnAction.order.IPotentialSendEmailMessageAction;
|
|
4
5
|
export declare function createSendEmailMessaegActionsOnReturn(params: {
|
|
5
|
-
order:
|
|
6
|
+
order: IOrderAsCreateEmailParams;
|
|
6
7
|
returnOrderActionParams?: factory.transaction.returnOrder.IReturnOrderActionParams;
|
|
7
|
-
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
8
8
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
9
9
|
emailMessagesOnReturn: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
10
10
|
sendEmailMessaegActionsOnReturn: IPotentialSendEmailMessageAction[];
|
|
@@ -7,13 +7,6 @@ async function createSendEmailMessaegActionsOnReturn(params,
|
|
|
7
7
|
// settings: Settings
|
|
8
8
|
setting) {
|
|
9
9
|
const order = params.order;
|
|
10
|
-
// const sendActionPurpose: factory.action.transfer.send.message.email.IPurpose = {
|
|
11
|
-
// typeOf: order.typeOf,
|
|
12
|
-
// orderNumber: order.orderNumber,
|
|
13
|
-
// price: order.price,
|
|
14
|
-
// priceCurrency: order.priceCurrency,
|
|
15
|
-
// orderDate: order.orderDate
|
|
16
|
-
// };
|
|
17
10
|
// 返品後のEメール送信アクション
|
|
18
11
|
const emailMessagesOnReturn = [];
|
|
19
12
|
const sendEmailMessaegActionsOnReturn = [];
|
|
@@ -24,24 +17,16 @@ setting) {
|
|
|
24
17
|
order,
|
|
25
18
|
index,
|
|
26
19
|
...(sendEmailMessageParams.object !== undefined) ? { email: sendEmailMessageParams.object } : undefined,
|
|
27
|
-
...(params.emailMessageOnOrderReturned !== undefined)
|
|
28
|
-
|
|
29
|
-
|
|
20
|
+
// ...(params.emailMessageOnOrderReturned !== undefined)
|
|
21
|
+
// ? { emailMessage: params.emailMessageOnOrderReturned }
|
|
22
|
+
// : undefined
|
|
30
23
|
}, setting);
|
|
31
24
|
emailMessagesOnReturn.push(emailMessage);
|
|
32
25
|
return {
|
|
33
|
-
// project: order.project, // optimize(2024-06-25~)
|
|
34
|
-
// typeOf: factory.actionType.SendAction, // optimize(2024-06-25~)
|
|
35
|
-
// standardize object(2024-06-27~)
|
|
36
|
-
// object: emailMessage
|
|
37
26
|
object: {
|
|
38
27
|
identifier: emailMessage.identifier,
|
|
39
28
|
typeOf: factory_1.factory.creativeWorkType.EmailMessage
|
|
40
29
|
}
|
|
41
|
-
// agent: order.project, // optimize(2024-06-25~)
|
|
42
|
-
// recipient: { typeOf: order.customer.typeOf, id: order.customer.id }, // optimize(2024-06-25~)
|
|
43
|
-
// potentialActions: {} // optimize(2024-06-25~)
|
|
44
|
-
// purpose: sendActionPurpose // optimize(2024-06-25~)
|
|
45
30
|
};
|
|
46
31
|
})));
|
|
47
32
|
}
|
|
@@ -6,7 +6,6 @@ declare function createPotentialActions(params: {
|
|
|
6
6
|
orders: IReturningOrder4potentialActions[];
|
|
7
7
|
potentialActions?: factory.transaction.returnOrder.IPotentialActionsParams;
|
|
8
8
|
transaction: Pick<factory.transaction.returnOrder.ITransaction, 'agent' | 'object'>;
|
|
9
|
-
emailMessageOnOrderReturned?: factory.creativeWork.message.email.ICreativeWork;
|
|
10
9
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
11
10
|
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
12
11
|
potentialActions: factory.transaction.returnOrder.IPotentialActions;
|
|
@@ -22,9 +22,6 @@ setting) {
|
|
|
22
22
|
...(returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined
|
|
23
23
|
}, setting);
|
|
24
24
|
emailMessages.push(...emailMessagesOnReturnInvoice);
|
|
25
|
-
// discontinue(2026-04-18~)
|
|
26
|
-
// // ポイント特典の数だけ、返却アクションを作成
|
|
27
|
-
// const returnPointAwardActions = await createReturnPointAwardActions({ ...params, order });
|
|
28
25
|
// 返品後のEメール送信アクション
|
|
29
26
|
const { emailMessagesOnReturn, sendEmailMessaegActionsOnReturn } = await (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)({
|
|
30
27
|
...params,
|
|
@@ -34,7 +31,6 @@ setting) {
|
|
|
34
31
|
emailMessages.push(...emailMessagesOnReturn);
|
|
35
32
|
const potentialActionsOnReturnOrder = {
|
|
36
33
|
returnPaymentMethod: returnPaymentMethodActions,
|
|
37
|
-
// returnPointAward: returnPointAwardActions, // discontinue(2026-04-18~)
|
|
38
34
|
sendEmailMessage: sendEmailMessaegActionsOnReturn
|
|
39
35
|
};
|
|
40
36
|
const returnOrderObject = {
|
|
@@ -144,7 +144,7 @@ function fixOrders(params) {
|
|
|
144
144
|
const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
145
145
|
orderNumber: { $eq: params.object.order[0].orderNumber },
|
|
146
146
|
project: { id: { $eq: params.project.id } }
|
|
147
|
-
}
|
|
147
|
+
});
|
|
148
148
|
return { acceptedOffers, eventIds, offerIds, orders };
|
|
149
149
|
};
|
|
150
150
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { factory } from '../../factory';
|
|
2
2
|
import type { AcceptedOfferRepo } from '../../repo/acceptedOffer';
|
|
3
|
-
import type { EmailMessageRepo } from '../../repo/emailMessage';
|
|
4
3
|
import type { EventRepo } from '../../repo/event';
|
|
5
4
|
import type { MerchantReturnPolicyRepo } from '../../repo/merchantReturnPolicy';
|
|
6
5
|
import type { MessageRepo } from '../../repo/message';
|
|
@@ -41,7 +40,6 @@ type ITaskAndTransactionOperation<T> = (repos: IExportTasksByIdRepos) => Promise
|
|
|
41
40
|
declare function start(params: factory.transaction.returnOrder.IStartParamsWithoutDetail): IStartOperation<IStartedTransaction>;
|
|
42
41
|
interface IConfirmRepos {
|
|
43
42
|
acceptedOffer: AcceptedOfferRepo;
|
|
44
|
-
emailMessage?: EmailMessageRepo;
|
|
45
43
|
message: MessageRepo;
|
|
46
44
|
order: OrderRepo;
|
|
47
45
|
setting: SettingRepo;
|
|
@@ -112,17 +112,18 @@ function confirm(params) {
|
|
|
112
112
|
'orderedItem', 'paymentMethods', 'price', 'priceCurrency', 'project', 'seller', 'typeOf'
|
|
113
113
|
]
|
|
114
114
|
});
|
|
115
|
-
//
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
115
|
+
// discontinue emailMessageRepo
|
|
116
|
+
// // デフォルトEメールメッセージを検索
|
|
117
|
+
// let emailMessageOnOrderReturned: factory.creativeWork.message.email.ICreativeWork | undefined;
|
|
118
|
+
// if (repos.emailMessage !== undefined) {
|
|
119
|
+
// const searchEmailMessagesResult = await repos.emailMessage.search({
|
|
120
|
+
// limit: 1,
|
|
121
|
+
// page: 1,
|
|
122
|
+
// project: { id: { $eq: transaction.project.id } },
|
|
123
|
+
// about: { identifier: { $eq: factory.creativeWork.message.email.AboutIdentifier.OnOrderReturned } }
|
|
124
|
+
// });
|
|
125
|
+
// emailMessageOnOrderReturned = searchEmailMessagesResult.shift();
|
|
126
|
+
// }
|
|
126
127
|
const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
|
|
127
128
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
128
129
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
@@ -133,7 +134,7 @@ function confirm(params) {
|
|
|
133
134
|
orders: returningOrders,
|
|
134
135
|
transaction: transaction,
|
|
135
136
|
...(params.potentialActions !== undefined) ? { potentialActions: params.potentialActions } : undefined,
|
|
136
|
-
...(emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined
|
|
137
|
+
// ...(emailMessageOnOrderReturned !== undefined) ? { emailMessageOnOrderReturned } : undefined
|
|
137
138
|
},
|
|
138
139
|
// settings
|
|
139
140
|
setting);
|
|
@@ -22,7 +22,7 @@ function validateOrder(params) {
|
|
|
22
22
|
const acceptedOffers = await repos.acceptedOffer.searchAcceptedOffersByOrderNumber({
|
|
23
23
|
orderNumber: { $eq: params.orderNumber },
|
|
24
24
|
project: { id: { $eq: params.project.id } }
|
|
25
|
-
}
|
|
25
|
+
});
|
|
26
26
|
let payTransactions = [];
|
|
27
27
|
if (order.paymentMethods.length > 0) {
|
|
28
28
|
payTransactions = await repos.assetTransaction.search({
|
package/lib/chevre/service.d.ts
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import * as AccountTransactionIdentifierFactory from './factory/accountTransactionIdentifier';
|
|
5
5
|
import * as EventFactory from './factory/event';
|
|
6
|
-
import * as OrderFactory from './factory/order';
|
|
7
6
|
import * as ReservedAgentIdentifireNamesFactory from './factory/reservedAgentIdentifireNames';
|
|
8
7
|
import * as TaskIdentifierFactory from './factory/taskIdentifier';
|
|
9
8
|
import * as TransactionFactory from './factory/transaction';
|
|
@@ -60,7 +59,6 @@ export declare namespace transaction {
|
|
|
60
59
|
export declare namespace factory {
|
|
61
60
|
export import accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
62
61
|
export import event = EventFactory;
|
|
63
|
-
export import order = OrderFactory;
|
|
64
62
|
export import reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
65
63
|
export import taskIdentifier = TaskIdentifierFactory;
|
|
66
64
|
export import transaction = TransactionFactory;
|
package/lib/chevre/service.js
CHANGED
|
@@ -40,7 +40,6 @@ exports.factory = exports.transaction = exports.task = exports.reserve = exports
|
|
|
40
40
|
*/
|
|
41
41
|
const AccountTransactionIdentifierFactory = __importStar(require("./factory/accountTransactionIdentifier"));
|
|
42
42
|
const EventFactory = __importStar(require("./factory/event"));
|
|
43
|
-
const OrderFactory = __importStar(require("./factory/order"));
|
|
44
43
|
const ReservedAgentIdentifireNamesFactory = __importStar(require("./factory/reservedAgentIdentifireNames"));
|
|
45
44
|
const TaskIdentifierFactory = __importStar(require("./factory/taskIdentifier"));
|
|
46
45
|
const TransactionFactory = __importStar(require("./factory/transaction"));
|
|
@@ -183,7 +182,6 @@ var factory;
|
|
|
183
182
|
(function (factory) {
|
|
184
183
|
factory.accountTransactionIdentifier = AccountTransactionIdentifierFactory;
|
|
185
184
|
factory.event = EventFactory;
|
|
186
|
-
factory.order = OrderFactory;
|
|
187
185
|
factory.reservedAgentIdentifireNames = ReservedAgentIdentifireNamesFactory;
|
|
188
186
|
factory.taskIdentifier = TaskIdentifierFactory;
|
|
189
187
|
factory.transaction = TransactionFactory;
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@aws-sdk/client-cognito-identity-provider": "3.600.0",
|
|
13
13
|
"@aws-sdk/credential-providers": "3.600.0",
|
|
14
|
-
"@chevre/factory": "9.0.0
|
|
14
|
+
"@chevre/factory": "9.0.0",
|
|
15
15
|
"@motionpicture/coa-service": "10.0.0",
|
|
16
16
|
"@motionpicture/gmo-service": "6.1.0-alpha.0",
|
|
17
17
|
"@sendgrid/client": "8.1.4",
|
|
@@ -91,5 +91,5 @@
|
|
|
91
91
|
"postversion": "git push origin --tags",
|
|
92
92
|
"prepublishOnly": "npm run clean && npm run build"
|
|
93
93
|
},
|
|
94
|
-
"version": "25.0.0-alpha.
|
|
94
|
+
"version": "25.0.0-alpha.20"
|
|
95
95
|
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AWARD_ACCOUNTS_IDENTIFIER_NAME = exports.POINT_AWARD_IDENTIFIER_NAME = void 0;
|
|
4
|
-
exports.POINT_AWARD_IDENTIFIER_NAME = 'pointAwardIdentifiers';
|
|
5
|
-
exports.AWARD_ACCOUNTS_IDENTIFIER_NAME = 'awardAccounts';
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { AccountingReportRepo } from '../../repo/accountingReport';
|
|
2
|
-
import type { ActionRepo } from '../../repo/action';
|
|
3
|
-
import type { OrderRepo } from '../../repo/order';
|
|
4
|
-
import type { TaskRepo } from '../../repo/task';
|
|
5
|
-
import { factory } from '../../factory';
|
|
6
|
-
import { IExternalOrder } from './onOrderStatusChanged';
|
|
7
|
-
/**
|
|
8
|
-
* 注文取引なしに注文を作成する
|
|
9
|
-
*/
|
|
10
|
-
declare function placeOrderWithoutTransaction(params: {
|
|
11
|
-
agent?: factory.action.trade.order.IAgent;
|
|
12
|
-
project: {
|
|
13
|
-
id: string;
|
|
14
|
-
};
|
|
15
|
-
object: IExternalOrder;
|
|
16
|
-
}): (repos: {
|
|
17
|
-
accountingReport: AccountingReportRepo;
|
|
18
|
-
action: ActionRepo;
|
|
19
|
-
order: OrderRepo;
|
|
20
|
-
task: TaskRepo;
|
|
21
|
-
}) => Promise<void>;
|
|
22
|
-
export { placeOrderWithoutTransaction };
|