@chevre/domain 22.9.0-alpha.18 → 22.9.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.
@@ -81,7 +81,9 @@ export type IPublishPaymentUrlResult = CreditCardPayment.IPaymentAgencyTransacti
81
81
  /**
82
82
  * 決済ロケーション発行
83
83
  */
84
- export declare function publishPaymentUrl(params: factory.assetTransaction.pay.IStartParamsWithoutDetail, options: {
84
+ export declare function publishPaymentUrl(params: Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'agent' | 'location' | 'project' | 'recipient' | 'transactionNumber' | 'typeOf'> & {
85
+ object: factory.action.accept.pay.IPayObject;
86
+ }, options: {
85
87
  purposeAsTransaction: {
86
88
  id: string;
87
89
  };
@@ -65,7 +65,7 @@ function publishPaymentUrlResult2recipe(params) {
65
65
  function publishPaymentUrl(params, options) {
66
66
  // tslint:disable-next-line:max-func-body-length
67
67
  return (repos, settings) => __awaiter(this, void 0, void 0, function* () {
68
- var _a, _b, _c, _d, _e;
68
+ var _a, _b, _c, _d, _e, _f;
69
69
  const paymentServiceType = (_a = params.object) === null || _a === void 0 ? void 0 : _a.typeOf;
70
70
  // 金額をfix
71
71
  const amount = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.amount;
@@ -81,12 +81,14 @@ function publishPaymentUrl(params, options) {
81
81
  const paymentServiceId = getPaymentServiceId(params);
82
82
  // 決済受入アクション生成(2024-03-28~)
83
83
  const taskId = (_c = options === null || options === void 0 ? void 0 : options.executor) === null || _c === void 0 ? void 0 : _c.id;
84
- const actionAttributes = Object.assign({ project: params.project, typeOf: factory.actionType.AcceptAction, agent: params.agent, object: {
84
+ const actionAttributes = Object.assign(Object.assign({ project: params.project, typeOf: factory.actionType.AcceptAction, agent: params.agent, object: {
85
85
  object: params.object,
86
86
  transactionNumber,
87
87
  typeOf: params.typeOf
88
88
  }, purpose: { typeOf: factory.transactionType.PlaceOrder, id: options.purposeAsTransaction.id } }, (typeof taskId === 'string')
89
89
  ? { sameAs: { id: taskId, typeOf: 'Task' } } // タスク関連付け(2024-05-22~)
90
+ : undefined), (typeof ((_d = params.location) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
91
+ ? { location: params.location }
90
92
  : undefined);
91
93
  const action = yield repos.action.start(actionAttributes);
92
94
  let result;
@@ -97,11 +99,11 @@ function publishPaymentUrl(params, options) {
97
99
  const authorizeResult = yield CreditCardPayment.authorize(Object.assign(Object.assign({}, params), { id: '' // 決済URL発行プロセスにおいては決済取引IDは使用しないので空文字でok
98
100
  }), paymentServiceId, {
99
101
  processPublishPaymentUrl: true,
100
- executor: (typeof ((_d = options.executor) === null || _d === void 0 ? void 0 : _d.id) === 'string') ? { id: options.executor.id } : {} // タスク関連付け(2024-05-22~)
102
+ executor: (typeof ((_e = options.executor) === null || _e === void 0 ? void 0 : _e.id) === 'string') ? { id: options.executor.id } : {} // タスク関連付け(2024-05-22~)
101
103
  })(repos, settings);
102
104
  let paymentUrl;
103
105
  // 3DS拡張(2024-01-02~)
104
- const retUrl = (_e = params.object.paymentMethod.creditCard) === null || _e === void 0 ? void 0 : _e.retUrl;
106
+ const retUrl = (_f = params.object.paymentMethod.creditCard) === null || _f === void 0 ? void 0 : _f.retUrl;
105
107
  if (typeof retUrl === 'string' && retUrl.length > 0) {
106
108
  paymentUrl = authorizeResult.execTranResult.redirectUrl;
107
109
  }
@@ -316,19 +318,6 @@ function validateSeller(params) {
316
318
  if (typeof sellerId !== 'string') {
317
319
  throw new factory.errors.ArgumentNull('recipient.id');
318
320
  }
319
- // const sellers = <Pick<factory.seller.ISeller, 'paymentAccepted'>[]>await repos.seller.search(
320
- // {
321
- // limit: 1,
322
- // page: 1,
323
- // id: { $eq: sellerId }
324
- // },
325
- // ['paymentAccepted'],
326
- // []
327
- // );
328
- // const seller = sellers.shift();
329
- // if (seller === undefined) {
330
- // throw new factory.errors.NotFound(factory.organizationType.Corporation);
331
- // }
332
321
  const paymentMethodType = (_b = params.object.paymentMethod) === null || _b === void 0 ? void 0 : _b.identifier;
333
322
  if (typeof paymentMethodType !== 'string') {
334
323
  throw new factory.errors.ArgumentNull('object.paymentMethod.identifier');
@@ -10,6 +10,16 @@ export interface IOnPaymentStatusChangedRefundAction {
10
10
  object: factory.invoice.IInvoice[];
11
11
  }
12
12
  export type IOnPaymentStatusChangedParams = IOnPaymentStatusChangedPayAction | IOnPaymentStatusChangedRefundAction;
13
+ export declare function creatPublishPaymentUrlParams(params: {
14
+ accountId?: string;
15
+ object: Pick<factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod'>;
16
+ paymentServiceType: factory.service.paymentService.PaymentServiceType;
17
+ transaction: Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'expires' | 'seller' | 'project'>;
18
+ transactionNumber: string;
19
+ location?: factory.action.trade.pay.ILocation;
20
+ }): Pick<factory.assetTransaction.pay.IStartParamsWithoutDetail, 'agent' | 'location' | 'project' | 'recipient' | 'transactionNumber' | 'typeOf'> & {
21
+ object: factory.action.accept.pay.IPayObject;
22
+ };
13
23
  export declare function creatPayTransactionStartParams(params: {
14
24
  accountId?: string;
15
25
  object: factory.action.authorize.paymentMethod.any.IObjectIncludingPaymentMethodDetails;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.creatPublishPaymentUrlParams = creatPublishPaymentUrlParams;
3
4
  exports.creatPayTransactionStartParams = creatPayTransactionStartParams;
4
5
  exports.createMovieTicket = createMovieTicket;
5
6
  exports.createAuthorizeResult = createAuthorizeResult;
@@ -7,6 +8,38 @@ exports.optimizeAction4inform = optimizeAction4inform;
7
8
  const moment = require("moment");
8
9
  const util = require("util");
9
10
  const factory = require("../../../factory");
11
+ function creatPublishPaymentUrlParams(params) {
12
+ var _a, _b, _c, _d;
13
+ const issuedThroughId = (_a = params.object.issuedThrough) === null || _a === void 0 ? void 0 : _a.id;
14
+ // const accountId: string | undefined = (typeof params.accountId === 'string')
15
+ // ? params.accountId
16
+ // : (typeof params.object.accountId === 'string') ? params.object.accountId : undefined;
17
+ // const movieTickets: factory.action.trade.pay.IMovieTicket[] | undefined
18
+ // = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(createMovieTicket) : undefined;
19
+ const paymentMethod = Object.assign(Object.assign({ identifier: params.object.paymentMethod, amount: params.object.amount }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined
20
+ // ...(Array.isArray(movieTickets)) ? { movieTickets } : undefined
21
+ );
22
+ const object = {
23
+ typeOf: params.paymentServiceType,
24
+ id: issuedThroughId,
25
+ paymentMethod
26
+ };
27
+ return Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
28
+ typeOf: params.transaction.seller.typeOf,
29
+ id: params.transaction.seller.id,
30
+ name: (typeof params.transaction.seller.name === 'string')
31
+ ? params.transaction.seller.name
32
+ : String((_b = params.transaction.seller.name) === null || _b === void 0 ? void 0 : _b.ja)
33
+ }, recipient: {
34
+ id: params.transaction.seller.id,
35
+ name: (typeof params.transaction.seller.name === 'string')
36
+ ? params.transaction.seller.name
37
+ : String((_c = params.transaction.seller.name) === null || _c === void 0 ? void 0 : _c.ja),
38
+ typeOf: params.transaction.seller.typeOf
39
+ }, object }, (typeof ((_d = params.location) === null || _d === void 0 ? void 0 : _d.typeOf) === 'string')
40
+ ? { location: params.location }
41
+ : undefined);
42
+ }
10
43
  function creatPayTransactionStartParams(params) {
11
44
  var _a, _b, _c, _d;
12
45
  let expires = moment(params.transaction.expires)
@@ -26,7 +59,6 @@ function creatPayTransactionStartParams(params) {
26
59
  const accountId = (typeof params.accountId === 'string')
27
60
  ? params.accountId
28
61
  : (typeof params.object.accountId === 'string') ? params.object.accountId : undefined;
29
- // movieTickets最適化(2023-02-24~)
30
62
  const movieTickets = (Array.isArray(params.object.movieTickets)) ? params.object.movieTickets.map(createMovieTicket) : undefined;
31
63
  return Object.assign({ project: { id: params.transaction.project.id, typeOf: factory.organizationType.Project }, typeOf: factory.assetTransactionType.Pay, transactionNumber: params.transactionNumber, agent: {
32
64
  typeOf: params.transaction.seller.typeOf,
@@ -51,11 +83,8 @@ function creatPayTransactionStartParams(params) {
51
83
  typeOf: params.transaction.seller.typeOf
52
84
  }, object: {
53
85
  typeOf: params.paymentServiceType,
54
- // 決済サービスIDを連携(2022-04-12~)
55
86
  id: issuedThroughId,
56
- paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: params.object.paymentMethod,
57
- // typeOf: params.object.paymentMethod, // identifierへ移行(2023-08-30~)
58
- amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined)
87
+ paymentMethod: Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ identifier: params.object.paymentMethod, amount: params.object.amount, additionalProperty: (Array.isArray(params.object.additionalProperty)) ? params.object.additionalProperty : [] }, (typeof params.object.method === 'string') ? { method: params.object.method } : undefined), (typeof params.object.name === 'string') ? { name: params.object.name } : undefined), (typeof accountId === 'string') ? { accountId } : undefined), (typeof params.object.description === 'string') ? { description: params.object.description } : undefined), (typeof params.object.fromLocation === 'string') ? { fromLocation: params.object.fromLocation } : undefined), (params.object.creditCard !== undefined) ? { creditCard: params.object.creditCard } : undefined), (Array.isArray(movieTickets)) ? { movieTickets } : undefined)
59
88
  }, expires: expires, purpose: {
60
89
  typeOf: factory.order.OrderType.Order,
61
90
  confirmationNumber
@@ -97,7 +97,6 @@ interface IPublishPaymentUrlRepos {
97
97
  action: ActionRepo;
98
98
  assetTransaction: AssetTransactionRepo;
99
99
  authorization: AuthorizationRepo;
100
- confirmationNumber: ConfirmationNumberRepo;
101
100
  paymentAccepted: SellerPaymentAcceptedRepo;
102
101
  paymentService: PaymentServiceRepo;
103
102
  paymentServiceProvider: PaymentServiceProviderRepo;
@@ -119,7 +118,7 @@ declare function publishPaymentUrl(params: {
119
118
  agent: {
120
119
  id: string;
121
120
  };
122
- object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod' | 'ticketToken'>;
121
+ object: Pick<IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'method' | 'paymentMethod'>;
123
122
  purpose: factory.action.authorize.paymentMethod.any.IPurpose;
124
123
  paymentServiceType: factory.service.paymentService.PaymentServiceType;
125
124
  location: factory.action.trade.pay.ILocation;
@@ -238,7 +238,6 @@ function publishPaymentUrl(params) {
238
238
  }
239
239
  try {
240
240
  const transaction = yield repos.transaction.projectFieldsInProgressById({ typeOf: purpose.typeOf, id: purpose.id }, ['expires', 'seller', 'project']);
241
- const { confirmationNumber } = yield (0, fixConfirmationNumberAsNeeded_1.fixConfirmationNumberAsNeeded)({ purpose, paymentServiceType })(repos);
242
241
  // 取引番号生成
243
242
  let transactionNumber;
244
243
  // support ticketToken(2024-08-21~)
@@ -256,13 +255,12 @@ function publishPaymentUrl(params) {
256
255
  let result;
257
256
  // URL発行
258
257
  const authorizeObject = Object.assign(Object.assign({}, params.object), { accountId: '', paymentMethodId: transactionNumber, typeOf: factory.action.authorize.paymentMethod.any.ResultType.Payment });
259
- const startParams = (0, factory_1.creatPayTransactionStartParams)({
258
+ const startParams = (0, factory_1.creatPublishPaymentUrlParams)({
260
259
  object: authorizeObject,
261
260
  paymentServiceType,
262
261
  transaction: transaction,
263
262
  transactionNumber: transactionNumber,
264
- location: params.location,
265
- order: { confirmationNumber }
263
+ location: params.location
266
264
  });
267
265
  const taskId = (_a = params.sameAs) === null || _a === void 0 ? void 0 : _a.id;
268
266
  result = yield PayTransactionService.publishPaymentUrl(startParams, {
@@ -14,7 +14,6 @@ const factory = require("../../factory");
14
14
  const action_1 = require("../../repo/action");
15
15
  const assetTransaction_1 = require("../../repo/assetTransaction");
16
16
  const authorization_1 = require("../../repo/authorization");
17
- const confirmationNumber_1 = require("../../repo/confirmationNumber");
18
17
  const paymentService_1 = require("../../repo/paymentService");
19
18
  const paymentServiceProvider_1 = require("../../repo/paymentServiceProvider");
20
19
  const sellerPaymentAccepted_1 = require("../../repo/sellerPaymentAccepted");
@@ -42,7 +41,6 @@ function call(params) {
42
41
  action: actionRepo,
43
42
  assetTransaction: new assetTransaction_1.AssetTransactionRepo(connection),
44
43
  authorization: new authorization_1.AuthorizationRepo(connection),
45
- confirmationNumber: new confirmationNumber_1.ConfirmationNumberRepo(redisClient),
46
44
  paymentAccepted: new sellerPaymentAccepted_1.SellerPaymentAcceptedRepo(connection),
47
45
  paymentService: new paymentService_1.PaymentServiceRepo(connection),
48
46
  paymentServiceProvider: new paymentServiceProvider_1.PaymentServiceProviderRepo(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": "4.393.0-alpha.13",
14
+ "@chevre/factory": "4.393.0-alpha.14",
15
15
  "@cinerino/sdk": "10.21.0-alpha.12",
16
16
  "@motionpicture/coa-service": "9.6.0",
17
17
  "@motionpicture/gmo-service": "5.3.0",
@@ -112,5 +112,5 @@
112
112
  "postversion": "git push origin --tags",
113
113
  "prepublishOnly": "npm run clean && npm run build && npm test && npm run doc"
114
114
  },
115
- "version": "22.9.0-alpha.18"
115
+ "version": "22.9.0-alpha.19"
116
116
  }