@chevre/domain 25.2.0-alpha.31 → 25.2.0-alpha.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/chevre/repo/order.d.ts +0 -733
- package/lib/chevre/repo/order.js +20 -13
- package/lib/chevre/repo/orderInTransaction.d.ts +8 -1
- package/lib/chevre/repo/transaction.d.ts +2 -2
- package/lib/chevre/service/assetTransaction/pay/start/factory.d.ts +1 -1
- package/lib/chevre/service/assetTransaction/pay/start.d.ts +1 -1
- package/lib/chevre/service/offer/event/authorize/factory.d.ts +0 -2
- package/lib/chevre/service/offer/event/authorize/factory.js +90 -82
- package/lib/chevre/service/offer/event/authorize.d.ts +0 -4
- package/lib/chevre/service/offer/event/authorize.js +1 -1
- package/lib/chevre/service/order/onOrderStatusChanged/onOrderProcessing.js +3 -2
- package/lib/chevre/service/payment/any/factory.d.ts +1 -1
- package/lib/chevre/service/task/authorizePayment.js +3 -1
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts +28 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js +11 -12
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.d.ts +4 -2
- package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions.js +6 -6
- package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts +32 -4
- package/lib/chevre/service/transaction/placeOrder/confirm.d.ts +6 -4
- package/lib/chevre/service/transaction/placeOrder/confirm.js +2 -2
- package/package.json +2 -2
package/lib/chevre/repo/order.js
CHANGED
|
@@ -848,19 +848,26 @@ class OrderRepo {
|
|
|
848
848
|
})
|
|
849
849
|
.exec();
|
|
850
850
|
}
|
|
851
|
-
async savePaymentMethodId4migaration(params
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
}
|
|
851
|
+
// public async savePaymentMethodId4migaration(params: {
|
|
852
|
+
// id: string;
|
|
853
|
+
// paymentMethod: IPaymentMethodByPaymentUrl;
|
|
854
|
+
// }) {
|
|
855
|
+
// const { paymentMethodId } = params.paymentMethod;
|
|
856
|
+
// if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
|
|
857
|
+
// throw new factory.errors.ArgumentNull('paymentMethod.paymentMethodId');
|
|
858
|
+
// }
|
|
859
|
+
// // 注文ドキュメントにも保管する(2026-07-12~)
|
|
860
|
+
// return this.orderModel.findOneAndUpdate(
|
|
861
|
+
// {
|
|
862
|
+
// identifier: { $eq: params.id },
|
|
863
|
+
// paymentMethodId: { $exists: false }
|
|
864
|
+
// },
|
|
865
|
+
// { $set: { paymentMethodId } },
|
|
866
|
+
// { projection: { _id: 1 } }
|
|
867
|
+
// )
|
|
868
|
+
// .lean()
|
|
869
|
+
// .exec();
|
|
870
|
+
// }
|
|
864
871
|
async aggregateOrder(params) {
|
|
865
872
|
const matchConditions = {
|
|
866
873
|
orderDate: {
|
|
@@ -57,6 +57,13 @@ export type IMinimizedAcceptedOffer = Pick<factory.order.IOptimizedAcceptedOffer
|
|
|
57
57
|
priceSpecification?: never;
|
|
58
58
|
name?: never;
|
|
59
59
|
};
|
|
60
|
+
export interface IPaymentMethodByPaymentUrl {
|
|
61
|
+
/**
|
|
62
|
+
* 決済採用時に発行済の決済方法ID
|
|
63
|
+
* 決済承認時に指定が可能
|
|
64
|
+
*/
|
|
65
|
+
paymentMethodId: string;
|
|
66
|
+
}
|
|
60
67
|
/**
|
|
61
68
|
* 取引中注文リポジトリ
|
|
62
69
|
*/
|
|
@@ -154,7 +161,7 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
|
|
|
154
161
|
*/
|
|
155
162
|
savePaymentMethodId(params: {
|
|
156
163
|
id: string;
|
|
157
|
-
paymentMethod:
|
|
164
|
+
paymentMethod: IPaymentMethodByPaymentUrl;
|
|
158
165
|
}, options: {
|
|
159
166
|
savePaymentMethodIdInTransaction: boolean;
|
|
160
167
|
}): Promise<void>;
|
|
@@ -144,7 +144,7 @@ export declare class TransactionRepo {
|
|
|
144
144
|
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
145
145
|
status: factory.transactionStatusType;
|
|
146
146
|
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
147
|
-
potentialActions?:
|
|
147
|
+
potentialActions?: undefined;
|
|
148
148
|
} & {
|
|
149
149
|
_id: import("mongoose").Types.ObjectId;
|
|
150
150
|
} & {
|
|
@@ -182,7 +182,7 @@ export declare class TransactionRepo {
|
|
|
182
182
|
agent: import("@chevre/factory/lib/chevre/transaction/placeOrder").IAgent;
|
|
183
183
|
status: factory.transactionStatusType;
|
|
184
184
|
tasksExportAction?: import("@chevre/factory/lib/chevre/transaction").ITasksExportAction | undefined;
|
|
185
|
-
potentialActions?:
|
|
185
|
+
potentialActions?: undefined;
|
|
186
186
|
} & {
|
|
187
187
|
_id: import("mongoose").Types.ObjectId;
|
|
188
188
|
} & {
|
|
@@ -20,7 +20,7 @@ export declare function createStartParams(params: factory.assetTransaction.pay.I
|
|
|
20
20
|
*/
|
|
21
21
|
id: string;
|
|
22
22
|
}[];
|
|
23
|
-
instrument: factory.action.trade.pay.
|
|
23
|
+
instrument: factory.action.trade.pay.IPayTransactionInstrument[];
|
|
24
24
|
}, options: {
|
|
25
25
|
checkedAction: {
|
|
26
26
|
id: string;
|
|
@@ -44,7 +44,7 @@ export { IPaymentAgencyTransaction };
|
|
|
44
44
|
* 取引開始
|
|
45
45
|
*/
|
|
46
46
|
export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail & {
|
|
47
|
-
instrument: factory.action.trade.pay.
|
|
47
|
+
instrument: factory.action.trade.pay.IPayTransactionInstrument[];
|
|
48
48
|
}, options: {
|
|
49
49
|
pendingPaymentAgencyTransaction?: IPaymentAgencyTransaction;
|
|
50
50
|
/**
|
|
@@ -27,8 +27,6 @@ declare function acceptedOffers2authorizeResult(params: {
|
|
|
27
27
|
acceptedOffers4result: IResultAcceptedOffer[];
|
|
28
28
|
noOfferSpecified: boolean;
|
|
29
29
|
ticketOffers: factory.product.ITicketOffer[];
|
|
30
|
-
}, options: {
|
|
31
|
-
useLegacyAuthorizeOfferResult: boolean;
|
|
32
30
|
}): factory.action.authorize.offer.eventService.IResult & {
|
|
33
31
|
onlyPrice?: boolean;
|
|
34
32
|
};
|
|
@@ -144,93 +144,101 @@ function acceptedOffers2amount(params) {
|
|
|
144
144
|
});
|
|
145
145
|
return amount;
|
|
146
146
|
}
|
|
147
|
-
function acceptedOffers2programMembershipUsed(params
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
147
|
+
// function acceptedOffers2programMembershipUsed(params: {
|
|
148
|
+
// acceptedOffers: IResultAcceptedOffer[];
|
|
149
|
+
// }): factory.action.authorize.offer.eventService.IAggregateProgramMembershipUsed {
|
|
150
|
+
// const programMembershipUsed: factory.action.authorize.offer.eventService.IAggregateProgramMembershipUsed = [];
|
|
151
|
+
// const permitIdentifiers: string[] = [];
|
|
152
|
+
// params.acceptedOffers.forEach(
|
|
153
|
+
// ({ itemOffered }) => {
|
|
154
|
+
// if (itemOffered.programMembershipUsed?.typeOf === factory.programMembership.ProgramMembershipType.ProgramMembership) {
|
|
155
|
+
// // メンバーシップコードに対してユニークに集計
|
|
156
|
+
// if (!permitIdentifiers.includes(itemOffered.programMembershipUsed.identifier)) {
|
|
157
|
+
// permitIdentifiers.push(itemOffered.programMembershipUsed.identifier);
|
|
158
|
+
// const issuedThroughTypeOf = itemOffered.programMembershipUsed.issuedThrough.typeOf;
|
|
159
|
+
// if (issuedThroughTypeOf === factory.service.paymentService.PaymentServiceType.FaceToFace) {
|
|
160
|
+
// programMembershipUsed.push({
|
|
161
|
+
// typeOf: factory.permit.PermitType.Permit,
|
|
162
|
+
// identifier: itemOffered.programMembershipUsed.identifier,
|
|
163
|
+
// issuedThrough: { typeOf: issuedThroughTypeOf }
|
|
164
|
+
// });
|
|
165
|
+
// } else {
|
|
166
|
+
// programMembershipUsed.push({
|
|
167
|
+
// typeOf: factory.permit.PermitType.Permit,
|
|
168
|
+
// identifier: itemOffered.programMembershipUsed.identifier,
|
|
169
|
+
// issuedThrough: { typeOf: issuedThroughTypeOf, id: itemOffered.programMembershipUsed.issuedThrough.id }
|
|
170
|
+
// });
|
|
171
|
+
// }
|
|
172
|
+
// }
|
|
173
|
+
// }
|
|
174
|
+
// }
|
|
175
|
+
// );
|
|
176
|
+
// return programMembershipUsed;
|
|
177
|
+
// }
|
|
178
|
+
function acceptedOffers2authorizeResult(params) {
|
|
179
|
+
const { acceptedOffers4result, noOfferSpecified,
|
|
180
|
+
// ticketOffers
|
|
181
|
+
} = params;
|
|
182
|
+
// let offers: factory.action.authorize.offer.eventService.IAcceptedOfferInResult[] | undefined;
|
|
180
183
|
let price;
|
|
181
|
-
let programMembershipUsed = [];
|
|
184
|
+
// let programMembershipUsed: factory.action.authorize.offer.eventService.IAggregateProgramMembershipUsed = [];
|
|
182
185
|
if (!noOfferSpecified) {
|
|
183
186
|
price = acceptedOffers2amount({ acceptedOffers: acceptedOffers4result }); // オファー指定の場合のみ金額計算(2023-11-27~)
|
|
184
|
-
programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
|
|
187
|
+
// programMembershipUsed = acceptedOffers2programMembershipUsed({ acceptedOffers: acceptedOffers4result });
|
|
185
188
|
// オファーIDごとに集計
|
|
186
|
-
const offerIds = [...new Set(acceptedOffers4result.map((o) => String(o.id)))];
|
|
187
|
-
//
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
if (useLegacyAuthorizeOfferResult) {
|
|
216
|
-
return {
|
|
217
|
-
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
218
|
-
// priceCurrency, // discontinue(2026-07-06~)
|
|
219
|
-
// amount: [], // discontinue(2026-07-06~)
|
|
220
|
-
itemOffered: {
|
|
221
|
-
serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
222
|
-
},
|
|
223
|
-
...(typeof price === 'number') ? { price } : undefined,
|
|
224
|
-
...(Array.isArray(offers)) ? { offers } : undefined
|
|
225
|
-
};
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
return {
|
|
229
|
-
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
230
|
-
onlyPrice: true,
|
|
231
|
-
...(typeof price === 'number') ? { price } : undefined,
|
|
232
|
-
};
|
|
189
|
+
// const offerIds = [...new Set(acceptedOffers4result.map((o) => String(o.id)))];
|
|
190
|
+
// offers = offerIds.map<factory.action.authorize.offer.eventService.IAcceptedOfferInResult>((offerId) => {
|
|
191
|
+
// const acceptedOffer = ticketOffers.find(({ id }) => id === offerId);
|
|
192
|
+
// if (acceptedOffer === undefined) {
|
|
193
|
+
// throw new factory.errors.Internal(`acceptedOffer not found [id:${offerId}]`);
|
|
194
|
+
// }
|
|
195
|
+
// const amountOfThisGood: number = acceptedOffers4result.filter(({ id }) => id === offerId).length;
|
|
196
|
+
// // const amountOfThisGood: number = acceptedOffers.filter(({ id }) => id === offerId).length;
|
|
197
|
+
// const { acceptedPaymentMethod, priceSpecification } = acceptedOffer;
|
|
198
|
+
// const unitPriceSpec = priceSpecification.priceComponent.find(
|
|
199
|
+
// (spec) => spec.typeOf === factory.priceSpecificationType.UnitPriceSpecification
|
|
200
|
+
// && (!Array.isArray(spec.appliesToAddOn)) // アドオン単価ではない
|
|
201
|
+
// ) as IUnitPriceSpecification | undefined;
|
|
202
|
+
// if (unitPriceSpec === undefined) {
|
|
203
|
+
// throw new factory.errors.Internal(`unitPriceSpec not found [id:${offerId}]`);
|
|
204
|
+
// }
|
|
205
|
+
// const { eligibleQuantity } = unitPriceSpec;
|
|
206
|
+
// return {
|
|
207
|
+
// id: offerId,
|
|
208
|
+
// includesObject: { amountOfThisGood },
|
|
209
|
+
// typeOf: factory.offerType.Offer,
|
|
210
|
+
// priceSpecification: {
|
|
211
|
+
// ...(eligibleQuantity !== undefined) ? { eligibleQuantity } : undefined,
|
|
212
|
+
// // ...(eligibleTransactionVolume !== undefined) ? { eligibleTransactionVolume } : undefined // discontinue(2026-07-05~)
|
|
213
|
+
// },
|
|
214
|
+
// ...(acceptedPaymentMethod !== undefined) ? { acceptedPaymentMethod } : undefined
|
|
215
|
+
// };
|
|
216
|
+
// });
|
|
233
217
|
}
|
|
218
|
+
// discontinue useLegacyAuthorizeOfferResult(2026-07-18~)
|
|
219
|
+
// if (useLegacyAuthorizeOfferResult) {
|
|
220
|
+
// return {
|
|
221
|
+
// typeOf: factory.offerType.AggregateOffer,
|
|
222
|
+
// // priceCurrency, // discontinue(2026-07-06~)
|
|
223
|
+
// // amount: [], // discontinue(2026-07-06~)
|
|
224
|
+
// itemOffered: {
|
|
225
|
+
// serviceOutput: { programMembershipUsed } // add programMembershipUsed required(2024-08-15~)
|
|
226
|
+
// },
|
|
227
|
+
// ...(typeof price === 'number') ? { price } : undefined,
|
|
228
|
+
// ...(Array.isArray(offers)) ? { offers } : undefined
|
|
229
|
+
// };
|
|
230
|
+
// } else {
|
|
231
|
+
// return {
|
|
232
|
+
// typeOf: factory.offerType.AggregateOffer,
|
|
233
|
+
// onlyPrice: true,
|
|
234
|
+
// ...(typeof price === 'number') ? { price } : undefined,
|
|
235
|
+
// };
|
|
236
|
+
// }
|
|
237
|
+
return {
|
|
238
|
+
typeOf: factory_1.factory.offerType.AggregateOffer,
|
|
239
|
+
onlyPrice: true,
|
|
240
|
+
...(typeof price === 'number') ? { price } : undefined,
|
|
241
|
+
};
|
|
234
242
|
}
|
|
235
243
|
function responseBody2acceptedOffers4result(params) {
|
|
236
244
|
let acceptedOffers4result = [];
|
|
@@ -78,7 +78,7 @@ function authorize(params, options) {
|
|
|
78
78
|
}
|
|
79
79
|
throw error;
|
|
80
80
|
}
|
|
81
|
-
const result = (0, factory_2.acceptedOffers2authorizeResult)({ acceptedOffers4result, noOfferSpecified, ticketOffers }
|
|
81
|
+
const result = (0, factory_2.acceptedOffers2authorizeResult)({ acceptedOffers4result, noOfferSpecified, ticketOffers });
|
|
82
82
|
await repos.authorizeOfferAction.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: result });
|
|
83
83
|
return { id: action.id, result };
|
|
84
84
|
};
|
|
@@ -23,7 +23,8 @@ function onOrderProcessing(params) {
|
|
|
23
23
|
debug('onOrderStatusChanged called.', params.order.orderNumber, params.order.orderStatus, params.order.orderDate);
|
|
24
24
|
let tasks;
|
|
25
25
|
let creatingCheckResourceTask;
|
|
26
|
-
const sendEmailMessageByOnOrderProcessing =
|
|
26
|
+
// const sendEmailMessageByOnOrderProcessing =
|
|
27
|
+
// params.placeOrderTransaction?.potentialActions?.order?.onOrderProcessing?.sendEmailMessage;
|
|
27
28
|
switch (params.order.orderStatus) {
|
|
28
29
|
case factory_1.factory.orderStatus.OrderProcessing:
|
|
29
30
|
tasks = (0, factory_2.createInformProcessingOrderTasks)(params.order, setting);
|
|
@@ -49,7 +50,7 @@ function onOrderProcessing(params) {
|
|
|
49
50
|
// OrderProcessingにおけるEメール送信に対応(2024-01-17~)
|
|
50
51
|
await (0, createSendEmailMessageTaskIfNotExist_1.createSendEmailMessageTaskIfNotExist)({
|
|
51
52
|
sendEmailMessage: [
|
|
52
|
-
|
|
53
|
+
// ...(Array.isArray(sendEmailMessageByOnOrderProcessing)) ? sendEmailMessageByOnOrderProcessing : []
|
|
53
54
|
],
|
|
54
55
|
order: params.order
|
|
55
56
|
})(repos);
|
|
@@ -46,7 +46,7 @@ export declare function creatPayTransactionStartParams(params: {
|
|
|
46
46
|
*/
|
|
47
47
|
instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
|
|
48
48
|
}): factory.assetTransaction.pay.IStartParamsWithoutDetail & {
|
|
49
|
-
instrument: factory.action.trade.pay.
|
|
49
|
+
instrument: factory.action.trade.pay.IPayTransactionInstrument[];
|
|
50
50
|
};
|
|
51
51
|
export declare function createMovieTicket(params: factory.action.trade.pay.IMovieTicket): factory.action.trade.pay.IMovieTicket;
|
|
52
52
|
/**
|
|
@@ -52,8 +52,10 @@ function call(params) {
|
|
|
52
52
|
const useCredentialsRepo = typeof paymentServiceId === 'string' && paymentServiceId !== ''
|
|
53
53
|
&& typeof credentialsExpireInSeconds === 'number' && credentialsExpireInSeconds > 0;
|
|
54
54
|
try {
|
|
55
|
+
const { instrument: _instrument, project: _project, ...authorizeParams } = params.data;
|
|
55
56
|
await (0, any_1.authorize)({
|
|
56
|
-
...
|
|
57
|
+
...authorizeParams,
|
|
58
|
+
project: { id: params.project.id },
|
|
57
59
|
instrument: (Array.isArray(params.data.instrument)) ? params.data.instrument : [],
|
|
58
60
|
sameAs: { id: params.id } // タスクIDを関連付け(2024-04-20~)
|
|
59
61
|
})({
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.d.ts
CHANGED
|
@@ -1,6 +1,32 @@
|
|
|
1
1
|
import { factory } from '../../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../../repo/setting';
|
|
3
3
|
import type { IOrderAsResult } from '../factory/result';
|
|
4
|
+
/**
|
|
5
|
+
* Eメール送信パラメータ
|
|
6
|
+
*/
|
|
7
|
+
interface ISendEmailMessageParams {
|
|
8
|
+
/**
|
|
9
|
+
* Eメールカスタマイズ
|
|
10
|
+
* メール本文をカスタマイズしたい場合、PUGテンプレートを指定
|
|
11
|
+
* 挿入変数として`order`を使用できます
|
|
12
|
+
* {@link https://pugjs.org/api/getting-started.html}
|
|
13
|
+
*/
|
|
14
|
+
object?: factory.creativeWork.message.email.ICustomization;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 取引確定後アクションパラメータ
|
|
18
|
+
*/
|
|
19
|
+
export interface IPotentialActionsParams {
|
|
20
|
+
order?: {
|
|
21
|
+
potentialActions?: {
|
|
22
|
+
sendOrder?: {
|
|
23
|
+
potentialActions?: {
|
|
24
|
+
sendEmailMessage?: ISendEmailMessageParams[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
}
|
|
4
30
|
export declare function createSendEmailMessageActions(params: {
|
|
5
31
|
order: IOrderAsResult & {
|
|
6
32
|
confirmationNumber: string;
|
|
@@ -12,8 +38,8 @@ export declare function createSendEmailMessageActions(params: {
|
|
|
12
38
|
customer: factory.order.ICustomer;
|
|
13
39
|
seller: Pick<factory.order.ISeller, 'name' | 'typeOf'>;
|
|
14
40
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
15
|
-
potentialActions?:
|
|
41
|
+
potentialActions?: IPotentialActionsParams;
|
|
16
42
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
17
43
|
emailMessages: factory.action.transfer.send.message.email.IObjectAsEmailMessage[];
|
|
18
|
-
sendEmailMessageActions: factory.transaction.placeOrder.IPotentialSendEmailMessageAction[];
|
|
19
44
|
}>;
|
|
45
|
+
export {};
|
package/lib/chevre/service/transaction/placeOrder/confirm/potentialActions/sendEmailMessage.js
CHANGED
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createSendEmailMessageActions = createSendEmailMessageActions;
|
|
4
4
|
const emailMessageBuilder_1 = require("../../../../../emailMessageBuilder");
|
|
5
|
-
const factory_1 = require("../../../../../factory");
|
|
6
5
|
async function createSendEmailMessageActions(params, setting) {
|
|
7
6
|
// 注文配送メール送信設定
|
|
8
7
|
const emailMessages = [];
|
|
9
|
-
const sendEmailMessageActions = [];
|
|
8
|
+
// const sendEmailMessageActions: factory.transaction.placeOrder.IPotentialSendEmailMessageAction[] = [];
|
|
10
9
|
const sendEmailMessageOnOrderSentParams = params.potentialActions?.order?.potentialActions?.sendOrder?.potentialActions?.sendEmailMessage;
|
|
11
10
|
if (Array.isArray(sendEmailMessageOnOrderSentParams)) {
|
|
12
11
|
// pugテンプレートに渡す変数を最小化(2026-06-19~)
|
|
@@ -27,16 +26,16 @@ async function createSendEmailMessageActions(params, setting) {
|
|
|
27
26
|
// ...(params.emailMessage !== undefined) ? { emailMessage: params.emailMessage } : undefined
|
|
28
27
|
}, setting);
|
|
29
28
|
emailMessages.push(emailMessage);
|
|
30
|
-
// 送信アクション最適化に対応(2024-04-29~)
|
|
31
|
-
const sendEmailMessageActionObject = {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
35
|
-
// optimize(2024-05-07~)
|
|
36
|
-
sendEmailMessageActions.push({
|
|
37
|
-
|
|
38
|
-
});
|
|
29
|
+
// // 送信アクション最適化に対応(2024-04-29~)
|
|
30
|
+
// const sendEmailMessageActionObject: factory.action.transfer.send.message.email.IObject = {
|
|
31
|
+
// identifier: emailMessage.identifier,
|
|
32
|
+
// typeOf: factory.creativeWorkType.EmailMessage
|
|
33
|
+
// };
|
|
34
|
+
// // optimize(2024-05-07~)
|
|
35
|
+
// sendEmailMessageActions.push({
|
|
36
|
+
// object: sendEmailMessageActionObject
|
|
37
|
+
// });
|
|
39
38
|
}));
|
|
40
39
|
}
|
|
41
|
-
return {
|
|
40
|
+
return { emailMessages };
|
|
42
41
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { factory } from '../../../../factory';
|
|
2
2
|
import type { ISetting } from '../../../../repo/setting';
|
|
3
|
+
import { IPotentialActionsParams } from './potentialActions/sendEmailMessage';
|
|
3
4
|
import { IOrderAsResult } from './factory/result';
|
|
5
|
+
export { IPotentialActionsParams };
|
|
4
6
|
/**
|
|
5
7
|
* 取引のポストアクションを作成する
|
|
6
8
|
*/
|
|
@@ -15,8 +17,8 @@ export declare function createPotentialActions(params: {
|
|
|
15
17
|
customer: factory.order.ICustomer;
|
|
16
18
|
seller: Pick<factory.order.ISeller, 'name' | 'typeOf'>;
|
|
17
19
|
paymentMethods: factory.order.IReferencedInvoice[];
|
|
18
|
-
potentialActions?:
|
|
20
|
+
potentialActions?: IPotentialActionsParams;
|
|
19
21
|
}, setting: Pick<ISetting, 'defaultSenderEmail'>): Promise<{
|
|
20
|
-
potentialActions
|
|
22
|
+
potentialActions?: never;
|
|
21
23
|
emailMessages: factory.creativeWork.message.email.ICreativeWork[];
|
|
22
24
|
}>;
|
|
@@ -7,13 +7,13 @@ const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
|
|
|
7
7
|
*/
|
|
8
8
|
async function createPotentialActions(params, setting) {
|
|
9
9
|
// 注文処理開始メール送信設定
|
|
10
|
-
const { emailMessages
|
|
10
|
+
const { emailMessages } = await (0, sendEmailMessage_1.createSendEmailMessageActions)(params, setting);
|
|
11
11
|
return {
|
|
12
12
|
emailMessages,
|
|
13
|
-
potentialActions: {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
13
|
+
// potentialActions: {
|
|
14
|
+
// order: {
|
|
15
|
+
// onOrderProcessing: { sendEmailMessage: sendEmailMessageActions } // optimize(2024-06-29~)
|
|
16
|
+
// }
|
|
17
|
+
// }
|
|
18
18
|
};
|
|
19
19
|
}
|
package/lib/chevre/service/transaction/placeOrder/confirm/prepareUnitPriceOfferConditions.d.ts
CHANGED
|
@@ -2,14 +2,42 @@ import type { OfferRepo } from '../../../../repo/offer/unitPriceInCatalog';
|
|
|
2
2
|
import { factory } from '../../../../factory';
|
|
3
3
|
export type IAuthorizeEventServiceOffer = factory.action.authorize.offer.eventService.IAction;
|
|
4
4
|
type IOrderAcceptedOffer = Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'offeredThrough' | 'serialNumber' | 'priceSpecification' | 'id'>;
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
interface IAcceptedOfferInResult extends Pick<factory.product.ITicketOffer, 'acceptedPaymentMethod' | 'id' | 'typeOf'> {
|
|
6
|
+
typeOf: factory.offerType.Offer;
|
|
7
|
+
id: string;
|
|
8
|
+
includesObject: {
|
|
9
|
+
amountOfThisGood: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* 取引確定時の検証に必要な情報のみ保管する
|
|
13
|
+
*/
|
|
14
|
+
priceSpecification?: Pick<factory.priceSpecification.unitPrice.IPriceSpecification, 'eligibleQuantity'>;
|
|
15
|
+
}
|
|
16
|
+
export type IAggregateProgramMembershipUsed = (factory.assetTransaction.reserve.IPermitIssuedThroughFaceToFace | factory.assetTransaction.reserve.IPermitIssuedThroughMembershipService)[];
|
|
17
|
+
type IPreparedResult = Pick<factory.action.authorize.offer.eventService.IResult, 'price' | 'typeOf'> & {
|
|
18
|
+
/**
|
|
19
|
+
* オファーIDごとの集計
|
|
20
|
+
*/
|
|
21
|
+
offers?: IAcceptedOfferInResult[];
|
|
22
|
+
itemOffered?: {
|
|
23
|
+
serviceOutput: {
|
|
24
|
+
/**
|
|
25
|
+
* programMembershipUsed required(2024-08-15~)
|
|
26
|
+
*/
|
|
27
|
+
programMembershipUsed: IAggregateProgramMembershipUsed;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
8
31
|
/**
|
|
9
32
|
* 注文ドキュメントと予約取引ドキュメントを参照することによって生成した、単価オファー検証条件
|
|
10
33
|
* 元々オファー承認アクションのresultに保管されていた
|
|
11
34
|
*/
|
|
12
|
-
type IPreparedUnitPriceOfferConditions = Pick<IAuthorizeEventServiceOffer, 'id'
|
|
35
|
+
type IPreparedUnitPriceOfferConditions = Pick<IAuthorizeEventServiceOffer, 'id'> & {
|
|
36
|
+
result?: IPreparedResult;
|
|
37
|
+
};
|
|
38
|
+
export declare function createAuthorizeOfferResultsExpected(params: {
|
|
39
|
+
authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
40
|
+
}): Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[];
|
|
13
41
|
declare function prepareUnitPriceOfferConditions(params: {
|
|
14
42
|
project: {
|
|
15
43
|
id: string;
|
|
@@ -13,6 +13,7 @@ import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
|
|
|
13
13
|
import { factory } from '../../../factory';
|
|
14
14
|
import { PlaceOrderFactory } from '../../../factory/transaction';
|
|
15
15
|
import { IOrderAsResult } from './confirm/factory/result';
|
|
16
|
+
import { IPotentialActionsParams } from './confirm/potentialActions';
|
|
16
17
|
interface IConfirmOperationRepos {
|
|
17
18
|
acceptPayAction: AcceptPayActionRepo;
|
|
18
19
|
authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
|
|
@@ -41,12 +42,13 @@ interface IConfirmOptions {
|
|
|
41
42
|
* 注文における最大CreditCardIF決済方法数
|
|
42
43
|
*/
|
|
43
44
|
maxNumCreditCardPaymentMethod: number;
|
|
45
|
+
}
|
|
46
|
+
type IConfirmParams = PlaceOrderFactory.IConfirmParams & {
|
|
44
47
|
/**
|
|
45
|
-
*
|
|
48
|
+
* 取引確定後アクション
|
|
46
49
|
*/
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
type IConfirmParams = PlaceOrderFactory.IConfirmParams;
|
|
50
|
+
potentialActions?: IPotentialActionsParams;
|
|
51
|
+
};
|
|
50
52
|
interface IConfirmResult {
|
|
51
53
|
order: Pick<IOrderAsResult, 'confirmationNumber' | 'orderNumber'>;
|
|
52
54
|
customer: factory.order.ICustomer;
|
|
@@ -155,7 +155,7 @@ function confirm(params, options) {
|
|
|
155
155
|
if (typeof setting?.defaultSenderEmail !== 'string') {
|
|
156
156
|
throw new factory_1.factory.errors.NotFound('setting.defaultSenderEmail');
|
|
157
157
|
}
|
|
158
|
-
const { emailMessages
|
|
158
|
+
const { emailMessages } = await (0, potentialActions_1.createPotentialActions)({
|
|
159
159
|
order: placingOrder, // createEmailMessageでのorder.acceptedOffersへの依存性を排除したのでこちらでよいはず(2024-02-21~)
|
|
160
160
|
customer,
|
|
161
161
|
seller,
|
|
@@ -178,7 +178,7 @@ function confirm(params, options) {
|
|
|
178
178
|
confirmationNumber: placingOrder.confirmationNumber
|
|
179
179
|
},
|
|
180
180
|
result: result,
|
|
181
|
-
...((options.useTransactionPotentialActions) && { potentialActions }) // support undefined(2026-07-17~)
|
|
181
|
+
// ...((options.useTransactionPotentialActions) && { potentialActions }) // support undefined(2026-07-17~)
|
|
182
182
|
});
|
|
183
183
|
}
|
|
184
184
|
catch (error) {
|
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": "
|
|
14
|
+
"@chevre/factory": "10.0.0-alpha.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",
|
|
@@ -92,5 +92,5 @@
|
|
|
92
92
|
"postversion": "git push origin --tags",
|
|
93
93
|
"prepublishOnly": "npm run clean && npm run build"
|
|
94
94
|
},
|
|
95
|
-
"version": "25.2.0-alpha.
|
|
95
|
+
"version": "25.2.0-alpha.33"
|
|
96
96
|
}
|