@chevre/domain 25.2.0-alpha.17 → 25.2.0-alpha.19

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.
Files changed (26) hide show
  1. package/lib/chevre/repo/mongoose/schemas/order.d.ts +4 -0
  2. package/lib/chevre/repo/mongoose/schemas/order.js +1 -0
  3. package/lib/chevre/repo/order.d.ts +2 -0
  4. package/lib/chevre/repo/orderInTransaction.d.ts +21 -0
  5. package/lib/chevre/repo/orderInTransaction.js +89 -0
  6. package/lib/chevre/repo/transaction/placeOrder.d.ts +0 -17
  7. package/lib/chevre/repo/transaction/placeOrder.js +0 -70
  8. package/lib/chevre/service/assetTransaction/pay/start/factory.js +3 -4
  9. package/lib/chevre/service/payment/any/authorize/fixTransactionNumber.d.ts +3 -2
  10. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.d.ts +4 -3
  11. package/lib/chevre/service/payment/any/authorize/handlePrePublishedPaymentMethodIdOnAuthorizing.js +3 -31
  12. package/lib/chevre/service/payment/any/authorize.js +1 -1
  13. package/lib/chevre/service/payment/any/invalidatePaymentUrl.d.ts +2 -0
  14. package/lib/chevre/service/payment/any/invalidatePaymentUrl.js +4 -66
  15. package/lib/chevre/service/payment/any/publishPaymentUrl.d.ts +2 -0
  16. package/lib/chevre/service/payment/any/publishPaymentUrl.js +2 -16
  17. package/lib/chevre/service/payment/any/voidPayTransaction.d.ts +2 -0
  18. package/lib/chevre/service/payment/any/voidPayTransaction.js +1 -23
  19. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.d.ts +1 -1
  20. package/lib/chevre/service/payment/creditCard/authorize/processAuthorizeCreditCard.js +5 -9
  21. package/lib/chevre/service/task/publishPaymentUrl.js +2 -2
  22. package/lib/chevre/service/task/voidPayTransaction.js +3 -7
  23. package/lib/chevre/service/transaction/placeOrder/confirm/validation.d.ts +5 -1
  24. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +9 -5
  25. package/lib/chevre/service/transaction/placeOrder/confirm.js +9 -3
  26. package/package.json +2 -2
@@ -7,6 +7,10 @@ type IDocType = Omit<factory.order.IOrder, 'id'> & {
7
7
  * 注文取引IDとして再定義(2026-06-22~)
8
8
  */
9
9
  identifier?: string;
10
+ /**
11
+ * 外部URL決済の場合に発行される決済方法IDとして定義(2026-07-12~)
12
+ */
13
+ paymentMethodId?: string;
10
14
  };
11
15
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
12
16
  type ISchemaDefinition = SchemaDefinition<IDocType>;
