@chevre/domain 24.0.0-alpha.77 → 24.0.0-alpha.78

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 (39) hide show
  1. package/lib/chevre/repo/action/actionProcess.d.ts +1 -1
  2. package/lib/chevre/repo/assetTransaction.d.ts +3 -27
  3. package/lib/chevre/repo/assetTransaction.js +30 -30
  4. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +1 -1
  5. package/lib/chevre/repo/product.d.ts +0 -10
  6. package/lib/chevre/repo/product.js +28 -22
  7. package/lib/chevre/repo/task.d.ts +1 -1
  8. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  9. package/lib/chevre/service/assetTransaction/pay/start/factory.js +7 -7
  10. package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +18 -16
  11. package/lib/chevre/service/assetTransaction/refund.js +19 -17
  12. package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +0 -7
  13. package/lib/chevre/service/assetTransaction/registerService/factory.js +0 -31
  14. package/lib/chevre/service/assetTransaction/registerService/potentialActions.js +63 -91
  15. package/lib/chevre/service/assetTransaction/registerService.js +21 -20
  16. package/lib/chevre/service/assetTransaction/reserve/start.js +8 -8
  17. package/lib/chevre/service/offer/event/authorize.js +7 -32
  18. package/lib/chevre/service/offer/product.js +28 -28
  19. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.d.ts +1 -1
  20. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +26 -25
  21. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +18 -17
  22. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  23. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  24. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  25. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
  26. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
  27. package/lib/chevre/service/payment/factory.js +23 -23
  28. package/lib/chevre/service/product.js +16 -16
  29. package/lib/chevre/service/reserve/confirmReservation.js +19 -17
  30. package/lib/chevre/service/reserve/factory.d.ts +0 -6
  31. package/lib/chevre/service/reserve/factory.js +0 -59
  32. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +16 -15
  33. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +12 -10
  34. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +4 -4
  35. package/package.json +2 -2
  36. package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +0 -15
  37. package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +0 -44
  38. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -8
  39. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +0 -89
@@ -3,7 +3,7 @@ import { factory } from '../../factory';
3
3
  import { IModel as IActionModel } from '../mongoose/schemas/action';
4
4
  import { IModel as IActionRecipeModel } from '../mongoose/schemas/actionRecipe';
5
5
  export type IAction4transaction<T extends factory.actionType.AcceptAction | factory.actionType.AuthorizeAction> = T extends factory.actionType.AcceptAction ? factory.action.accept.coaOffer.IAction | factory.action.accept.pay.IAction : T extends factory.actionType.AuthorizeAction ? (factory.action.authorize.offer.eventService.IAction | factory.action.authorize.offer.product.IAction | factory.action.authorize.paymentMethod.any.IAction) : never;
6
- export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.MoneyTransfer ? factory.action.transfer.moneyTransfer.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
6
+ export type IAction<T extends factory.actionType> = T extends factory.actionType.OrderAction ? factory.action.trade.order.IAction : T extends factory.actionType.AcceptAction ? IAction4transaction<factory.actionType.AcceptAction> : T extends factory.actionType.AuthorizeAction ? factory.action.authorize.IAction<factory.action.authorize.IAttributes<any, any>> : T extends factory.actionType.CheckAction ? (factory.action.check.paymentMethod.movieTicket.IAction | factory.action.check.thing.IAction) : T extends factory.actionType.CreateAction ? factory.action.create.IAction : T extends factory.actionType.AddAction ? factory.action.update.add.IAction : T extends factory.actionType.ReplaceAction ? factory.action.update.replace.IAction : T extends factory.actionType.UpdateAction ? factory.action.update.update.IAction : T extends factory.actionType.InformAction ? factory.action.interact.inform.IAction<factory.action.interact.inform.IAttributes<factory.action.interact.inform.IObject>> & {
7
7
  error?: any;
8
8
  purpose?: never;
9
9
  } : factory.action.IAction<factory.action.IAttributes<T, any, any>>;
