@chevre/domain 24.0.0-alpha.76 → 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 (40) hide show
  1. package/lib/chevre/repo/action/actionProcess.d.ts +2 -2
  2. package/lib/chevre/repo/action/actionProcess.js +18 -3
  3. package/lib/chevre/repo/assetTransaction.d.ts +3 -27
  4. package/lib/chevre/repo/assetTransaction.js +30 -30
  5. package/lib/chevre/repo/mongoose/schemas/assetTransaction.d.ts +1 -1
  6. package/lib/chevre/repo/product.d.ts +0 -10
  7. package/lib/chevre/repo/product.js +28 -22
  8. package/lib/chevre/repo/task.d.ts +1 -1
  9. package/lib/chevre/service/assetTransaction/pay/publishPaymentUrl.js +1 -1
  10. package/lib/chevre/service/assetTransaction/pay/start/factory.js +7 -7
  11. package/lib/chevre/service/assetTransaction/pay/start/preStart/fixPaymentService.js +18 -16
  12. package/lib/chevre/service/assetTransaction/refund.js +19 -17
  13. package/lib/chevre/service/assetTransaction/registerService/factory.d.ts +0 -7
  14. package/lib/chevre/service/assetTransaction/registerService/factory.js +0 -31
  15. package/lib/chevre/service/assetTransaction/registerService/potentialActions.js +63 -91
  16. package/lib/chevre/service/assetTransaction/registerService.js +21 -20
  17. package/lib/chevre/service/assetTransaction/reserve/start.js +8 -8
  18. package/lib/chevre/service/offer/event/authorize.js +7 -32
  19. package/lib/chevre/service/offer/product.js +28 -28
  20. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.d.ts +1 -1
  21. package/lib/chevre/service/order/onAssetTransactionStatusChanged/isDeliverable.js +26 -25
  22. package/lib/chevre/service/order/onAssetTransactionStatusChanged.js +18 -17
  23. package/lib/chevre/service/order/onOrderStatusChanged/onOrderCancelled/factory.d.ts +1 -1
  24. package/lib/chevre/service/order/onOrderStatusChanged/onOrderDeliveredPartially/factory.d.ts +1 -1
  25. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.d.ts +1 -1
  26. package/lib/chevre/service/order/onOrderStatusChanged/onOrderReturned/factory.js +18 -15
  27. package/lib/chevre/service/payment/factory/createPayObjectServiceOutput.js +1 -1
  28. package/lib/chevre/service/payment/factory.js +23 -23
  29. package/lib/chevre/service/product.js +16 -16
  30. package/lib/chevre/service/reserve/confirmReservation.js +19 -17
  31. package/lib/chevre/service/reserve/factory.d.ts +0 -6
  32. package/lib/chevre/service/reserve/factory.js +0 -59
  33. package/lib/chevre/service/reserve/potentialActions/onReservationConfirmed.js +16 -15
  34. package/lib/chevre/service/transaction/placeOrder/confirm/validation.js +12 -10
  35. package/lib/chevre/service/transaction/returnOrder/potentialActions.js +4 -4
  36. package/package.json +2 -2
  37. package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.d.ts +0 -15
  38. package/lib/chevre/service/assetTransaction/reserve/start/factory/createPointAward.js +0 -44
  39. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.d.ts +0 -8
  40. package/lib/chevre/service/transaction/returnOrder/potentialActions/returnPointAward.js +0 -89