@@ -27,6 +27,7 @@ const schemaDefinition = {
27
27
  dateReturned: Date,
28
28
  orderedItem: [mongoose_1.SchemaTypes.Mixed],
29
29
  identifier: { type: String, required: true }, // 注文取引IDとして再定義(2026-06-22~)
30
+ paymentMethodId: { type: String, required: false }, // 注文取引から移行(2026-07-12~)
30
31
  // 以下廃止(2026-06-13~)
31
32
  // identifier: SchemaTypes.Mixed, // 廃止するためにMixed化(2026-06-12~)
32
33
  // isGift: Boolean,
@@ -135,6 +135,7 @@ export declare class OrderRepo {
135
135
  getCursor(conditions: any, projection: any): import("mongoose").Cursor<import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
136
136
  acceptedOffers?: factory.order.IAcceptedOffer[];
137
137
  identifier?: string;
138
+ paymentMethodId?: string;
138
139
  } & {
139
140
  _id: import("mongoose").Types.ObjectId;
140
141
  } & {
@@ -142,6 +143,7 @@ export declare class OrderRepo {
142
143
  }, import("mongoose").QueryOptions<IDocType>, (import("mongoose").Document<unknown, Record<string, never>, IDocType, import("./mongoose/virtuals").IVirtuals, {}> & Omit<factory.order.IOrder, "id"> & {
143
144
  acceptedOffers?: factory.order.IAcceptedOffer[];
144
145
  identifier?: string;
146
+ paymentMethodId?: string;
145
147
  } & {
146
148
  _id: import("mongoose").Types.ObjectId;
147
149
  } & {
@@ -62,6 +62,7 @@ export type IMinimizedAcceptedOffer = Pick<factory.order.IOptimizedAcceptedOffer
62
62
  */
63
63
  export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
64
64
  private readonly orderModel;
65
+ private readonly transactionModel;
65
66
  constructor(connection: Connection);
66
67
  createPlaceOrderIfNotExists(params: Pick<IOrderInTransaction, 'orderNumber' | 'project' | 'identifier' | 'broker' | 'seller' | 'customer'>): Promise<import("mongoose").UpdateWriteOpResult | undefined>;
67
68
  /**
@@ -147,6 +148,26 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
147
148
  */
148
149
  onlyPlaceOrder: boolean;
149
150
  }): Promise<import("mongoose").UpdateWriteOpResult>;
151
+ /**
152
+ * 特定の進行中取引の決済方法IDを保管する
153
+ * transactionsへの保管としてひとまず定義(2026-07-11~)
154
+ */
155
+ savePaymentMethodId(params: {
156
+ id: string;
157
+ paymentMethod: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
158
+ }): Promise<void>;
159
+ /**
160
+ * 進行中取引に保管された採用済決済方法を検索する
161
+ */
162
+ findInProgressPaymentMethodId(params: {
163
+ id: string;
164
+ }): Promise<string | undefined>;
165
+ /**
166
+ * 保管された採用済決済方法を検索する
167
+ */
168
+ findPaymentMethodId(params: {
169
+ id: string;
170
+ }): Promise<string | undefined>;
150
171
  deleteByIdentifier(params: {
151
172
  identifier: string;
152
173
  }): Promise<import("mongodb").DeleteResult>;
@@ -5,6 +5,7 @@ exports.OrderInTransactionRepo = void 0;
5
5
  const errorHandler_1 = require("../errorHandler");
6
6
  const factory_1 = require("../factory");
7
7
  const order_1 = require("./mongoose/schemas/order");
8
+ const transaction_1 = require("./mongoose/schemas/transaction");
8
9
  const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
9
10
  // const debug = createDebug('chevre-domain:repo:orderInTransaction');
10
11
  /**
@@ -12,9 +13,11 @@ const acceptedOfferInReserve_1 = require("./acceptedOfferInReserve");
12
13
  */
13
14
  class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInReserveRepo {
14
15
  orderModel;
16
+ transactionModel;
15
17
  constructor(connection) {
16
18
  super(connection);
17
19
  this.orderModel = connection.model(order_1.modelName, (0, order_1.createSchema)());
20
+ this.transactionModel = connection.model(transaction_1.modelName, (0, transaction_1.createSchema)());
18
21
  }
19
22
  async createPlaceOrderIfNotExists(params) {
20
23
  const { orderNumber, project, identifier, broker, seller, customer } = params;
@@ -274,6 +277,92 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
274
277
  }, { $set: { confirmationNumber } })
275
278
  .exec();
276
279
  }
280
+ /**
281
+ * 特定の進行中取引の決済方法IDを保管する
282
+ * transactionsへの保管としてひとまず定義(2026-07-11~)
283
+ */
284
+ async savePaymentMethodId(params) {
285
+ const { paymentMethodId } = params.paymentMethod;
286
+ if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
287
+ throw new factory_1.factory.errors.ArgumentNull('paymentMethod.paymentMethodId');
288
+ }
289
+ await this.transactionModel.findOneAndUpdate({
290
+ _id: { $eq: params.id },
291
+ status: { $eq: factory_1.factory.transactionStatusType.InProgress }
292
+ }, {
293
+ $set: { 'object.paymentMethods': params.paymentMethod }
294
+ }, {
295
+ projection: { _id: 1 }
296
+ })
297
+ .lean()
298
+ .exec()
299
+ .then((doc) => {
300
+ if (doc === null) {
301
+ throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
302
+ }
303
+ });
304
+ // 注文ドキュメントにも保管する(2026-07-12~)
305
+ await this.orderModel.findOneAndUpdate({
306
+ identifier: { $eq: params.id },
307
+ paymentMethodId: { $exists: false },
308
+ typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
309
+ }, { $set: { paymentMethodId: params.paymentMethod } }, { projection: { _id: 1 } })
310
+ .lean()
311
+ .exec()
312
+ .then((doc) => {
313
+ if (doc === null) {
314
+ throw new factory_1.factory.errors.NotFound('orderInTransaction');
315
+ }
316
+ });
317
+ }
318
+ /**
319
+ * 進行中取引に保管された採用済決済方法を検索する
320
+ */
321
+ async findInProgressPaymentMethodId(params) {
322
+ const doc = await this.transactionModel.findOne({
323
+ _id: { $eq: params.id },
324
+ typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
325
+ status: { $eq: factory_1.factory.transactionStatusType.InProgress }
326
+ }, { 'object.paymentMethods': 1 })
327
+ .lean()
328
+ .exec();
329
+ if (doc === null) {
330
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
331
+ }
332
+ return (typeof doc.object.paymentMethods?.paymentMethodId === 'string') ? doc.object.paymentMethods.paymentMethodId : undefined;
333
+ }
334
+ /**
335
+ * 保管された採用済決済方法を検索する
336
+ */
337
+ async findPaymentMethodId(params) {
338
+ const doc = await this.transactionModel.findOne({
339
+ _id: { $eq: params.id },
340
+ typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder }
341
+ }, { 'object.paymentMethods': 1 })
342
+ .lean()
343
+ .exec();
344
+ if (doc === null) {
345
+ throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
346
+ }
347
+ const paymentMethodId = doc.object.paymentMethods?.paymentMethodId;
348
+ if (typeof paymentMethodId === 'string') {
349
+ // 注文ドキュメントにも発行済の場合、同一性を検証(2026-07-12~)
350
+ const orderDoc = await this.orderModel.findOne({ identifier: { $eq: params.id } }, { paymentMethodId: 1 })
351
+ .lean()
352
+ .exec();
353
+ if (orderDoc === null) {
354
+ throw new factory_1.factory.errors.NotFound('orderInTransaction');
355
+ }
356
+ const paymentMethodIdByOrder = orderDoc.paymentMethodId;
357
+ if (typeof paymentMethodIdByOrder === 'string') {
358
+ console.log('paymentMethodId matched?', JSON.stringify(doc), JSON.stringify(orderDoc));
359
+ if (paymentMethodId !== paymentMethodIdByOrder) {
360
+ throw new factory_1.factory.errors.Internal('paymentMethodId not matched unexpectedly');
361
+ }
362
+ }
363
+ }
364
+ return (typeof paymentMethodId === 'string') ? paymentMethodId : undefined;
365
+ }
277
366
  async deleteByIdentifier(params) {
278
367
  return this.orderModel.deleteOne({
279
368
  typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
@@ -37,12 +37,6 @@ export declare class PlaceOrderRepo {
37
37
  }): Promise<(Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, IKeyOfProjection> & {
38
38
  id: string;
39
39
  })[]>;
40
- /**
41
- * 進行中取引に保管された採用済決済方法を検索する
42
- */
43
- findInProgressPaymentMethodId(params: {
44
- id: string;
45
- }): Promise<factory.transaction.placeOrder.IPaymentMethodByPaymentUrl | undefined>;
46
40
  /**
47
41
  * 取引期限変更
48
42
  */
@@ -51,17 +45,6 @@ export declare class PlaceOrderRepo {
51
45
  id: string;
52
46
  expires: Date;
53
47
  }): Promise<void>;
54
- /**
55
- * 特定の進行中取引を更新する(汎用)
56
- */
57
- findByIdAndUpdateInProgress(params: {
58
- id: string;
59
- update: {
60
- $set?: {
61
- 'object.paymentMethods'?: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
62
- };
63
- };
64
- }): Promise<void>;
65
48
  /**
66
49
  * 進行中取引のobjectに注文番号を保管する
67
50
  */
@@ -186,22 +186,6 @@ class PlaceOrderRepo {
186
186
  .lean()
187
187
  .exec();
188
188
  }
189
- /**
190
- * 進行中取引に保管された採用済決済方法を検索する
191
- */
192
- async findInProgressPaymentMethodId(params) {
193
- const doc = await this.transactionModel.findOne({
194
- _id: { $eq: params.id },
195
- typeOf: { $eq: factory_1.factory.transactionType.PlaceOrder },
196
- status: { $eq: factory_1.factory.transactionStatusType.InProgress }
197
- }, { 'object.paymentMethods': 1 })
198
- .lean() // 2024-08-26~
199
- .exec();
200
- if (doc === null) {
201
- throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${factory_1.factory.transactionType.PlaceOrder} ${factory_1.factory.transactionStatusType.InProgress} not found`);
202
- }
203
- return doc.object.paymentMethods;
204
- }
205
189
  // /**
206
190
  // * 取引の注文番号を検索する
207
191
  // */
@@ -272,60 +256,6 @@ class PlaceOrderRepo {
272
256
  throw new factory_1.factory.errors.NotFound(this.transactionModel.modelName, `${params.typeOf} ${factory_1.factory.transactionStatusType.InProgress} not found`);
273
257
  }
274
258
  }
275
- // /**
276
- // * 取引オブジェクトを更新
277
- // * 注文名称など
278
- // */
279
- // public async updateObject(params: {
280
- // typeOf: factory.transactionType.PlaceOrder;
281
- // id: string;
282
- // object?: {
283
- // name?: string;
284
- // };
285
- // }): Promise<void> {
286
- // const doc = await this.transactionModel.findOneAndUpdate(
287
- // {
288
- // _id: { $eq: params.id },
289
- // typeOf: { $eq: params.typeOf },
290
- // status: { $eq: factory.transactionStatusType.InProgress }
291
- // },
292
- // {
293
- // $set: {
294
- // ...(typeof params.object?.name === 'string') ? { 'object.name': params.object.name } : undefined
295
- // }
296
- // },
297
- // {
298
- // projection: { _id: 1 }
299
- // }
300
- // )
301
- // .lean<{ _id: ObjectId }>()
302
- // .exec();
303
- // if (doc === null) {
304
- // throw new factory.errors.NotFound(
305
- // this.transactionModel.modelName,
306
- // `${params.typeOf} ${factory.transactionStatusType.InProgress} not found`
307
- // );
308
- // }
309
- // }
310
- /**
311
- * 特定の進行中取引を更新する(汎用)
312
- */
313
- async findByIdAndUpdateInProgress(params) {
314
- await this.transactionModel.findOneAndUpdate({
315
- _id: { $eq: params.id },
316
- status: { $eq: factory_1.factory.transactionStatusType.InProgress }
317
- }, params.update, {
318
- // new: true,
319
- projection: { _id: 1 }
320
- })
321
- .lean()
322
- .exec()
323
- .then((doc) => {
324
- if (doc === null) {
325
- throw new factory_1.factory.errors.ArgumentNull(this.transactionModel.modelName);
326
- }
327
- });
328
- }
329
259
  /**
330
260
  * 進行中取引のobjectに注文番号を保管する
331
261
  */
@@ -82,7 +82,8 @@ function createStartParams(params, options) {
82
82
  break;
83
83
  }
84
84
  default:
85
- // no op
85
+ // no op
86
+ throw new factory_1.factory.errors.NotImplemented(`paymentServiceType: ${params.paymentServiceType} not implemented`);
86
87
  }
87
88
  // const informPaymentParams = createInformPaymentParams({
88
89
  // paymentService: <factory.service.paymentService.IService | undefined>params.paymentService
@@ -122,12 +123,10 @@ function createStartParams(params, options) {
122
123
  : paymentMethodType,
123
124
  amount: paymentMethodAmount, // MonetaryAmount対応(2023-08-14~)
124
125
  identifier: paymentMethodType, // 追加(2023-08-29~)
126
+ totalPaymentDue,
125
127
  ...(typeof params.object.paymentMethod?.description === 'string')
126
128
  ? { description: params.object.paymentMethod?.description }
127
129
  : undefined,
128
- ...(totalPaymentDue !== undefined)
129
- ? { totalPaymentDue: totalPaymentDue }
130
- : undefined,
131
130
  ...(typeof accountId === 'string') ? { accountId: accountId } : undefined,
132
131
  ...(typeof params.object.paymentMethod?.method === 'string')
133
132
  ? { method: params.object.paymentMethod?.method }
@@ -3,7 +3,8 @@ import type { AcceptPayActionRepo } from '../../../../repo/action/acceptPay';
3
3
  import type { AuthorizePaymentMethodActionRepo } from '../../../../repo/action/authorizePaymentMethod';
4
4
  import type { AuthorizationRepo } from '../../../../repo/authorization';
5
5
  import type { TicketRepo } from '../../../../repo/ticket';
6
- import type { ITransactionInProgress, PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
6
+ import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
7
+ import type { ITransactionInProgress } from '../../../../repo/transaction/placeOrder';
7
8
  import type { TransactionNumberRepo } from '../../../../repo/transactionNumber';
8
9
  import * as PayTransactionService from '../../../assetTransaction/pay';
9
10
  import { IInvoiceByTicketToken } from '../factory';
@@ -13,7 +14,7 @@ interface IFixTransactionNumberRepos {
13
14
  authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
14
15
  authorization: AuthorizationRepo;
15
16
  ticket: TicketRepo;
16
- placeOrder: PlaceOrderRepo;
17
+ orderInTransaction: OrderInTransactionRepo;
17
18
  transactionNumber: TransactionNumberRepo;
18
19
  }
19
20
  type IFixTransactionNumberOperation<T> = (repos: IFixTransactionNumberRepos) => Promise<T>;
@@ -3,7 +3,8 @@ import type { AcceptPayActionRepo } from '../../../../repo/action/acceptPay';
3
3
  import type { AuthorizePaymentMethodActionRepo } from '../../../../repo/action/authorizePaymentMethod';
4
4
  import type { AuthorizationRepo } from '../../../../repo/authorization';
5
5
  import type { TicketRepo } from '../../../../repo/ticket';
6
- import type { ITransactionInProgress, PlaceOrderRepo } from '../../../../repo/transaction/placeOrder';
6
+ import type { OrderInTransactionRepo } from '../../../../repo/orderInTransaction';
7
+ import type { ITransactionInProgress } from '../../../../repo/transaction/placeOrder';
7
8
  import * as PayTransactionService from '../../../assetTransaction/pay';
8
9
  import type { IInvoiceByTicketToken } from '../factory';
9
10
  type IObjectWithoutDetail = factory.action.authorize.paymentMethod.any.IObjectWithoutDetail;
@@ -17,7 +18,7 @@ interface IHandlePrePublishedPaymentMethodIdOnAuthorizingRepos {
17
18
  authorizePaymentMethodAction: AuthorizePaymentMethodActionRepo;
18
19
  authorization: AuthorizationRepo;
19
20
  ticket: TicketRepo;
20
- placeOrder: PlaceOrderRepo;
21
+ orderInTransaction: OrderInTransactionRepo;
21
22
  }
22
23
  /**
23
24
  * 決済承認前の決済採用アクションを参照する
@@ -29,9 +30,9 @@ declare function handlePrePublishedPaymentMethodIdOnAuthorizing(params: {
29
30
  }): (repos: IHandlePrePublishedPaymentMethodIdOnAuthorizingRepos) => Promise<{
30
31
  authorizeParams?: {
31
32
  creditCard: factory.action.authorize.paymentMethod.any.ICreditCard;
32
- paymentMethodByTransaction: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
33
33
  pendingPaymentAgencyTransaction: PayTransactionService.IPaymentAgencyTransaction;
34
34
  acceptAction2ticketResult?: IAcceptAction2ticketResult;
35
+ paymentMethodByTransaction?: never;
35
36
  };
36
37
  existingCompletedAuthorizeAction?: never;
37
38
  } | {
@@ -98,25 +98,8 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
98
98
  let existingCompletedAuthorizeAction;
99
99
  let acceptPayAction;
100
100
  // transaction.objectへのアクセス回避(2024-05-30~)
101
- // const paymentMethodByTransaction = transaction.object.paymentMethods;
102
- const paymentMethodByTransaction = await repos.placeOrder.findInProgressPaymentMethodId({ id: params.transaction.id });
103
- if (params.prePublishedPaymentMethodId === paymentMethodByTransaction?.paymentMethodId) {
104
- // check existence of acceptAction when authorizing payment(2024-06-01~)
105
- // acceptPayAction = (<Pick<IAcceptPayAction, 'object' | 'result' | 'id' | 'instrument'>[]>await repos.action.search<factory.actionType.AcceptAction>(
106
- // {
107
- // limit: 1,
108
- // page: 1,
109
- // project: { id: { $eq: params.transaction.project.id } },
110
- // typeOf: { $eq: factory.actionType.AcceptAction },
111
- // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
112
- // purpose: { id: { $in: [params.transaction.id] } },
113
- // object: {
114
- // transactionNumber: { $eq: params.prePublishedPaymentMethodId },
115
- // typeOf: { $eq: factory.assetTransactionType.Pay }
116
- // }
117
- // },
118
- // ['object', 'result', 'instrument']
119
- // )).shift();
101
+ const paymentMethodIdByTransaction = await repos.orderInTransaction.findInProgressPaymentMethodId({ id: params.transaction.id });
102
+ if (params.prePublishedPaymentMethodId === paymentMethodIdByTransaction) {
120
103
  acceptPayAction = (await repos.acceptPayAction.findCompletedAcceptActionsByTransactionNumber({
121
104
  project: { id: params.transaction.project.id },
122
105
  purpose: { id: params.transaction.id },
@@ -154,17 +137,6 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
154
137
  throw new factory_1.factory.errors.Argument('paymentMethodId', 'pendingPaymentAgencyTransaction not found');
155
138
  }
156
139
  // 既に承認済であれば何もしない(2023-05-15~)
157
- // const existingCompletedAuthorizeActions = <IAuthorizePaymentAction[]>
158
- // await repos.action.searchByPurpose<factory.actionType.AuthorizeAction>({
159
- // typeOf: factory.actionType.AuthorizeAction,
160
- // purpose: { id: params.transaction.id, typeOf: params.transaction.typeOf },
161
- // actionStatus: { $eq: factory.actionStatusType.CompletedActionStatus },
162
- // object: {
163
- // paymentMethodId: { $eq: params.prePublishedPaymentMethodId },
164
- // typeOf: { $eq: factory.action.authorize.paymentMethod.any.ResultType.Payment }
165
- // },
166
- // sort: { startDate: factory.sortType.Ascending }
167
- // });
168
140
  const existingCompletedAuthorizeActions = await repos.authorizePaymentMethodAction.findAuthorizePaymentMethodActionsByPurpose({
169
141
  purpose: { id: params.transaction.id, typeOf: params.transaction.typeOf },
170
142
  actionStatus: { $eq: factory_1.factory.actionStatusType.CompletedActionStatus },
@@ -185,7 +157,7 @@ function handlePrePublishedPaymentMethodIdOnAuthorizing(params) {
185
157
  acceptPayAction
186
158
  })(repos);
187
159
  return {
188
- authorizeParams: { creditCard, pendingPaymentAgencyTransaction, paymentMethodByTransaction, acceptAction2ticketResult }
160
+ authorizeParams: { creditCard, pendingPaymentAgencyTransaction, acceptAction2ticketResult }
189
161
  };
190
162
  }
191
163
  else {
@@ -78,7 +78,7 @@ function authorize(params) {
78
78
  authorizePaymentMethodAction: repos.authorizePaymentMethodAction,
79
79
  authorization: repos.authorization,
80
80
  ticket: repos.ticket,
81
- placeOrder: repos.placeOrder,
81
+ orderInTransaction: repos.orderInTransaction,
82
82
  transactionNumber: repos.transactionNumber
83
83
  });
84
84
  if (typeof fixTransactionNumberResult.id === 'string') {
@@ -6,6 +6,7 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
6
6
  import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
7
7
  import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
8
8
  import type { TaskRepo } from '../../../repo/task';
9
+ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
9
10
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
10
11
  interface IInvalidatePaymentUrlRepos {
11
12
  accountingReport: AccountingReportRepo;
@@ -16,6 +17,7 @@ interface IInvalidatePaymentUrlRepos {
16
17
  paymentService: PaymentServiceRepo;
17
18
  paymentServiceProvider: PaymentServiceProviderRepo;
18
19
  task: TaskRepo;
20
+ orderInTransaction: OrderInTransactionRepo;
19
21
  placeOrder: PlaceOrderRepo;
20
22
  }
21
23
  /**
@@ -25,14 +25,6 @@ function invalidatePaymentUrl(params) {
25
25
  // }
26
26
  // support multiple accept actions(2025-02-25~)
27
27
  let acceptPayActions = await repos.acceptPayAction.findAcceptActionsByPurpose({
28
- // project: { id: { $eq: transaction.project.id } },
29
- // typeOf: { $eq: factory.actionType.AcceptAction },
30
- // // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] }, // all statuses(2025-02-26~)
31
- // purpose: { id: { $in: [transaction.id] } },
32
- // object: {
33
- // // transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
34
- // typeOf: { $eq: factory.assetTransactionType.Pay }
35
- // }
36
28
  project: { id: transaction.project.id },
37
29
  purpose: { id: transaction.id },
38
30
  }, ['object']);
@@ -43,9 +35,10 @@ function invalidatePaymentUrl(params) {
43
35
  // support OrderCanceled(2025-02-25~)
44
36
  const orderCancelled = params.purpose.result?.order?.orderStatus === factory_1.factory.orderStatus.OrderCancelled;
45
37
  if (!orderCancelled) {
46
- const paymentMethodIdByPaymentUrl = transaction.object.paymentMethods?.paymentMethodId;
47
- if (typeof paymentMethodIdByPaymentUrl === 'string') {
48
- acceptPayActions = acceptPayActions.filter(({ object }) => object.transactionNumber !== paymentMethodIdByPaymentUrl);
38
+ // 確定取引の場合、注文に紐づいた決済方法IDは除外しなければいけない
39
+ const paymentMethodIdByTransaction = await repos.orderInTransaction.findPaymentMethodId({ id: transaction.id });
40
+ if (typeof paymentMethodIdByTransaction === 'string') {
41
+ acceptPayActions = acceptPayActions.filter(({ object }) => object.transactionNumber !== paymentMethodIdByTransaction);
49
42
  }
50
43
  }
51
44
  break;
@@ -106,60 +99,5 @@ function invalidatePaymentUrl(params) {
106
99
  if (invalidatePaymentUrlTasks.length > 0) {
107
100
  await repos.task.saveMany(invalidatePaymentUrlTasks, { emitImmediately: true });
108
101
  }
109
- // const paymentMethodIdByPaymentUrl = transaction.object.paymentMethods?.paymentMethodId;
110
- // if (typeof paymentMethodIdByPaymentUrl === 'string' && paymentMethodIdByPaymentUrl.length > 0) {
111
- // const acceptPayAction = (<Pick<IAcceptPayAction, 'object'>[]>await repos.action.search(
112
- // {
113
- // limit: 1,
114
- // page: 1,
115
- // project: { id: { $eq: transaction.project.id } },
116
- // typeOf: { $eq: factory.actionType.AcceptAction },
117
- // actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] },
118
- // purpose: { id: { $in: [transaction.id] } },
119
- // object: {
120
- // transactionNumber: { $eq: paymentMethodIdByPaymentUrl },
121
- // typeOf: { $eq: factory.assetTransactionType.Pay }
122
- // }
123
- // },
124
- // ['object']
125
- // )).shift();
126
- // if (acceptPayAction !== undefined) {
127
- // // const paymentMethodType = transaction.object.paymentMethods?.typeOf;
128
- // const paymentMethodType = acceptPayAction.object.object.paymentMethod.identifier;
129
- // if (typeof paymentMethodType === 'string' && paymentMethodType.length > 0) {
130
- // // chevreで決済URL無効化
131
- // await PayTransactionService.invalidatePaymentUrl({
132
- // project: transaction.project,
133
- // typeOf: factory.actionType.RefundAction,
134
- // agent: {
135
- // typeOf: transaction.seller.typeOf,
136
- // name: (typeof transaction.seller.name === 'string')
137
- // ? transaction.seller.name
138
- // : String(transaction.seller.name?.ja),
139
- // id: transaction.seller.id
140
- // },
141
- // recipient: {
142
- // typeOf: transaction.agent.typeOf,
143
- // id: transaction.agent.id,
144
- // name: transaction.agent.name
145
- // },
146
- // object: [{
147
- // typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
148
- // id: acceptPayAction.object.object.id,
149
- // paymentMethod: {
150
- // additionalProperty: [],
151
- // name: paymentMethodType,
152
- // typeOf: paymentMethodType,
153
- // paymentMethodId: paymentMethodIdByPaymentUrl
154
- // },
155
- // refundFee: 0
156
- // }],
157
- // purpose: { typeOf: transaction.typeOf, id: transaction.id },
158
- // instrument: [],
159
- // ...(typeof params.sameAs?.id === 'string') ? { sameAs: params.sameAs } : undefined
160
- // })(repos, settings);
161
- // }
162
- // }
163
- // }
164
102
  };
165
103
  }
@@ -7,6 +7,7 @@ import type { AuthorizationRepo } from '../../../repo/authorization';
7
7
  import type { EventRepo } from '../../../repo/event';
8
8
  import type { EventSeriesRepo } from '../../../repo/eventSeries';
9
9
  import type { IssuerRepo } from '../../../repo/issuer';
10
+ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
10
11
  import type { PaymentServiceRepo } from '../../../repo/paymentService';
11
12
  import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
12
13
  import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
@@ -22,6 +23,7 @@ interface IPublishPaymentUrlRepos {
22
23
  event: EventRepo;
23
24
  eventSeries: EventSeriesRepo;
24
25
  issuer: IssuerRepo;
26
+ orderInTransaction: OrderInTransactionRepo;
25
27
  paymentAccepted: SellerPaymentAcceptedRepo;
26
28
  paymentService: PaymentServiceRepo;
27
29
  paymentServiceProvider: PaymentServiceProviderRepo;
@@ -104,23 +104,9 @@ function publishPaymentUrl(params) {
104
104
  executor: (typeof taskId === 'string') ? { id: taskId } : {} // タスク関連付け(2024-05-22~)
105
105
  })(repos, settings);
106
106
  // 取引に保管
107
- const paymentMethodByPaymentUrl = {
108
- // typeOf: params.object.paymentMethod, // discontinue(2024-06-05~)
109
- paymentMethodId: result.paymentMethodId
110
- // paymentUrl: result.paymentUrl, // migrate to recipe(2024-06-05~)
111
- // issuedThrough: {
112
- // id: (typeof startParams.object.id === 'string') ? startParams.object.id : ''
113
- // } // migrate to acceptAction(2024-06-05~)
114
- // GMO IFを保管(2024-01-01~)
115
- // entryTranArgs: result.entryTranArgs, // migrate to recipe(2024-06-05~)
116
- // entryTranResult: result.entryTranResult, // migrate to recipe(2024-06-05~)
117
- // execTranArgs: result.execTranArgs, // migrate to recipe(2024-06-05~)
118
- // execTranResult: result.execTranResult, // migrate to recipe(2024-06-05~)
119
- // paymentMethod: startParams.object.paymentMethod // 拡張(2024-01-04~) // migrate to acceptAction(2024-06-05~)
120
- };
121
- await repos.placeOrder.findByIdAndUpdateInProgress({
107
+ await repos.orderInTransaction.savePaymentMethodId({
122
108
  id: transaction.id,
123
- update: { $set: { 'object.paymentMethods': paymentMethodByPaymentUrl } }
109
+ paymentMethod: { paymentMethodId: result.paymentMethodId }
124
110
  });
125
111
  return {
126
112
  paymentMethodId: result.paymentMethodId,
@@ -7,6 +7,7 @@ import type { PaymentServiceRepo } from '../../../repo/paymentService';
7
7
  import type { PaymentServiceProviderRepo } from '../../../repo/paymentServiceProvider';
8
8
  import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccepted';
9
9
  import type { TaskRepo } from '../../../repo/task';
10
+ import type { OrderInTransactionRepo } from '../../../repo/orderInTransaction';
10
11
  import type { PlaceOrderRepo } from '../../../repo/transaction/placeOrder';
11
12
  /**
12
13
  * 決済承認中止
@@ -29,6 +30,7 @@ declare function voidPayTransaction(params: factory.task.IData<factory.taskName.
29
30
  paymentService: PaymentServiceRepo;
30
31
  paymentServiceProvider: PaymentServiceProviderRepo;
31
32
  task: TaskRepo;
33
+ orderInTransaction: OrderInTransactionRepo;
32
34
  placeOrder: PlaceOrderRepo;
33
35
  }) => Promise<void>;
34
36
  export { voidPayTransaction, };
@@ -8,29 +8,7 @@ const processVoidPayTransaction_1 = require("./processVoidPayTransaction");
8
8
  * タスクから決済承認を取り消す
9
9
  */
10
10
  function voidPayTransaction(params) {
11
- return async (repos
12
- // settings: Settings
13
- ) => {
14
- // 決済承認アクション確認不要(2024-03-12~)
15
- // 決済承認アクションを検索
16
- // let authorizeActions = <factory.action.authorize.paymentMethod.any.IAction[]>
17
- // await repos.action.searchByPurpose({
18
- // typeOf: factory.actionType.AuthorizeAction,
19
- // purpose: {
20
- // typeOf: params.purpose.typeOf,
21
- // id: params.purpose.id
22
- // }
23
- // });
24
- // authorizeActions = authorizeActions.filter(
25
- // (a) => a.object.typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment
26
- // );
27
- // // Chevreを使用した承認を取り消し
28
- // const authorizeActionsWithChevre = authorizeActions.filter((a) => {
29
- // return a.instrument?.identifier === factory.action.authorize.paymentMethod.any.ServiceIdentifier.Chevre;
30
- // });
31
- // if (authorizeActionsWithChevre.length > 0) {
32
- // await processVoidPayTransaction(params)(repos);
33
- // }
11
+ return async (repos) => {
34
12
  await (0, processVoidPayTransaction_1.processVoidPayTransaction)(params)(repos);
35
13
  // 決済URL無効化もここで処理
36
14
  await (0, invalidatePaymentUrl_1.invalidatePaymentUrl)(params)(repos);
@@ -26,7 +26,7 @@ declare function processAuthorizeCreditCard(params: {
26
26
  callbackType3ds?: factory.service.paymentService.ICallbackType3ds;
27
27
  orderId: string;
28
28
  availableChannel: Pick<factory.serviceChannel.IServiceChannelCreditCard, 'credentials' | 'serviceUrl'>;
29
- object: factory.assetTransaction.pay.IPaymentMethod;
29
+ object: factory.assetTransaction.pay.IPaymentMethodWithoutDetail;
30
30
  /**
31
31
  * 決済URL発行処理かどうか
32
32
  */
@@ -15,6 +15,9 @@ function processAuthorizeCreditCard(params) {
15
15
  // const { cardSeq, memberId } = creditCard as IUnauthorizedCardOfMember; // 会員カード廃止(2026-04-07~)
16
16
  const { cardNo, cardPass, expire } = creditCard;
17
17
  const { token } = creditCard;
18
+ if (typeof params.object.amount !== 'number') {
19
+ throw new factory_1.factory.errors.Argument('object.amount', 'must be number');
20
+ }
18
21
  const retUrl = creditCard?.retUrl;
19
22
  // 3DS拡張(2024-01-02~)
20
23
  if (params.processPublishPaymentUrl === true && typeof retUrl === 'string' && retUrl.length > 0) {
@@ -32,13 +35,8 @@ function processAuthorizeCreditCard(params) {
32
35
  entryTranArgs = {
33
36
  shopId, shopPass, orderId,
34
37
  jobCd: gmo_service_1.GMO.factory.util.JobCd.Auth,
35
- amount: (typeof params.object.amount === 'number')
36
- ? params.object.amount
37
- : params.object.amount.value,
38
- // siteId: params.availableChannel.credentials?.siteId,
39
- // sitePass: params.availableChannel.credentials?.sitePass,
38
+ amount: params.object.amount,
40
39
  tdFlag: gmo_service_1.GMO.factory.util.TdFlag.Version2,
41
- // tdTenantName: '',
42
40
  tds2Type: gmo_service_1.GMO.factory.util.Tds2Type.Error
43
41
  };
44
42
  entryTranResult = await repos.creditCardService.entryTran(entryTranArgs);
@@ -65,9 +63,7 @@ function processAuthorizeCreditCard(params) {
65
63
  entryTranArgs = {
66
64
  shopId, shopPass, orderId,
67
65
  jobCd: gmo_service_1.GMO.factory.util.JobCd.Auth,
68
- amount: (typeof params.object.amount === 'number')
69
- ? params.object.amount
70
- : params.object.amount.value,
66
+ amount: params.object.amount,
71
67
  siteId: params.availableChannel.credentials?.siteId,
72
68
  sitePass: params.availableChannel.credentials?.sitePass
73
69
  };
@@ -9,7 +9,7 @@ const authorization_1 = require("../../repo/authorization");
9
9
  const event_1 = require("../../repo/event");
10
10
  const eventSeries_1 = require("../../repo/eventSeries");
11
11
  const issuer_1 = require("../../repo/issuer");
12
- // import { OrderInTransactionRepo } from '../../repo/orderInTransaction';
12
+ const orderInTransaction_1 = require("../../repo/orderInTransaction");
13
13
  // import { OrderNumberRepo } from '../../repo/orderNumber';
14
14
  const paymentService_1 = require("../../repo/paymentService");
15
15
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
@@ -48,7 +48,7 @@ function call(params) {
48
48
  event: new event_1.EventRepo(connection),
49
49
  eventSeries: new eventSeries_1.EventSeriesRepo(connection),
50
50
  issuer: new issuer_1.IssuerRepo(connection),
51
- // orderInTransaction: new OrderInTransactionRepo(connection),
51
+ orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
52
52
  // orderNumber: new OrderNumberRepo({ connection }),
53
53
  paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
54
54
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
@@ -2,7 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.call = call;
4
4
  const accountingReport_1 = require("../../repo/accountingReport");
5
- // import { ActionRepo } from '../../repo/action';
6
5
  const acceptPay_1 = require("../../repo/action/acceptPay");
7
6
  const authorizePaymentMethod_1 = require("../../repo/action/authorizePaymentMethod");
8
7
  const assetTransaction_1 = require("../../repo/assetTransaction");
@@ -10,8 +9,8 @@ const paymentService_1 = require("../../repo/paymentService");
10
9
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
11
10
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
12
11
  const task_1 = require("../../repo/task");
12
+ const orderInTransaction_1 = require("../../repo/orderInTransaction");
13
13
  const placeOrder_1 = require("../../repo/transaction/placeOrder");
14
- // import { TransactionRepo } from '../../repo/transaction';
15
14
  const any_1 = require("../payment/any");
16
15
  /**
17
16
  * タスク実行関数
@@ -24,7 +23,6 @@ function call(params) {
24
23
  sameAs: { id: params.id }
25
24
  })({
26
25
  accountingReport: new accountingReport_1.AccountingReportRepo(connection),
27
- // action: new ActionRepo(connection),
28
26
  acceptPayAction: new acceptPay_1.AcceptPayActionRepo(connection),
29
27
  authorizePaymentMethodAction: new authorizePaymentMethod_1.AuthorizePaymentMethodActionRepo(connection),
30
28
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
@@ -32,10 +30,8 @@ function call(params) {
32
30
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
33
31
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(connection),
34
32
  task: new task_1.TaskRepo(connection),
33
+ orderInTransaction: new orderInTransaction_1.OrderInTransactionRepo(connection),
35
34
  placeOrder: new placeOrder_1.PlaceOrderRepo(connection)
36
- // transaction: new TransactionRepo(connection)
37
- }
38
- // settings
39
- );
35
+ });
40
36
  };
41
37
  }
@@ -6,7 +6,11 @@ export { IAcceptPayAction, IAuthorizeEventServiceOffer, IAuthorizePaymentAction,
6
6
  /**
7
7
  * 取引が確定可能な状態かどうかをチェックする
8
8
  */
9
- export declare function validateTransaction(transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'object'>, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'priceSpecification'>[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer): void;
9
+ export declare function validateTransaction(transaction: {
10
+ id: string;
11
+ }, acceptPayActions: IAcceptPayAction[], authorizePaymentActions: IAuthorizePaymentAction[], authorizeEventServiceOfferActions: Pick<IAuthorizeEventServiceOffer, 'id' | 'result'>[], eventReservationAcceptedOffers: Pick<factory.order.IAcceptedOffer, 'itemOffered' | 'priceSpecification'>[], payTransactions: IPayTransaction[], customer: factory.order.ICustomer, options: {
12
+ paymentMethodIdByTransaction?: string;
13
+ }): void;
10
14
  /**
11
15
  * 注文オファー数検証
12
16
  */
@@ -21,8 +21,8 @@ const debug = (0, debug_1.default)('chevre-domain:service:transaction:placeOrder
21
21
  /**
22
22
  * 取引が確定可能な状態かどうかをチェックする
23
23
  */
24
- function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions, eventReservationAcceptedOffers, payTransactions, customer) {
25
- // validateProfile(transaction);
24
+ function validateTransaction(transaction, acceptPayActions, authorizePaymentActions, authorizeEventServiceOfferActions, eventReservationAcceptedOffers, payTransactions, customer, options) {
25
+ const { paymentMethodIdByTransaction } = options;
26
26
  validateProfile({ customer });
27
27
  (0, validatePrice_1.validatePrice)(authorizePaymentActions, authorizeEventServiceOfferActions);
28
28
  // 請求のreferencesOrder検証(2025-11-23~)
@@ -61,7 +61,7 @@ function validateTransaction(transaction, acceptPayActions, authorizePaymentActi
61
61
  });
62
62
  }
63
63
  // 決済URLが発行されている場合、検証
64
- validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActions);
64
+ validatePaymentUrl({ paymentMethodIdByTransaction, acceptPayActions, authorizePaymentActions });
65
65
  }
66
66
  function findMovieTicketPaymentMethodTypesFromTransaction(authorizePaymentActions, eventReservationAcceptedOffers) {
67
67
  const paymentMethodTypes = [];
@@ -106,9 +106,11 @@ function validateProfile(params) {
106
106
  throw new factory_1.factory.errors.Argument('Transaction', 'customer name required');
107
107
  }
108
108
  }
109
- function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActions) {
109
+ function validatePaymentUrl(params) {
110
+ const { paymentMethodIdByTransaction, acceptPayActions, authorizePaymentActions } = params;
110
111
  // 決済URLが発行されている場合、検証
111
- const paymentMethodId = transaction.object.paymentMethods?.paymentMethodId;
112
+ const paymentMethodId = paymentMethodIdByTransaction;
113
+ debug('validatePaymentUrl: paymentMethodIdByTransaction:', paymentMethodIdByTransaction);
112
114
  if (typeof paymentMethodId === 'string' && paymentMethodId.length > 0) {
113
115
  // check existing accept action(2025-02-26~)
114
116
  const acceptActionExists = acceptPayActions.some(({ object, result }) => {
@@ -116,6 +118,7 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
116
118
  && result?.paymentMethodId === paymentMethodId
117
119
  && typeof result?.paymentUrl === 'string';
118
120
  });
121
+ debug('validatePaymentUrl: acceptActionExists:', acceptActionExists);
119
122
  if (!acceptActionExists) {
120
123
  throw new factory_1.factory.errors.NotFound(factory_1.factory.actionType.AcceptAction);
121
124
  }
@@ -127,6 +130,7 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
127
130
  : undefined;
128
131
  return resultAsInvoice?.paymentMethodId === paymentMethodId;
129
132
  });
133
+ debug('validatePaymentUrl: authorizePaymentAction4paymentUrlExists:', authorizePaymentAction4paymentUrlExists);
130
134
  if (!authorizePaymentAction4paymentUrlExists) {
131
135
  throw new factory_1.factory.errors.Argument('Transaction', 'Payment for published payment URL required');
132
136
  }
@@ -82,10 +82,12 @@ function confirm(params, options) {
82
82
  // if (typeof orderNumber !== 'string' || orderNumber === '') {
83
83
  // throw new factory.errors.Argument('transactionId', 'orderNumber not issued');
84
84
  // }
85
+ // 注文に決済方法IDが発行済か確認(2026-07-12)
86
+ const paymentMethodIdByTransaction = await repos.orderInTransaction.findPaymentMethodId({ id: params.id });
85
87
  // 取引に対する全ての承認アクションをマージ
86
88
  const completedAuthorizeActions = await searchAuthorizeActions(params)(repos);
87
89
  let acceptPayActions = [];
88
- if (typeof transaction.object.paymentMethods?.paymentMethodId === 'string') {
90
+ if (typeof paymentMethodIdByTransaction === 'string') {
89
91
  acceptPayActions = await searchAcceptPayActions(params)(repos);
90
92
  }
91
93
  // 必要あらば注文コード発行(2024-02-05~)
@@ -149,7 +151,8 @@ function confirm(params, options) {
149
151
  authorizePaymentActions, authorizeEventServiceOfferActions,
150
152
  acceptedOffers, payTransactions, customer,
151
153
  ...(typeof code === 'string') ? { code } : undefined,
152
- ...((Array.isArray(unitPriceOfferConditions)) && { unitPriceOfferConditions })
154
+ ...((Array.isArray(unitPriceOfferConditions)) && { unitPriceOfferConditions }),
155
+ paymentMethodIdByTransaction
153
156
  }, options);
154
157
  // ポストアクションを作成
155
158
  const setting = await repos.setting.findOne({ project: { id: { $eq: '*' } } }, ['defaultSenderEmail']);
@@ -321,7 +324,10 @@ function createResult(params, options) {
321
324
  }
322
325
  });
323
326
  // 取引の確定条件が全て整っているかどうか確認
324
- (0, validation_1.validateTransaction)(transaction, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions, eventReservationAcceptedOffers, params.payTransactions, params.customer);
327
+ const { paymentMethodIdByTransaction } = params;
328
+ (0, validation_1.validateTransaction)({ id: transaction.id }, params.acceptPayActions, params.authorizePaymentActions, params.authorizeEventServiceOfferActions, eventReservationAcceptedOffers, params.payTransactions, params.customer, {
329
+ ...((typeof paymentMethodIdByTransaction === 'string') && { paymentMethodIdByTransaction })
330
+ });
325
331
  const { paymentMethods, price } = (0, factory_2.createPaymentMethods)({ authorizePaymentActions: params.authorizePaymentActions });
326
332
  const orderedItem = (0, orderedItem_1.acceptedOffers2orderedItem)({
327
333
  eventReservationAcceptedOffers
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.5.0-alpha.5",
14
+ "@chevre/factory": "9.5.0-alpha.6",
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.2.0-alpha.17"
94
+ "version": "25.2.0-alpha.19"
95
95
  }