@@ -23,14 +23,14 @@ export interface IAggregateReserve {
23
23
  statuses: IStatus[];
24
24
  }
25
25
  type IKeyOfProjection<T extends factory.assetTransactionType> = keyof Pick<factory.assetTransaction.ITransaction<factory.assetTransactionType>, 'agent' | 'endDate' | 'expires' | 'project' | 'startDate' | 'status' | 'typeOf' | 'transactionNumber'> | Exclude<keyof factory.assetTransaction.ITransaction<T>, 'id'>;
26
- type AvailableAssetTransactionType = factory.assetTransactionType.CancelReservation | factory.assetTransactionType.MoneyTransfer | factory.assetTransactionType.Pay | factory.assetTransactionType.Refund | factory.assetTransactionType.RegisterService | factory.assetTransactionType.Reserve;
26
+ type AvailableAssetTransactionType = factory.assetTransactionType.CancelReservation | factory.assetTransactionType.Pay | factory.assetTransactionType.Refund | factory.assetTransactionType.RegisterService | factory.assetTransactionType.Reserve;
27
27
  /**
28
28
  * 資産取引リポジトリ
29
29
  */
30
30
  export declare class AssetTransactionRepo {
31
31
  private readonly transactionModel;
32
32
  constructor(connection: Connection);
33
- static CREATE_MONGO_CONDITIONS(params: factory.assetTransaction.ISearchConditions<factory.assetTransactionType>): FilterQuery<import("@chevre/factory/lib/chevre/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/registerService").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction>[];
33
+ static CREATE_MONGO_CONDITIONS(params: factory.assetTransaction.ISearchConditions<factory.assetTransactionType>): FilterQuery<import("@chevre/factory/lib/chevre/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/registerService").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction>[];
34
34
  /**
35
35
  * 取引を開始する
36
36
  */
@@ -124,7 +124,7 @@ export declare class AssetTransactionRepo {
124
124
  $in: factory.transactionStatusType[];
125
125
  };
126
126
  limit: number;
127
- }): Promise<Pick<import("@chevre/factory/lib/chevre/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/moneyTransfer").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/registerService").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction, "id" | "typeOf" | "status">[]>;
127
+ }): Promise<Pick<import("@chevre/factory/lib/chevre/assetTransaction/cancelReservation").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/pay").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/refund").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/registerService").ITransaction | import("@chevre/factory/lib/chevre/assetTransaction/reserve").ITransaction, "id" | "typeOf" | "status">[]>;
128
128
  /**
129
129
  * set task status exported by transaction id
130
130
  * IDでタスクをエクスポート済に変更する
@@ -227,14 +227,6 @@ export declare class AssetTransactionRepo {
227
227
  _id: import("mongoose").Types.ObjectId;
228
228
  } & {
229
229
  __v: number;
230
- }) | (import("@chevre/factory/lib/chevre/assetTransaction/moneyTransfer").IAttributes & {
231
- id: string;
232
- } & {
233
- seller?: any;
234
- } & {
235
- _id: import("mongoose").Types.ObjectId;
236
- } & {
237
- __v: number;
238
230
  }) | (import("@chevre/factory/lib/chevre/assetTransaction/pay").IAttributes & {
239
231
  id: string;
240
232
  } & {
@@ -293,14 +285,6 @@ export declare class AssetTransactionRepo {
293
285
  _id: import("mongoose").Types.ObjectId;
294
286
  } & {
295
287
  __v: number;
296
- }) | (import("@chevre/factory/lib/chevre/assetTransaction/moneyTransfer").IAttributes & {
297
- id: string;
298
- } & {
299
- seller?: any;
300
- } & {
301
- _id: import("mongoose").Types.ObjectId;
302
- } & {
303
- __v: number;
304
288
  }) | (import("@chevre/factory/lib/chevre/assetTransaction/pay").IAttributes & {
305
289
  id: string;
306
290
  } & {
@@ -341,14 +325,6 @@ export declare class AssetTransactionRepo {
341
325
  _id: import("mongoose").Types.ObjectId;
342
326
  } & {
343
327
  __v: number;
344
- }) | (import("@chevre/factory/lib/chevre/assetTransaction/moneyTransfer").IAttributes & {
345
- id: string;
346
- } & {
347
- seller?: any;
348
- } & {
349
- _id: import("mongoose").Types.ObjectId;
350
- } & {
351
- __v: number;
352
328
  }) | (import("@chevre/factory/lib/chevre/assetTransaction/pay").IAttributes & {
353
329
  id: string;
354
330
  } & {
@@ -134,36 +134,36 @@ class AssetTransactionRepo {
134
134
  }
135
135
  break;
136
136
  }
137
- case factory_1.factory.assetTransactionType.MoneyTransfer: {
138
- const fromLocationIdentifierEq = params.object?.fromLocation?.identifier?.$eq;
139
- if (typeof fromLocationIdentifierEq === 'string') {
140
- andConditions.push({
141
- 'object.fromLocation.identifier': {
142
- $exists: true,
143
- $eq: fromLocationIdentifierEq
144
- }
145
- });
146
- }
147
- const toLocationIdentifierEq = params.object?.toLocation?.identifier?.$eq;
148
- if (typeof toLocationIdentifierEq === 'string') {
149
- andConditions.push({
150
- 'object.toLocation.identifier': {
151
- $exists: true,
152
- $eq: toLocationIdentifierEq
153
- }
154
- });
155
- }
156
- const pendingTransactionIdentifierEq = params.object?.pendingTransaction?.identifier?.$eq;
157
- if (typeof pendingTransactionIdentifierEq === 'string') {
158
- andConditions.push({
159
- 'object.pendingTransaction.identifier': {
160
- $exists: true,
161
- $eq: pendingTransactionIdentifierEq
162
- }
163
- });
164
- }
165
- break;
166
- }
137
+ // case factory.assetTransactionType.MoneyTransfer: {
138
+ // const fromLocationIdentifierEq = params.object?.fromLocation?.identifier?.$eq;
139
+ // if (typeof fromLocationIdentifierEq === 'string') {
140
+ // andConditions.push({
141
+ // 'object.fromLocation.identifier': {
142
+ // $exists: true,
143
+ // $eq: fromLocationIdentifierEq
144
+ // }
145
+ // });
146
+ // }
147
+ // const toLocationIdentifierEq = params.object?.toLocation?.identifier?.$eq;
148
+ // if (typeof toLocationIdentifierEq === 'string') {
149
+ // andConditions.push({
150
+ // 'object.toLocation.identifier': {
151
+ // $exists: true,
152
+ // $eq: toLocationIdentifierEq
153
+ // }
154
+ // });
155
+ // }
156
+ // const pendingTransactionIdentifierEq = params.object?.pendingTransaction?.identifier?.$eq;
157
+ // if (typeof pendingTransactionIdentifierEq === 'string') {
158
+ // andConditions.push({
159
+ // 'object.pendingTransaction.identifier': {
160
+ // $exists: true,
161
+ // $eq: pendingTransactionIdentifierEq
162
+ // }
163
+ // });
164
+ // }
165
+ // break;
166
+ // }
167
167
  case factory_1.factory.assetTransactionType.CancelReservation: {
168
168
  const objectReservationNumberIn4cancelReservation = params.object?.reservationNumber?.$in;
169
169
  if (Array.isArray(objectReservationNumberIn4cancelReservation)) {
@@ -1,7 +1,7 @@
1
1
  import { IndexDefinition, IndexOptions, Model, Schema, SchemaDefinition } from 'mongoose';
2
2
  import { IVirtuals } from '../virtuals';
3
3
  import { factory } from '../../../factory';
4
- type IDocType = (factory.assetTransaction.ITransaction<factory.assetTransactionType.CancelReservation> | factory.assetTransaction.ITransaction<factory.assetTransactionType.MoneyTransfer> | factory.assetTransaction.ITransaction<factory.assetTransactionType.Pay> | factory.assetTransaction.ITransaction<factory.assetTransactionType.Refund> | factory.assetTransaction.ITransaction<factory.assetTransactionType.RegisterService> | factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>) & {
4
+ type IDocType = (factory.assetTransaction.ITransaction<factory.assetTransactionType.CancelReservation> | factory.assetTransaction.ITransaction<factory.assetTransactionType.Pay> | factory.assetTransaction.ITransaction<factory.assetTransactionType.Refund> | factory.assetTransaction.ITransaction<factory.assetTransactionType.RegisterService> | factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>) & {
5
5
  seller?: any;
6
6
  };
7
7
  type IModel = Model<IDocType, Record<string, never>, Record<string, never>, IVirtuals>;
@@ -70,16 +70,6 @@ export declare class ProductRepo {
70
70
  id: string;
71
71
  }[];
72
72
  }>;
73
- /**
74
- * プロダクトIDからavailableChannelを取得する
75
- */
76
- findAvailableChannel(params: {
77
- project: {
78
- id: string;
79
- };
80
- typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard;
81
- id: string;
82
- }): Promise<factory.product.IAvailableChannel>;
83
73
  /**
84
74
  * 指定カタログの設定されたプロダクトを削除する
85
75
  */