@@ -101,22 +101,25 @@ function createOnOrderReturnedTasksByTransaction(params) {
101
101
  // }
102
102
  // ));
103
103
  // }
104
+ // discontinue(2026-04-18~)
104
105
  // ポイント特典返却タスク
105
- const returnPointAwardAttributes = potentialActions?.returnPointAward;
106
- if (Array.isArray(returnPointAwardAttributes)) {
107
- taskAttributes.push(...returnPointAwardAttributes.map((a) => {
108
- return {
109
- project: a.project,
110
- name: factory_1.factory.taskName.ReturnPointAward,
111
- status: factory_1.factory.taskStatus.Ready,
112
- runsAt: now, // なるはやで実行
113
- remainingNumberOfTries: 10,
114
- numberOfTried: 0,
115
- executionResults: [],
116
- data: a
117
- };
118
- }));
119
- }
106
+ // const returnPointAwardAttributes = potentialActions?.returnPointAward;
107
+ // if (Array.isArray(returnPointAwardAttributes)) {
108
+ // taskAttributes.push(...returnPointAwardAttributes.map(
109
+ // (a): factory.task.IAttributes<factory.taskName.ReturnPointAward> => {
110
+ // return {
111
+ // project: a.project,
112
+ // name: factory.taskName.ReturnPointAward,
113
+ // status: factory.taskStatus.Ready,
114
+ // runsAt: now, // なるはやで実行
115
+ // remainingNumberOfTries: 10,
116
+ // numberOfTried: 0,
117
+ // executionResults: [],
118
+ // data: a
119
+ // };
120
+ // }
121
+ // ));
122
+ // }
120
123
  const sendEmailMessageAttributes = potentialActions?.sendEmailMessage;
121
124
  if (Array.isArray(sendEmailMessageAttributes)) {
122
125
  const simpleOrder = {
@@ -12,8 +12,8 @@ function createPayObjectServiceOutput(params) {
12
12
  const order = params.order;
13
13
  let paymentServiceOutput;
14
14
  switch (transaction.object.typeOf) {
15
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard: // discontinue(2026-04-18~)
15
16
  case factory_1.factory.service.paymentService.PaymentServiceType.FaceToFace:
16
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard:
17
17
  case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
18
18
  break;
19
19
  case factory_1.factory.service.paymentService.PaymentServiceType.MovieTicket: {
@@ -80,29 +80,29 @@ function createPayObject(params) {
80
80
  };
81
81
  break;
82
82
  }
83
- case factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard: {
84
- const totalPaymentDue = (typeof paymentMethod?.totalPaymentDue?.typeOf === 'string')
85
- ? paymentMethod.totalPaymentDue
86
- : {
87
- typeOf: 'MonetaryAmount',
88
- currency: factory_1.factory.priceCurrency.JPY,
89
- value: paymentMethodAmountValue
90
- };
91
- payObject = {
92
- typeOf: transaction.object.typeOf,
93
- id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
94
- paymentMethod: {
95
- accountId: paymentMethod?.accountId,
96
- additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [],
97
- name: paymentMethodName,
98
- paymentMethodId: paymentMethodId,
99
- totalPaymentDue: totalPaymentDue,
100
- typeOf: paymentMethodType
101
- },
102
- pendingTransaction: transaction.object.pendingTransaction
103
- };
104
- break;
105
- }
83
+ // case factory.service.paymentService.PaymentServiceType.PaymentCard: {
84
+ // const totalPaymentDue: factory.order.ITotalPaymentDue = (typeof paymentMethod?.totalPaymentDue?.typeOf === 'string')
85
+ // ? paymentMethod.totalPaymentDue
86
+ // : {
87
+ // typeOf: 'MonetaryAmount',
88
+ // currency: factory.priceCurrency.JPY,
89
+ // value: paymentMethodAmountValue
90
+ // };
91
+ // payObject = {
92
+ // typeOf: transaction.object.typeOf,
93
+ // id: (typeof transaction.object.id === 'string') ? transaction.object.id : '',
94
+ // paymentMethod: {
95
+ // accountId: paymentMethod?.accountId,
96
+ // additionalProperty: (Array.isArray(additionalProperty)) ? additionalProperty : [],
97
+ // name: paymentMethodName,
98
+ // paymentMethodId: paymentMethodId,
99
+ // totalPaymentDue: totalPaymentDue,
100
+ // typeOf: paymentMethodType
101
+ // },
102
+ // pendingTransaction: transaction.object.pendingTransaction
103
+ // };
104
+ // break;
105
+ // }
106
106
  case factory_1.factory.service.paymentService.PaymentServiceType.CreditCard:
107
107
  payObject = {
108
108
  typeOf: transaction.object.typeOf,
@@ -8,7 +8,6 @@ exports.registerService = registerService;
8
8
  * プロダクトサービス
9
9
  */
10
10
  const moment_1 = __importDefault(require("moment"));
11
- const factory_1 = require("../factory");
12
11
  const permit_1 = require("./permit");
13
12
  function registerService(params) {
14
13
  return async (repos) => {
@@ -52,24 +51,25 @@ function registerService(params) {
52
51
  function onRegistered(actionAttributes, __) {
53
52
  return async (repos) => {
54
53
  const potentialActions = actionAttributes.potentialActions;
55
- const now = new Date();
54
+ // const now = new Date();
56
55
  const taskAttributes = [];
57
56
  /* istanbul ignore else */
58
57
  if (potentialActions !== undefined) {
59
- if (Array.isArray(potentialActions.moneyTransfer)) {
60
- taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
61
- return {
62
- project: a.project,
63
- name: factory_1.factory.taskName.MoneyTransfer,
64
- status: factory_1.factory.taskStatus.Ready,
65
- runsAt: now,
66
- remainingNumberOfTries: 10,
67
- numberOfTried: 0,
68
- executionResults: [],
69
- data: a
70
- };
71
- }));
72
- }
58
+ // discontinue(2026-04-18~)
59
+ // if (Array.isArray(potentialActions.moneyTransfer)) {
60
+ // taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
61
+ // return {
62
+ // project: a.project,
63
+ // name: factory.taskName.MoneyTransfer as factory.taskName.MoneyTransfer,
64
+ // status: factory.taskStatus.Ready,
65
+ // runsAt: now,
66
+ // remainingNumberOfTries: 10,
67
+ // numberOfTried: 0,
68
+ // executionResults: [],
69
+ // data: a
70
+ // };
71
+ // }));
72
+ // }
73
73
  }
74
74
  // タスク保管
75
75
  await repos.task.saveMany(taskAttributes, { emitImmediately: true });
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.confirmReservation = confirmReservation;
7
7
  const debug_1 = __importDefault(require("debug"));
8
8
  const factory_1 = require("../../factory");
9
- const factory_2 = require("./factory");
10
9
  const onReservationConfirmed_1 = require("./potentialActions/onReservationConfirmed");
11
10
  const debug = (0, debug_1.default)('chevre-domain:service:reserve:confirmReservation');
12
11
  /**
@@ -81,21 +80,23 @@ function reserveTransaction2action(params) {
81
80
  if (reservationFor === undefined) {
82
81
  throw new factory_1.factory.errors.NotFound('transaction.object.reservationFor');
83
82
  }
84
- let underName;
85
- if (typeof transaction.object.underName?.typeOf === 'string') {
86
- underName = transaction.object.underName;
87
- }
88
- const moneyTransferActions = [];
89
- const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
90
- pendingReservations.forEach((reservation) => {
91
- const acceptedOffer4reservation = transaction.object.acceptedOffer?.find((o) => o.itemOffered?.serviceOutput?.id === reservation.id);
92
- moneyTransferActions.push(...(0, factory_2.createMoneyTransferActions)({
93
- acceptedOffer: acceptedOffer4reservation,
94
- reservation,
95
- transaction: params.transaction,
96
- underName
97
- }));
98
- });
83
+ // let underName: factory.assetTransaction.reserve.IUnderName | undefined;
84
+ // if (typeof transaction.object.underName?.typeOf === 'string') {
85
+ // underName = transaction.object.underName;
86
+ // }
87
+ // const moneyTransferActions: factory.action.transfer.moneyTransfer.IAttributes[] = [];
88
+ // const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
89
+ // pendingReservations.forEach((reservation) => {
90
+ // const acceptedOffer4reservation = transaction.object.acceptedOffer?.find(
91
+ // (o) => o.itemOffered?.serviceOutput?.id === reservation.id
92
+ // );
93
+ // moneyTransferActions.push(...createMoneyTransferActions({
94
+ // acceptedOffer: acceptedOffer4reservation,
95
+ // reservation,
96
+ // transaction: params.transaction,
97
+ // underName
98
+ // }));
99
+ // });
99
100
  const reservationPackage = {
100
101
  reservationFor: {
101
102
  id: String(reservationFor.id),
@@ -114,7 +115,8 @@ function reserveTransaction2action(params) {
114
115
  object: reservationPackage,
115
116
  agent: transaction.project,
116
117
  potentialActions: {
117
- moneyTransfer: moneyTransferActions
118
+ // discontinue(2026-04-18~)
119
+ // moneyTransfer: moneyTransferActions
118
120
  },
119
121
  purpose: { typeOf: transaction.typeOf, id: transaction.id },
120
122
  ...(Array.isArray(transaction.instrument)) ? { instrument: transaction.instrument } : undefined // add(2025-02-17~)
@@ -4,12 +4,6 @@ export declare function optimizeUnderName4inform(params: {
4
4
  }): factory.notification.reservation.IMaskedUnderName;
5
5
  export type IPotentialInformReservationAction = factory.task.triggerWebhook.IPotentialInformReservationAction;
6
6
  export declare const NUM_TRY_INFORM_RESERVATION = 10;
7
- export declare function createMoneyTransferActions(params: {
8
- acceptedOffer?: factory.assetTransaction.reserve.IAcceptedOffer4object;
9
- reservation: Pick<factory.assetTransaction.reserve.IObjectSubReservation, 'reservedTicket'>;
10
- transaction: factory.assetTransaction.ITransaction<factory.assetTransactionType.Reserve>;
11
- underName?: Pick<factory.reservation.IUnderName, 'id' | 'typeOf' | 'name'>;
12
- }): import("@chevre/factory/lib/chevre/action/transfer/moneyTransfer").IAttributes[];
13
7
  export interface IPotentialCancelAction extends factory.action.cancel.reservation.IAttributes {
14
8
  purpose: {
15
9
  id: string;
@@ -2,71 +2,12 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NUM_TRY_INFORM_RESERVATION = void 0;
4
4
  exports.optimizeUnderName4inform = optimizeUnderName4inform;
5
- exports.createMoneyTransferActions = createMoneyTransferActions;
6
5
  exports.createCancelPendingReservationAction = createCancelPendingReservationAction;
7
6
  const factory_1 = require("../../factory");
8
7
  function optimizeUnderName4inform(params) {
9
8
  return { id: params.underName.id, typeOf: params.underName.typeOf };
10
9
  }
11
10
  exports.NUM_TRY_INFORM_RESERVATION = 10;
12
- function createMoneyTransferActions(params) {
13
- const pointAward = params.acceptedOffer?.itemOffered?.pointAward;
14
- const moneyTransfer = [];
15
- // ポイント特典があれば適用
16
- const pointAwardToLocationIdentifier = pointAward?.toLocation?.identifier;
17
- const pointAwardToLocationTypeOf = pointAward?.toLocation?.typeOf;
18
- if (typeof pointAward?.amount?.value === 'number'
19
- && typeof pointAwardToLocationIdentifier === 'string'
20
- && typeof pointAwardToLocationTypeOf === 'string') {
21
- const fromLocation = {
22
- typeOf: (typeof params.reservation.reservedTicket.issuedBy?.typeOf === 'string')
23
- ? params.reservation.reservedTicket.issuedBy.typeOf
24
- : params.transaction.typeOf,
25
- name: (typeof params.reservation.reservedTicket.issuedBy?.name === 'string')
26
- ? params.reservation.reservedTicket.issuedBy.name
27
- : params.transaction.id
28
- };
29
- const toLocation = {
30
- identifier: pointAwardToLocationIdentifier,
31
- typeOf: factory_1.factory.permit.PermitType.Permit,
32
- issuedThrough: { id: String(pointAward.toLocation?.issuedThrough?.id) }
33
- };
34
- const recipient = {
35
- typeOf: (typeof params.underName?.typeOf === 'string')
36
- ? params.underName?.typeOf
37
- : factory_1.factory.personType.Person,
38
- id: (typeof params.underName?.id === 'string')
39
- ? params.underName?.id
40
- : '',
41
- name: String(params.underName?.name)
42
- };
43
- moneyTransfer.push({
44
- project: params.transaction.project,
45
- typeOf: factory_1.factory.actionType.MoneyTransfer,
46
- agent: params.transaction.project,
47
- recipient,
48
- object: {
49
- typeOf: factory_1.factory.account.transactionType.Deposit
50
- },
51
- purpose: {
52
- typeOf: params.transaction.typeOf,
53
- id: params.transaction.id,
54
- // 入金取引に識別子を指定する
55
- ...(typeof pointAward.purpose?.identifier === 'string') ? { identifier: pointAward.purpose.identifier } : undefined
56
- },
57
- amount: {
58
- typeOf: 'MonetaryAmount',
59
- value: pointAward.amount?.value,
60
- currency: pointAward.amount?.currency
61
- },
62
- fromLocation: fromLocation,
63
- toLocation: toLocation,
64
- ...(typeof pointAward.description === 'string') ? { description: pointAward.description } : undefined,
65
- ...(pointAward.recipient !== undefined) ? { recipient: pointAward.recipient } : undefined
66
- });
67
- }
68
- return moneyTransfer;
69
- }
70
11
  function createCancelPendingReservationAction(params) {
71
12
  const transaction = params.transaction;
72
13
  const pendingReservations = (Array.isArray(transaction.object.subReservation)) ? transaction.object.subReservation : [];
@@ -14,24 +14,25 @@ const factory_2 = require("../factory");
14
14
  function onReservationConfirmedByAction(actionAttributes) {
15
15
  return async (repos) => {
16
16
  const potentialActions = actionAttributes.potentialActions;
17
- const now = new Date();
17
+ // const now = new Date();
18
18
  const taskAttributes = [];
19
19
  /* istanbul ignore else */
20
20
  if (potentialActions !== undefined) {
21
- if (Array.isArray(potentialActions.moneyTransfer)) {
22
- taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
23
- return {
24
- project: a.project,
25
- name: factory_1.factory.taskName.MoneyTransfer,
26
- status: factory_1.factory.taskStatus.Ready,
27
- runsAt: now,
28
- remainingNumberOfTries: 10,
29
- numberOfTried: 0,
30
- executionResults: [],
31
- data: a
32
- };
33
- }));
34
- }
21
+ // discontinue(2026-04-18~)
22
+ // if (Array.isArray(potentialActions.moneyTransfer)) {
23
+ // taskAttributes.push(...potentialActions.moneyTransfer.map((a) => {
24
+ // return {
25
+ // project: a.project,
26
+ // name: factory.taskName.MoneyTransfer as factory.taskName.MoneyTransfer,
27
+ // status: factory.taskStatus.Ready,
28
+ // runsAt: now,
29
+ // remainingNumberOfTries: 10,
30
+ // numberOfTried: 0,
31
+ // executionResults: [],
32
+ // data: a
33
+ // };
34
+ // }));
35
+ // }
35
36
  }
36
37
  // タスク保管
37
38
  if (taskAttributes.length > 0) {
@@ -155,16 +155,18 @@ function validatePaymentUrl(transaction, acceptPayActions, authorizePaymentActio
155
155
  /**
156
156
  * JPY以外の通貨について取引を検証する
157
157
  */
158
- function validateMonetaryAmount(authorizePaymentActions, authorizeEventServiceOfferActions) {
159
- const authorizeMonetaryAmountActions = authorizePaymentActions.filter(({ result }) => {
160
- const resultAsInvoice = (Array.isArray(result))
161
- // ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
162
- ? result[0]
163
- : undefined;
164
- // JPY以外の通貨に対して承認可能なのはPaymentServiceType.PaymentCardのみ
165
- return resultAsInvoice?.issuedThrough.typeOf === factory_1.factory.service.paymentService.PaymentServiceType.PaymentCard
166
- && resultAsInvoice.totalPaymentDue?.currency !== factory_1.factory.priceCurrency.JPY;
167
- });
158
+ function validateMonetaryAmount(_authorizePaymentActions, authorizeEventServiceOfferActions) {
159
+ // PaymentCard決済を廃止したので、JPY以外の通貨に対しての承認はありえない(2026-04-18~)
160
+ const authorizeMonetaryAmountActions = [];
161
+ // const authorizeMonetaryAmountActions = authorizePaymentActions.filter(({ result }) => {
162
+ // const resultAsInvoice = (Array.isArray(result))
163
+ // // ? result.find(({ typeOf }) => typeOf === factory.action.authorize.paymentMethod.any.ResultType.Payment)
164
+ // ? result[0]
165
+ // : undefined;
166
+ // // JPY以外の通貨に対して承認可能なのはPaymentServiceType.PaymentCardのみ
167
+ // return resultAsInvoice?.issuedThrough.typeOf === factory.service.paymentService.PaymentServiceType.PaymentCard
168
+ // && resultAsInvoice.totalPaymentDue?.currency !== factory.priceCurrency.JPY;
169
+ // });
168
170
  const requiredMonetaryAmountByCurrencyType = [];
169
171
  authorizeEventServiceOfferActions.forEach((a) => {
170
172
  const amount = a.result?.amount;
@@ -4,7 +4,6 @@ exports.createPotentialActions = createPotentialActions;
4
4
  const factory_1 = require("../../../factory");
5
5
  // import { Settings } from '../../../settings';
6
6
  const returnPaymentMethod_1 = require("./potentialActions/returnPaymentMethod");
7
- const returnPointAward_1 = require("./potentialActions/returnPointAward");
8
7
  const sendEmailMessage_1 = require("./potentialActions/sendEmailMessage");
9
8
  async function createPotentialActions(params,
10
9
  // settings: Settings
@@ -24,8 +23,9 @@ setting) {
24
23
  ...(returnOrderActionParams !== undefined) ? { returnOrderActionParams } : undefined
25
24
  }, setting);
26
25
  emailMessages.push(...emailMessagesOnReturnInvoice);
27
- // ポイント特典の数だけ、返却アクションを作成
28
- const returnPointAwardActions = await (0, returnPointAward_1.createReturnPointAwardActions)({ ...params, order });
26
+ // discontinue(2026-04-18~)
27
+ // // ポイント特典の数だけ、返却アクションを作成
28
+ // const returnPointAwardActions = await createReturnPointAwardActions({ ...params, order });
29
29
  // 返品後のEメール送信アクション
30
30
  const { emailMessagesOnReturn, sendEmailMessaegActionsOnReturn } = await (0, sendEmailMessage_1.createSendEmailMessaegActionsOnReturn)({
31
31
  ...params,
@@ -35,7 +35,7 @@ setting) {
35
35
  emailMessages.push(...emailMessagesOnReturn);
36
36
  const potentialActionsOnReturnOrder = {
37
37
  returnPaymentMethod: returnPaymentMethodActions,
38
- returnPointAward: returnPointAwardActions,
38
+ // returnPointAward: returnPointAwardActions, // discontinue(2026-04-18~)
39
39
  sendEmailMessage: sendEmailMessaegActionsOnReturn
40
40
  };
41
41
  const returnOrderObject = {
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": "7.0.0",
14
+ "@chevre/factory": "8.0.0-alpha.0",
15
15
  "@motionpicture/coa-service": "10.0.0",
16
16
  "@motionpicture/gmo-service": "6.0.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": "24.0.0-alpha.76"
94
+ "version": "24.0.0-alpha.78"
95
95
  }
@@ -1,15 +0,0 @@
1
- import { factory } from '../../../../../factory';
2
- /**
3
- * ポイント特典を作成する
4
- */
5
- declare function createPointAward(params: {
6
- acceptedOffer: factory.assetTransaction.reserve.IAcceptedTicketOfferWithoutDetail;
7
- offer: factory.product.ITicketOffer;
8
- reservation: {
9
- id: string;
10
- };
11
- project: {
12
- id: string;
13
- };
14
- }): factory.action.transfer.moneyTransfer.IPointAward | undefined;
15
- export { createPointAward };
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createPointAward = createPointAward;
4
- const factory_1 = require("../../../../../factory");
5
- const accountTransactionIdentifier_1 = require("../../../../../factory/accountTransactionIdentifier");
6
- /**
7
- * ポイント特典を作成する
8
- */
9
- function createPointAward(params) {
10
- let pointAward;
11
- const pointAwardAmount = params.offer.itemOffered?.pointAward?.amount;
12
- const pointAwardDescription = params.offer.itemOffered?.pointAward?.description;
13
- const pointAwardToLocationIdentifier = params.acceptedOffer.itemOffered?.pointAward?.toLocation?.identifier;
14
- const pointAwardToLocationIssuedThroughId = params.acceptedOffer.itemOffered?.pointAward?.toLocation?.issuedThrough.id;
15
- const pointAwardRecipient = params.acceptedOffer.itemOffered?.pointAward?.recipient;
16
- // const pointAwardPurposeIdentifier = params.acceptedOffer.itemOffered?.pointAward?.purpose?.identifier;
17
- // オファーのpointAward設定が適切にされていれば、指定されたtoLocationを反映する
18
- if (typeof pointAwardAmount?.value === 'number'
19
- && typeof pointAwardAmount?.currency === 'string'
20
- && typeof pointAwardToLocationIdentifier === 'string'
21
- && typeof pointAwardToLocationIssuedThroughId === 'string') {
22
- // ここで識別子を作成する(入金のユニークネスが保証される)
23
- const purposeIdentifier = (0, accountTransactionIdentifier_1.createPointAwardPurposeIdentifier4reservation)({
24
- assetTransaction: { typeOf: factory_1.factory.assetTransactionType.Reserve },
25
- project: { id: params.project.id },
26
- reservation: { id: params.reservation.id },
27
- toLocation: { identifier: pointAwardToLocationIdentifier }
28
- });
29
- pointAward = {
30
- amount: pointAwardAmount,
31
- purpose: { identifier: purposeIdentifier },
32
- toLocation: {
33
- typeOf: factory_1.factory.permit.PermitType.Permit,
34
- identifier: pointAwardToLocationIdentifier,
35
- issuedThrough: { id: pointAwardToLocationIssuedThroughId }
36
- },
37
- typeOf: factory_1.factory.actionType.MoneyTransfer,
38
- ...(typeof pointAwardDescription === 'string') ? { description: pointAwardDescription } : undefined,
39
- ...(pointAwardRecipient !== undefined) ? { recipient: pointAwardRecipient } : undefined
40
- // ...(typeof pointAwardPurposeIdentifier === 'string') ? { purpose: { identifier: pointAwardPurposeIdentifier } } : undefined
41
- };
42
- }
43
- return pointAward;
44
- }
@@ -1,8 +0,0 @@
1
- import { factory } from '../../../../factory';
2
- /**
3
- * ポイント特典返却アクションを作成する
4
- */
5
- export declare function createReturnPointAwardActions(params: {
6
- order: Pick<factory.order.IOrder, 'identifier' | 'project' | 'orderDate' | 'orderNumber' | 'orderStatus' | 'seller' | 'typeOf'>;
7
- potentialActions?: factory.transaction.returnOrder.IPotentialActionsParams;
8
- }): Promise<factory.action.transfer.returnAction.pointAward.IAttributes[]>;
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createReturnPointAwardActions = createReturnPointAwardActions;
4
- const factory_1 = require("../../../../factory");
5
- const order_1 = require("../../../../factory/order");
6
- /**
7
- * ポイント特典返却アクションを作成する
8
- */
9
- async function createReturnPointAwardActions(params) {
10
- const returnPointAwardActions = [];
11
- // 入金識別子はorder.identifierに保管されている
12
- let pointAwardIdentifiers = [];
13
- const pointAwardIdentifierStr = params.order.identifier?.find((i) => i.name === order_1.POINT_AWARD_IDENTIFIER_NAME)?.value;
14
- if (typeof pointAwardIdentifierStr === 'string') {
15
- try {
16
- pointAwardIdentifiers = JSON.parse(pointAwardIdentifierStr);
17
- }
18
- catch (error) {
19
- console.error('JSON.parse(pointAwardIdentifierStr) throws', error);
20
- }
21
- }
22
- // 注文口座番号はorder.identifierに保管されている
23
- let awardAccountIdentifiers = [];
24
- const awardAccountsStr = params.order.identifier?.find((i) => i.name === order_1.AWARD_ACCOUNTS_IDENTIFIER_NAME)?.value;
25
- if (typeof awardAccountsStr === 'string') {
26
- try {
27
- const awardAccounts = JSON.parse(awardAccountsStr);
28
- if (Array.isArray(awardAccounts)) {
29
- awardAccountIdentifiers = awardAccounts.map((a) => a.accountNumber);
30
- }
31
- }
32
- catch (error) {
33
- console.error('JSON.parse(awardAccountsStr) throws', error);
34
- }
35
- }
36
- const order = params.order;
37
- // const maskedCustomer = createMaskedCustomer(order, { noProfile: true });
38
- const purpose = {
39
- typeOf: order.typeOf,
40
- // seller: {
41
- // id: order.seller.id,
42
- // typeOf: order.seller.typeOf,
43
- // name: order.seller.name
44
- // }, // 廃止(2024-03-06~)
45
- // mask
46
- // customer: { typeOf: maskedCustomer.typeOf, id: maskedCustomer.id }, // 廃止(2024-03-06~)
47
- orderNumber: order.orderNumber,
48
- // price: order.price,
49
- // priceCurrency: order.priceCurrency,
50
- orderDate: order.orderDate
51
- };
52
- const agent = order.project;
53
- const recipient = {
54
- typeOf: order.seller.typeOf,
55
- id: order.seller.id,
56
- name: order.seller.name
57
- };
58
- // ポイントインセンティブの数だけ、返却アクションを作成
59
- returnPointAwardActions.push(...pointAwardIdentifiers.map((pointAwardIdentifier) => {
60
- return {
61
- project: order.project,
62
- typeOf: factory_1.factory.actionType.ReturnAction,
63
- object: {
64
- typeOf: factory_1.factory.assetTransactionType.MoneyTransfer,
65
- identifier: pointAwardIdentifier
66
- },
67
- agent,
68
- potentialActions: {},
69
- purpose,
70
- recipient
71
- };
72
- }));
73
- // 注文口座の数だけ、返却アクションを作成
74
- returnPointAwardActions.push(...awardAccountIdentifiers.map((awardAccountIdentifier) => {
75
- return {
76
- project: order.project,
77
- typeOf: factory_1.factory.actionType.ReturnAction,
78
- object: {
79
- typeOf: factory_1.factory.assetTransactionType.MoneyTransfer,
80
- object: { fromLocation: { identifier: awardAccountIdentifier } }
81
- },
82
- agent,
83
- potentialActions: {},
84
- purpose,
85
- recipient
86
- };
87
- }));
88
- return returnPointAwardActions;
89
- }