@chevre/domain 25.2.0-alpha.28 → 25.2.0-alpha.29

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.
@@ -155,6 +155,8 @@ export declare class OrderInTransactionRepo extends AcceptedOfferInReserveRepo {
155
155
  savePaymentMethodId(params: {
156
156
  id: string;
157
157
  paymentMethod: factory.transaction.placeOrder.IPaymentMethodByPaymentUrl;
158
+ }, options: {
159
+ savePaymentMethodIdInTransaction: boolean;
158
160
  }): Promise<void>;
159
161
  /**
160
162
  * 進行中取引に保管された採用済決済方法を検索する
@@ -281,26 +281,29 @@ class OrderInTransactionRepo extends acceptedOfferInReserve_1.AcceptedOfferInRes
281
281
  * 特定の進行中取引の決済方法IDを保管する
282
282
  * transactionsへの保管としてひとまず定義(2026-07-11~)
283
283
  */
284
- async savePaymentMethodId(params) {
284
+ async savePaymentMethodId(params, options) {
285
+ const { savePaymentMethodIdInTransaction } = options;
285
286
  const { paymentMethodId } = params.paymentMethod;
286
287
  if (typeof paymentMethodId !== 'string' || paymentMethodId === '') {
287
288
  throw new factory_1.factory.errors.ArgumentNull('paymentMethod.paymentMethodId');
288
289
  }
289
- await this.transactionModel.findOneAndUpdate({
290
- _id: { $eq: params.id },
291
- status: { $eq: factory_1.factory.transactionStatusType.InProgress }
292
- }, {
293
- $set: { 'object.paymentMethods': { paymentMethodId } }
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
- });
290
+ if (savePaymentMethodIdInTransaction) {
291
+ await this.transactionModel.findOneAndUpdate({
292
+ _id: { $eq: params.id },
293
+ status: { $eq: factory_1.factory.transactionStatusType.InProgress }
294
+ }, {
295
+ $set: { 'object.paymentMethods': { paymentMethodId } }
296
+ }, {
297
+ projection: { _id: 1 }
298
+ })
299
+ .lean()
300
+ .exec()
301
+ .then((doc) => {
302
+ if (doc === null) {
303
+ throw new factory_1.factory.errors.NotFound(factory_1.factory.transactionType.PlaceOrder);
304
+ }
305
+ });
306
+ }
304
307
  // 注文ドキュメントにも保管する(2026-07-12~)
305
308
  await this.orderModel.findOneAndUpdate({
306
309
  identifier: { $eq: params.id },
@@ -60,5 +60,7 @@ declare function publishPaymentUrl(params: {
60
60
  */
61
61
  identifier?: string;
62
62
  instrument: factory.action.trade.pay.IAcceptedPaymentMethodOfferAsInstrument[];
63
+ }, options: {
64
+ savePaymentMethodIdInTransaction: boolean;
63
65
  }): IPublishPaymentUrlOperation<Pick<PayTransactionService.IPublishPaymentUrlResult, 'paymentMethodId' | 'paymentUrl'>>;
64
66
  export { IPublishPaymentUrlRepos, publishPaymentUrl };
@@ -41,7 +41,7 @@ const factory_2 = require("./factory");
41
41
  /**
42
42
  * 外部決済ロケーションを発行する
43
43
  */
44
- function publishPaymentUrl(params) {
44
+ function publishPaymentUrl(params, options) {
45
45
  return async (repos, settings) => {
46
46
  const { paymentServiceType, purpose, project } = params;
47
47
  if (purpose.typeOf !== factory_1.factory.transactionType.PlaceOrder) {
@@ -107,7 +107,7 @@ function publishPaymentUrl(params) {
107
107
  await repos.orderInTransaction.savePaymentMethodId({
108
108
  id: transaction.id,
109
109
  paymentMethod: { paymentMethodId: result.paymentMethodId }
110
- });
110
+ }, options);
111
111
  return {
112
112
  paymentMethodId: result.paymentMethodId,
113
113
  paymentUrl: result.paymentUrl
@@ -36,10 +36,14 @@ function call(params) {
36
36
  const actionRepo = new acceptPay_1.AcceptPayActionRepo(connection);
37
37
  // const transactionProcessRepo = new TransactionProcessRepo(redisClient, { lockExpiresInSeconds: 120 });
38
38
  try {
39
+ const { savePaymentMethodIdInTransaction, project: _project, ...publishPaymentUrlParams } = params.data;
39
40
  await (0, any_1.publishPaymentUrl)({
40
- ...params.data,
41
+ ...publishPaymentUrlParams,
42
+ project: { id: params.project.id },
41
43
  instrument: (Array.isArray(params.data.instrument)) ? params.data.instrument : [],
42
44
  sameAs: { id: params.id }
45
+ }, {
46
+ savePaymentMethodIdInTransaction: savePaymentMethodIdInTransaction === true
43
47
  })({
44
48
  acceptPayAction: actionRepo,
45
49
  authorizeInvoiceAction: new authorizeInvoice_1.AuthorizeInvoiceActionRepo(connection),
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.10",
14
+ "@chevre/factory": "9.5.0-alpha.11",
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.28"
95
+ "version": "25.2.0-alpha.29"
96
96
  }