@chevre/domain 22.6.0-alpha.35 → 22.6.0-alpha.37

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.
@@ -114,7 +114,6 @@ export import IPaymentAgencyTransaction = CreditCardPayment.IPaymentAgencyTransa
114
114
  * 取引開始
115
115
  */
116
116
  export declare function start(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, options: {
117
- useCheckByIdentifierIfNotYet: boolean;
118
117
  pendingPaymentAgencyTransaction?: CreditCardPayment.IPaymentAgencyTransaction;
119
118
  /**
120
119
  * 実行者
@@ -132,6 +131,9 @@ export declare function start(params: factory.assetTransaction.pay.IStartParamsW
132
131
  */
133
132
  id?: string;
134
133
  };
134
+ checkedAction: {
135
+ id: string;
136
+ };
135
137
  }): IStartOperation<factory.assetTransaction.pay.ITransaction>;
136
138
  /**
137
139
  * 取引確定
@@ -221,9 +221,12 @@ function start(params, options) {
221
221
  : undefined))(repos, settings);
222
222
  break;
223
223
  case factory.service.paymentService.PaymentServiceType.MovieTicket:
224
- transaction = yield processAuthorizeMovieTicket(params, transaction, String(paymentService === null || paymentService === void 0 ? void 0 : paymentService.id), options.useCheckByIdentifierIfNotYet, {
224
+ transaction = yield processAuthorizeMovieTicket(params, transaction, String(paymentService === null || paymentService === void 0 ? void 0 : paymentService.id),
225
+ // options.useCheckByIdentifierIfNotYet,
226
+ {
225
227
  executor: (typeof ((_d = options.executor) === null || _d === void 0 ? void 0 : _d.id) === 'string') ? { id: options.executor.id } : {},
226
- purpose: options.purpose
228
+ purpose: options.purpose,
229
+ checkedAction: options.checkedAction
227
230
  })(repos, settings);
228
231
  break;
229
232
  default:
@@ -400,9 +403,11 @@ function processAuthorizeCreditCard(params, transaction, paymentServiceId, optio
400
403
  // })(repos);
401
404
  });
402
405
  }
403
- function processAuthorizeMovieTicket(params, transaction, paymentServiceId, useCheckByIdentifierIfNotYet, options) {
406
+ function processAuthorizeMovieTicket(params, transaction, paymentServiceId,
407
+ // useCheckByIdentifierIfNotYet: boolean,
408
+ options) {
404
409
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
405
- const { accountsReceivablesByServiceType } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, useCheckByIdentifierIfNotYet, options)(repos, settings);
410
+ const { accountsReceivablesByServiceType } = yield MovieTicketPayment.authorize(params, transaction, paymentServiceId, options)(repos, settings);
406
411
  // const payActionInObject: factory.assetTransaction.pay.IPayActionInObject = {
407
412
  // actionStatus: payAction.actionStatus,
408
413
  // id: payAction.id,
@@ -149,8 +149,10 @@ declare function authorize(params: {
149
149
  * アクション失敗時に即時に決済取引を中止するかどうか
150
150
  */
151
151
  useCancelPayTransactionOnFailed: boolean;
152
- useCheckByIdentifierIfNotYet: boolean;
153
152
  useUnlockTransactionProcess: boolean;
153
+ checkedAction: {
154
+ id: string;
155
+ };
154
156
  };