@@ -317,28 +317,34 @@ class ProductRepo {
317
317
  }
318
318
  return {};
319
319
  }
320
- /**
321
- * プロダクトIDからavailableChannelを取得する
322
- */
323
- async findAvailableChannel(params) {
324
- const paymentService = (await this.projectFields({
325
- limit: 1,
326
- page: 1,
327
- project: { id: { $eq: params.project.id } },
328
- typeOf: { $eq: factory_1.factory.product.ProductType.PaymentCard },
329
- id: { $eq: params.id }
330
- }, ['availableChannel']
331
- // []
332
- )).shift();
333
- if (paymentService === undefined) {
334
- throw new factory_1.factory.errors.NotFound('PaymentService');
335
- }
336
- const availableChannel = paymentService.availableChannel;
337
- if (availableChannel === undefined) {
338
- throw new factory_1.factory.errors.NotFound('paymentService.availableChannel');
339
- }
340
- return availableChannel;
341
- }
320
+ // /**
321
+ // * プロダクトIDからavailableChannelを取得する
322
+ // */
323
+ // public async findAvailableChannel(params: {
324
+ // project: { id: string };
325
+ // typeOf: factory.service.paymentService.PaymentServiceType.PaymentCard;
326
+ // id: string;
327
+ // }): Promise<factory.product.IAvailableChannel> {
328
+ // const paymentService = (await this.projectFields(
329
+ // {
330
+ // limit: 1,
331
+ // page: 1,
332
+ // project: { id: { $eq: params.project.id } },
333
+ // typeOf: { $eq: factory.product.ProductType.PaymentCard },
334
+ // id: { $eq: params.id }
335
+ // },
336
+ // ['availableChannel']
337
+ // // []
338
+ // ) as Pick<factory.product.IProduct, 'availableChannel'>[]).shift();
339
+ // if (paymentService === undefined) {
340
+ // throw new factory.errors.NotFound('PaymentService');
341
+ // }
342
+ // const availableChannel = paymentService.availableChannel;
343
+ // if (availableChannel === undefined) {
344
+ // throw new factory.errors.NotFound('paymentService.availableChannel');
345
+ // }
346
+ // return availableChannel;
347
+ // }
342
348
  /**
343
349
  * 指定カタログの設定されたプロダクトを削除する
344
350
  */