155
157
  sameAs?: {
156
158
  /**
@@ -412,7 +412,9 @@ function authorize(params) {
412
412
  location: params.location,
413
413
  order: Object.assign({}, (typeof confirmationNumber === 'string') ? { confirmationNumber } : undefined)
414
414
  });
415
- payTransaction = yield PayTransactionService.start(startParams, Object.assign({ useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet, executor: (typeof taskId === 'string') ? { id: taskId } : {}, purpose: { id: transaction.id } }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined))(repos, settings);
415
+ payTransaction = yield PayTransactionService.start(startParams, Object.assign({
416
+ // useCheckByIdentifierIfNotYet: params.options.useCheckByIdentifierIfNotYet,
417
+ executor: (typeof taskId === 'string') ? { id: taskId } : {}, purpose: { id: transaction.id }, checkedAction: params.options.checkedAction }, (pendingPaymentAgencyTransaction !== undefined) ? { pendingPaymentAgencyTransaction } : undefined))(repos, settings);
416
418
  }
417
419
  catch (error) {
418
420
  try {
@@ -16,7 +16,7 @@ interface IAuthorizeResult {
16
16
  * 決済カード承認
17
17
  * オーソリサービスが存在するわけではないので、実質着券する
18
18
  */
19
- declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, useCheckByIdentifierIfNotYet: boolean, options: {
19
+ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, transaction: factory.assetTransaction.pay.ITransaction, paymentServiceId: string, options: {
20
20
  /**
21
21
  * 実行者
22
22
  */
@@ -33,6 +33,9 @@ declare function authorize(params: factory.assetTransaction.pay.IStartParamsWith
33
33
  */
34
34
  id?: string;
35
35
  };
36
+ checkedAction: {
37
+ id: string;
38
+ };
36
39
  }): (repos: {
37
40
  action: ActionRepo;
38
41
  accountingReport: AccountingReportRepo;
@@ -18,7 +18,9 @@ const validation_1 = require("./validation");
18
18
  * 決済カード承認
19
19
  * オーソリサービスが存在するわけではないので、実質着券する
20
20
  */
21
- function authorize(params, transaction, paymentServiceId, useCheckByIdentifierIfNotYet, options) {
21
+ function authorize(params, transaction, paymentServiceId,
22
+ // useCheckByIdentifierIfNotYet: boolean,
23
+ options) {
22
24
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
23
25
  var _a, _b;
24
26
  let accountId;
@@ -26,7 +28,7 @@ function authorize(params, transaction, paymentServiceId, useCheckByIdentifierIf
26
28
  let accountsReceivablesByServiceType = [];
27
29
  try {
28
30
  // MovieTicket決済の場合、認証
29
- const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, useCheckByIdentifierIfNotYet, options.purpose)(repos, settings);
31
+ const validateMovieTicketResult = yield (0, validation_1.validateMovieTicket)(params, paymentServiceId, options.checkedAction, options.purpose)(repos, settings);
30
32
  accountsReceivablesByServiceType = validateMovieTicketResult.accountsReceivablesByServiceType;
31
33
  const paymentMethod = transaction.object.paymentMethod;
32
34
  const paymentMethodType = String(paymentMethod === null || paymentMethod === void 0 ? void 0 : paymentMethod.identifier);
@@ -7,7 +7,9 @@ import type { SellerPaymentAcceptedRepo } from '../../../repo/sellerPaymentAccep
7
7
  import type { TaskRepo } from '../../../repo/task';
8
8
  import * as factory from '../../../factory';
9
9
  import { Settings } from '../../../settings';
10
- export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, useCheckByIdentifierIfNotYet: boolean, purpose: {
10
+ export declare function validateMovieTicket(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, paymentServiceId: string, checkedAction: {
11
+ id: string;
12
+ }, purpose: {
11
13
  /**
12
14
  * placeOrder ID
13
15
  */
@@ -15,7 +15,9 @@ const factory = require("../../../factory");
15
15
  const taskIdentifier_1 = require("../../../factory/taskIdentifier");
16
16
  const processPurchaseNumberAuth_1 = require("./processPurchaseNumberAuth");
17
17
  const debug = createDebug('chevre-domain:service:payment');
18
- function validateMovieTicket(params, paymentServiceId, useCheckByIdentifierIfNotYet, purpose) {
18
+ function validateMovieTicket(params, paymentServiceId,
19
+ // useCheckByIdentifierIfNotYet: boolean,
20
+ checkedAction, purpose) {
19
21
  // tslint:disable-next-line:max-func-body-length
20
22
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
21
23
  var _a, _b, _c;
@@ -81,7 +83,8 @@ function validateMovieTicket(params, paymentServiceId, useCheckByIdentifierIfNot
81
83
  seller: { id: sellerId },
82
84
  screeningEvent: screeningEvent,
83
85
  paymentServiceId,
84
- useCheckByIdentifierIfNotYet,
86
+ // useCheckByIdentifierIfNotYet,
87
+ checkedAction,
85
88
  purpose
86
89
  })(repos, settings);
87
90
  const accountsReceivablesByServiceType = [];
@@ -113,34 +116,40 @@ function validateMovieTicket(params, paymentServiceId, useCheckByIdentifierIfNot
113
116
  exports.validateMovieTicket = validateMovieTicket;
114
117
  function checkByIdentifierIfNotYet(params) {
115
118
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
116
- var _a, _b;
119
+ var _a, _b, _c;
117
120
  let checkResult;
118
- if (params.useCheckByIdentifierIfNotYet === true) {
119
- // すでにCheckActionが存在すれば認証しない(2023-06-06~)
120
- let alreadyCheckedAction;
121
- // search from checkMovieTicketTask(2024-06-26~)
122
- const placeOrderId = params.purpose.id;
123
- if (typeof placeOrderId === 'string') {
124
- if (settings.useExperimentalFeature) {
125
- const taskIdentifier = (0, taskIdentifier_1.createCheckMovieTicketTaskIdentifier)({
126
- project: { id: params.screeningEvent.project.id },
127
- purpose: { id: placeOrderId },
128
- object: {
129
- id: params.paymentServiceId,
130
- movieTicket: {
131
- identifier: params.movieTicketIdentifier,
132
- serviceOutput: { reservationFor: { id: params.screeningEvent.id } }
133
- }
121
+ let alreadyCheckedAction; // すでにCheckActionが存在すれば認証しない(2023-06-06~)
122
+ // search from checkMovieTicketTask(2024-06-26~)
123
+ const placeOrderId = params.purpose.id;
124
+ if (typeof placeOrderId === 'string') {
125
+ if (settings.useExperimentalFeature) {
126
+ const taskIdentifier = (0, taskIdentifier_1.createCheckMovieTicketTaskIdentifier)({
127
+ project: { id: params.screeningEvent.project.id },
128
+ purpose: { id: placeOrderId },
129
+ object: {
130
+ id: params.paymentServiceId,
131
+ movieTicket: {
132
+ identifier: params.movieTicketIdentifier,
133
+ serviceOutput: { reservationFor: { id: params.screeningEvent.id } }
134
134
  }
135
- });
136
- const existingCheckMovieTicketTask = yield repos.task.findByIdentifier({
137
- project: { id: params.screeningEvent.project.id },
138
- name: factory.taskName.CheckMovieTicket,
139
- identifier: taskIdentifier
140
- });
141
- debug('existingCheckMovieTicketTask:', JSON.stringify(existingCheckMovieTicketTask), 'placeOrderId:', placeOrderId);
142
- }
135
+ }
136
+ });
137
+ const existingCheckMovieTicketTask = yield repos.task.findByIdentifier({
138
+ project: { id: params.screeningEvent.project.id },
139
+ name: factory.taskName.CheckMovieTicket,
140
+ identifier: taskIdentifier
141
+ });
142
+ debug('existingCheckMovieTicketTask:', JSON.stringify(existingCheckMovieTicketTask), 'placeOrderId:', placeOrderId);
143
143
  }
144
+ }
145
+ const specifiedCheckedActionId = (_a = params.checkedAction) === null || _a === void 0 ? void 0 : _a.id;
146
+ if (typeof specifiedCheckedActionId === 'string' && specifiedCheckedActionId !== '') {
147
+ alreadyCheckedAction = (yield repos.action.search(Object.assign({ limit: 1, page: 1, id: { $in: [specifiedCheckedActionId] }, actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] } }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'])).shift();
148
+ if (alreadyCheckedAction === undefined) {
149
+ throw new factory.errors.NotFound(factory.actionType.CheckAction);
150
+ }
151
+ }
152
+ else {
144
153
  alreadyCheckedAction = (yield repos.action.search(Object.assign({ limit: 1, page: 1, sort: { startDate: factory.sortType.Descending }, typeOf: { $eq: factory.actionType.CheckAction }, actionStatus: { $in: [factory.actionStatusType.CompletedActionStatus] }, object: {
145
154
  typeOf: { $eq: factory.service.paymentService.PaymentServiceType.MovieTicket },
146
155
  id: { $eq: params.paymentServiceId },
@@ -152,20 +161,18 @@ function checkByIdentifierIfNotYet(params) {
152
161
  }
153
162
  } }, (typeof placeOrderId === 'string') ? { purpose: { id: { $in: [placeOrderId] } } } : undefined), ['id'])).shift();
154
163
  debug('alreadyCheckedAction:', JSON.stringify(alreadyCheckedAction), 'placeOrderId:', placeOrderId);
155
- if (alreadyCheckedAction !== undefined) {
156
- const recipe = yield repos.action.findRecipeByAction({
157
- project: { id: params.screeningEvent.project.id },
158
- recipeFor: { id: alreadyCheckedAction.id }
159
- });
160
- const directionPurchaseNumberAuth = (_b = (_a = recipe === null || recipe === void 0 ? void 0 : recipe.step[0]) === null || _a === void 0 ? void 0 : _a.itemListElement[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0];
161
- if (directionPurchaseNumberAuth !== undefined) {
162
- debug('alreadyCheckedAction.directionPurchaseNumberAuth found', directionPurchaseNumberAuth.typeOf, 'movieTicketIdentifier:', params.movieTicketIdentifier, 'screeningEvent.id:', params.screeningEvent.id);
163
- const { beforeMedia, afterMedia } = directionPurchaseNumberAuth;
164
- if (beforeMedia !== undefined && afterMedia !== undefined) {
165
- checkResult = { purchaseNumberAuthIn: beforeMedia, purchaseNumberAuthResult: afterMedia };
166
- }
164
+ }
165
+ if (alreadyCheckedAction !== undefined) {
166
+ const recipe = yield repos.action.findRecipeByAction({
167
+ project: { id: params.screeningEvent.project.id },
168
+ recipeFor: { id: alreadyCheckedAction.id }
169
+ });
170
+ const directionPurchaseNumberAuth = (_c = (_b = recipe === null || recipe === void 0 ? void 0 : recipe.step[0]) === null || _b === void 0 ? void 0 : _b.itemListElement[0]) === null || _c === void 0 ? void 0 : _c.itemListElement[0];
171
+ if (directionPurchaseNumberAuth !== undefined) {
172
+ const { beforeMedia, afterMedia } = directionPurchaseNumberAuth;
173
+ if (beforeMedia !== undefined && afterMedia !== undefined) {
174
+ checkResult = { purchaseNumberAuthIn: beforeMedia, purchaseNumberAuthResult: afterMedia };
167
175
  }
168
- // checkResult = alreadyCheckedAction.shift()?.result;
169
176
  }
170
177
  }
171
178
  if (checkResult === undefined) {
package/package.json CHANGED
@@ -11,8 +11,8 @@
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": "4.389.0-alpha.22",
15
- "@cinerino/sdk": "10.16.0-alpha.9",
14
+ "@chevre/factory": "4.389.0",
15
+ "@cinerino/sdk": "10.17.0",
16
16
  "@motionpicture/coa-service": "9.6.0-alpha.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
18
18
  "@sendgrid/mail": "6.4.0",
@@ -108,5 +108,5 @@
108
108
  "postversion": "git push origin --tags",
109
109
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
110
110
  },
111
- "version": "22.6.0-alpha.35"
111
+ "version": "22.6.0-alpha.37"
112
112
  }