@@ -31,7 +31,7 @@ type ICreatingTask = Pick<factory.task.IAttributes<factory.taskName>, 'data' | '
31
31
  export declare class TaskRepo {
32
32
  readonly taskModel: IModel;
33
33
  constructor(connection: Connection);
34
- static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmRegisterService").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/deletePerson").ITask | import("@chevre/factory/lib/chevre/task/deleteTransaction").ITask | import("@chevre/factory/lib/chevre/task/givePointAward").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnPointAward").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").ITask>[];
34
+ static CREATE_MONGO_CONDITIONS(params: factory.task.ISearchConditions): FilterQuery<import("@chevre/factory/lib/chevre/task").ITask | import("@chevre/factory/lib/chevre/task/confirmRegisterService").ITask | import("@chevre/factory/lib/chevre/task/confirmPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmRegisterServiceTransaction").ITask | import("@chevre/factory/lib/chevre/task/confirmReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/createAccountingReport").ITask | import("@chevre/factory/lib/chevre/task/deletePerson").ITask | import("@chevre/factory/lib/chevre/task/deleteTransaction").ITask | import("@chevre/factory/lib/chevre/task/onAssetTransactionStatusChanged").ITask | import("@chevre/factory/lib/chevre/task/onAuthorizationCreated").ITask | import("@chevre/factory/lib/chevre/task/onEventChanged").ITask | import("@chevre/factory/lib/chevre/task/onResourceDeleted").ITask | import("@chevre/factory/lib/chevre/task/onResourceUpdated").ITask | import("@chevre/factory/lib/chevre/task/onOrderPaymentCompleted").ITask | import("@chevre/factory/lib/chevre/task/placeOrder").ITask | import("@chevre/factory/lib/chevre/task/returnOrder").ITask | import("@chevre/factory/lib/chevre/task/returnPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/returnReserveTransaction").ITask | import("@chevre/factory/lib/chevre/task/sendEmailMessage").ITask | import("@chevre/factory/lib/chevre/task/sendOrder").ITask | import("@chevre/factory/lib/chevre/task/triggerWebhook").ITask | import("@chevre/factory/lib/chevre/task/useReservation").ITask | import("@chevre/factory/lib/chevre/task/voidPayTransaction").ITask | import("@chevre/factory/lib/chevre/task/voidRegisterServiceTransaction").ITask | import("@chevre/factory/lib/chevre/task/voidReserveTransaction").ITask>[];
35
35
  runImmediately(params: Pick<factory.task.IAttributes<factory.taskName>, 'data' | 'expires' | 'name' | 'project' | 'remainingNumberOfTries' | 'runsAt'> & {
36
36
  alternateName?: never;
37
37
  identifier?: never;
@@ -184,7 +184,7 @@ function getPaymentServiceId(params) {
184
184
  case factory_1.factory.service.paymentService.PaymentServiceType.FaceToFace:
185
185
  // 対面決済は特に何もしない
186
186
  break;
187
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
187
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard:
188
188
  case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
189
189
  case factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket:
190
190
  // リクエストでの指定を必須化(2022-04-12~)
@@ -89,13 +89,13 @@ function createStartParams(params, options) {
89
89
  // });
90
90
  // currencyはデフォルトでJPY
91
91
  let paymentMethodCurrency = factory_1.factory.priceCurrency.JPY;
92
- if (params.paymentServiceType === factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard) {
93
- const paymentCardServiceOutputCurrency = params.paymentService?.serviceOutput?.amount?.currency;
94
- if (typeof paymentCardServiceOutputCurrency === 'string') {
95
- paymentMethodCurrency = paymentCardServiceOutputCurrency;
96
- }
97
- }
98
- else if (params.paymentServiceType === factory_1.factory.service.paymentService.PaymentServiceType.CreditCard) {
92
+ // if (params.paymentServiceType === factory.service.paymentService.PaymentServiceType.PaymentCard) {
93
+ // const paymentCardServiceOutputCurrency = (params.paymentService as factory.product.IProduct)?.serviceOutput?.amount?.currency;
94
+ // if (typeof paymentCardServiceOutputCurrency === 'string') {
95
+ // paymentMethodCurrency = paymentCardServiceOutputCurrency;
96
+ // }
97
+ // } else
98
+ if (params.paymentServiceType === factory_1.factory.service.paymentService.PaymentServiceType.CreditCard) {
99
99
  const creditCardPaymentServiceOutput = params.paymentService?.serviceOutput;
100
100
  const invoiceAsServiceOutput = (Array.isArray(creditCardPaymentServiceOutput))
101
101
  ? creditCardPaymentServiceOutput.find((output) => output?.typeOf === 'Invoice')
@@ -13,7 +13,7 @@ function getPaymentServiceId(params) {
13
13
  case factory_1.factory.service.paymentService.PaymentServiceType.FaceToFace:
14
14
  // 対面決済は特に何もしない
15
15
  break;
16
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
16
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard:
17
17
  case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
18
18
  case factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket:
19
19
  // リクエストでの指定を必須化(2022-04-12~)
@@ -33,21 +33,23 @@ function fixPaymentService(params) {
33
33
  // no op
34
34
  // FaceToFaceの場合プロダクトは存在しない
35
35
  break;
36
- // PaymentCardの場合、プロダクト検索
37
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
38
- paymentService = (await repos.product.projectFields({
39
- limit: 1,
40
- page: 1,
41
- project: { id: { $eq: params.project.id } },
42
- typeOf: { $eq: factory_1.factory.product.ProductType.PaymentCard },
43
- id: { $eq: getPaymentServiceId(params) }
44
- }, ['availableChannel', 'serviceOutput', 'serviceType', 'potentialAction']
45
- // []
46
- )).shift();
47
- if (paymentService === undefined) {
48
- throw new factory_1.factory.errors.NotFound('PaymentService');
49
- }
50
- break;
36
+ // // PaymentCardの場合、プロダクト検索
37
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard:
38
+ // paymentService = (await repos.product.projectFields(
39
+ // {
40
+ // limit: 1,
41
+ // page: 1,
42
+ // project: { id: { $eq: params.project.id } },
43
+ // typeOf: { $eq: factory.product.ProductType.PaymentCard },
44
+ // id: { $eq: getPaymentServiceId(params) }
45
+ // },
46
+ // ['availableChannel', 'serviceOutput', 'serviceType', 'potentialAction']
47
+ // // []
48
+ // ) as Pick<factory.product.IProduct, 'availableChannel' | 'id' | 'serviceOutput' | 'serviceType' | 'potentialAction'>[]).shift();
49
+ // if (paymentService === undefined) {
50
+ // throw new factory.errors.NotFound('PaymentService');
51
+ // }
52
+ // break;
51
53
  default:
52
54
  paymentService = (await repos.paymentService.projectFields({
53
55
  limit: 1,
@@ -58,8 +58,8 @@ function start(params) {
58
58
  switch (paymentServiceType) {
59
59
  case factory_1.factory.service.paymentService.PaymentServiceType.FaceToFace:
60
60
  break;
61
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
62
- break;
61
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard:
62
+ // break;
63
63
  case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
64
64
  break;
65
65
  case factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket:
@@ -81,21 +81,23 @@ function fixPaymentService(params) {
81
81
  // no op
82
82
  // FaceToFaceの場合プロダクトは存在しない
83
83
  break;
84
- // PaymentCardの場合、プロダクト検索
85
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
86
- paymentService = (await repos.product.projectFields({
87
- limit: 1,
88
- page: 1,
89
- project: { id: { $eq: params.payAction.project.id } },
90
- typeOf: { $eq: factory_1.factory.product.ProductType.PaymentCard },
91
- id: { $eq: paymentServiceId }
92
- }, ['availableChannel', 'typeOf', 'potentialAction']
93
- // []
94
- )).shift();
95
- if (paymentService === undefined) {
96
- throw new factory_1.factory.errors.NotFound('PaymentService');
97
- }
98
- break;
84
+ // // PaymentCardの場合、プロダクト検索
85
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard:
86
+ // paymentService = (await repos.product.projectFields(
87
+ // {
88
+ // limit: 1,
89
+ // page: 1,
90
+ // project: { id: { $eq: params.payAction.project.id } },
91
+ // typeOf: { $eq: factory.product.ProductType.PaymentCard },
92
+ // id: { $eq: paymentServiceId }
93
+ // },
94
+ // ['availableChannel', 'typeOf', 'potentialAction']
95
+ // // []
96
+ // ) as Pick<factory.product.IProduct, 'availableChannel' | 'typeOf' | 'potentialAction'>[]).shift();
97
+ // if (paymentService === undefined) {
98
+ // throw new factory.errors.NotFound('PaymentService');
99
+ // }
100
+ // break;
99
101
  default:
100
102
  paymentService = (await repos.paymentService.projectFields({
101
103
  limit: 1,
@@ -1,12 +1,5 @@
1
1
  import { factory } from '../../../factory';
2
2
  export type IUnitPriceSpecification = factory.priceSpecification.IPriceSpecification<factory.priceSpecificationType.UnitPriceSpecification>;
3
- /**
4
- * ポイント特典を作成する
5
- */
6
- export declare function createPointAward(params: {
7
- acceptedOffer: factory.assetTransaction.registerService.IAcceptedOfferWithoutDetail;
8
- offer: factory.product.ITicketOffer;
9
- }): factory.action.transfer.moneyTransfer.IPointAward | undefined;
10
3
  /**
11
4
  * サービスアウトプットを作成する
12
5
  */
@@ -3,40 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.createPointAward = createPointAward;
7
6
  exports.createServiceOutput = createServiceOutput;
8
7
  const moment_1 = __importDefault(require("moment"));
9
8
  const factory_1 = require("../../../factory");
10
- /**
11
- * ポイント特典を作成する
12
- */
13
- function createPointAward(params) {
14
- let pointAward;
15
- const pointAwardAmount = params.offer.itemOffered?.pointAward?.amount;
16
- const pointAwardDescription = params.offer.itemOffered?.pointAward?.description;
17
- const pointAwardToLocation = params.acceptedOffer.itemOffered?.pointAward?.toLocation;
18
- const pointAwardRecipient = params.acceptedOffer.itemOffered?.pointAward?.recipient;
19
- const pointAwardPurposeIdentifier = params.acceptedOffer.itemOffered?.pointAward?.purpose?.identifier;
20
- // オファーのpointAward設定が適切にされていれば、指定されたtoLocationを反映する
21
- if (typeof pointAwardAmount?.value === 'number'
22
- && typeof pointAwardAmount?.currency === 'string'
23
- && typeof pointAwardToLocation?.identifier === 'string'
24
- && typeof pointAwardToLocation?.issuedThrough.id === 'string') {
25
- pointAward = {
26
- amount: pointAwardAmount,
27
- toLocation: {
28
- typeOf: factory_1.factory.permit.PermitType.Permit,
29
- identifier: pointAwardToLocation.identifier,
30
- issuedThrough: { id: pointAwardToLocation.issuedThrough.id }
31
- },
32
- typeOf: factory_1.factory.actionType.MoneyTransfer,
33
- ...(typeof pointAwardDescription === 'string') ? { description: pointAwardDescription } : undefined,
34
- ...(pointAwardRecipient !== undefined) ? { recipient: pointAwardRecipient } : undefined,
35
- ...(typeof pointAwardPurposeIdentifier === 'string') ? { purpose: { identifier: pointAwardPurposeIdentifier } } : undefined
36
- };
37
- }
38
- return pointAward;
39
- }
40
9
  /**
41
10
  * サービスアウトプットを作成する
42
11
  */