@chevre/domain 22.9.0-alpha.46 → 22.9.0-alpha.48

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.
@@ -609,7 +609,8 @@ function searchGMOTrade(params) {
609
609
  const { shopId, shopPass } = yield CreditCardPayment.getGMOInfoFromSeller({
610
610
  paymentMethodType,
611
611
  seller: { id: sellerId },
612
- paymentServiceId
612
+ paymentServiceId,
613
+ requirePaymentAccepted: false
613
614
  })(repos);
614
615
  return CreditCardPayment.searchGMOTrade({
615
616
  availableChannel,
@@ -35,14 +35,16 @@ payTransaction, paymentServiceId, options) {
35
35
  }
36
36
  const availableChannel = yield repos.paymentService.findAvailableChannelCreditCard({
37
37
  project: payTransaction.project,
38
- // typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
39
38
  id: paymentServiceId
40
39
  });
41
40
  const sellerId = (_b = payTransaction.recipient) === null || _b === void 0 ? void 0 : _b.id;
42
41
  if (typeof sellerId !== 'string') {
43
42
  throw new factory.errors.ArgumentNull('recipient.id');
44
43
  }
45
- const { shopId, shopPass, returnUrls3ds, callbackType3ds } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
44
+ const { shopId, shopPass, returnUrls3ds, callbackType3ds } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({
45
+ paymentMethodType, seller: { id: sellerId }, paymentServiceId,
46
+ requirePaymentAccepted: true
47
+ })(repos);
46
48
  // GMOオーダーIDはカスタム指定可能
47
49
  const orderId = payTransaction.transactionNumber;
48
50
  if (typeof orderId !== 'string') {
@@ -13,6 +13,7 @@ declare function getGMOInfoFromSeller(params: {
13
13
  id: string;
14
14
  };
15
15
  paymentServiceId: string;
16
+ requirePaymentAccepted: boolean;
16
17
  }): (repos: {
17
18
  paymentAccepted: SellerPaymentAcceptedRepo;
18
19
  paymentServiceProvider: PaymentServiceProviderRepo;
@@ -14,12 +14,14 @@ const factory = require("../../../factory");
14
14
  function getGMOInfoFromSeller(params) {
15
15
  return (repos) => __awaiter(this, void 0, void 0, function* () {
16
16
  var _a, _b, _c, _d;
17
- const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
18
- seller: { id: params.seller.id },
19
- codeValue: params.paymentMethodType
20
- });
21
- if (paymentAccepted !== true) {
22
- throw new factory.errors.Argument('transaction', `payment not accepted [${params.paymentMethodType}]`);
17
+ if (params.requirePaymentAccepted) {
18
+ const paymentAccepted = yield repos.paymentAccepted.isAcceptedBySeller({
19
+ seller: { id: params.seller.id },
20
+ codeValue: params.paymentMethodType
21
+ });
22
+ if (paymentAccepted !== true) {
23
+ throw new factory.errors.Argument('transaction', `payment not accepted [${params.paymentMethodType}]`);
24
+ }
23
25
  }
24
26
  // 決済サービスからcredentialsを取得する
25
27
  const paymentServices = yield repos.paymentServiceProvider.search({
@@ -37,7 +37,10 @@ function payCreditCard(params) {
37
37
  if (typeof sellerId !== 'string') {
38
38
  throw new factory.errors.ArgumentNull('recipient.id');
39
39
  }
40
- const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
40
+ const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({
41
+ paymentMethodType, seller: { id: sellerId }, paymentServiceId,
42
+ requirePaymentAccepted: true
43
+ })(repos);
41
44
  const action = yield repos.action.start(params);
42
45
  const alterTranResults = [];
43
46
  const processAlterTranResults = [];
@@ -43,8 +43,10 @@ function refundCreditCard(params
43
43
  const paymentMethodId = (_b = params.object[0]) === null || _b === void 0 ? void 0 : _b.paymentMethod.paymentMethodId;
44
44
  const paymentServiceId = (_c = params.object[0]) === null || _c === void 0 ? void 0 : _c.id;
45
45
  let requirePayAction = false;
46
+ let requirePaymentAccepted = false;
46
47
  if (purpose.typeOf === factory.actionType.ReturnAction) {
47
48
  requirePayAction = true;
49
+ requirePaymentAccepted = true;
48
50
  }
49
51
  // 本アクションに対応するPayActionを取り出す(Cinerino側で決済していた時期に関してはpayActionが存在しないので注意)
50
52
  let payAction;
@@ -61,17 +63,16 @@ function refundCreditCard(params
61
63
  alterTranResultByPayAction = (_f = (_e = (_d = payRecipe === null || payRecipe === void 0 ? void 0 : payRecipe.step[0]) === null || _d === void 0 ? void 0 : _d.itemListElement[1]) === null || _e === void 0 ? void 0 : _e.itemListElement[0]) === null || _f === void 0 ? void 0 : _f.afterMedia;
62
64
  }
63
65
  const sellerId = params.agent.id;
64
- const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
66
+ const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({
67
+ paymentMethodType, seller: { id: sellerId }, paymentServiceId,
68
+ requirePaymentAccepted
69
+ })(repos);
65
70
  const availableChannel = yield repos.paymentService.findAvailableChannelCreditCard({
66
71
  project: params.project,
67
72
  id: paymentServiceId
68
73
  });
69
74
  const { sameAs } = params, startingActionParams = __rest(params, ["sameAs"]);
70
75
  const action = yield repos.action.start(Object.assign(Object.assign({}, startingActionParams), (typeof ((_g = params.sameAs) === null || _g === void 0 ? void 0 : _g.id) === 'string') ? { sameAs: { id: params.sameAs.id, typeOf: 'Task' } } : undefined));
71
- // const alterTranResult: (
72
- // actory.action.trade.refund.IAlterTranResult
73
- // | factory.action.trade.refund.IAlterTranResultAsError
74
- // )[] = [];
75
76
  let processAlterTranResult;
76
77
  let recipe;
77
78
  try {
@@ -92,7 +93,6 @@ function refundCreditCard(params
92
93
  if (processAlterTranResult.processAlterTranError === undefined) {
93
94
  if (processAlterTranResult.alterTranResult !== undefined) {
94
95
  // no op
95
- // alterTranResult.push(processAlterTranResult.alterTranResult);
96
96
  }
97
97
  }
98
98
  else {
@@ -121,7 +121,6 @@ function refundCreditCard(params
121
121
  purpose: startingActionParams.purpose,
122
122
  typeOf: action.typeOf
123
123
  })(repos);
124
- // return action;
125
124
  });
126
125
  }
127
126
  function processAlterTran(params) {
@@ -34,14 +34,16 @@ function voidTransaction(params) {
34
34
  const paymentServiceId = String(transaction.object.id);
35
35
  const availableChannel = yield repos.paymentService.findAvailableChannelCreditCard({
36
36
  project: transaction.project,
37
- // typeOf: factory.service.paymentService.PaymentServiceType.CreditCard,
38
37
  id: paymentServiceId
39
38
  });
40
39
  const sellerId = (_b = transaction.recipient) === null || _b === void 0 ? void 0 : _b.id;
41
40
  if (typeof sellerId !== 'string') {
42
41
  throw new factory.errors.ArgumentNull('object.recipient.id');
43
42
  }
44
- const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({ paymentMethodType, seller: { id: sellerId }, paymentServiceId })(repos);
43
+ const { shopId, shopPass } = yield (0, getGMOInfoFromSeller_1.getGMOInfoFromSeller)({
44
+ paymentMethodType, seller: { id: sellerId }, paymentServiceId,
45
+ requirePaymentAccepted: false
46
+ })(repos);
45
47
  // authorizeInvoiceActionが存在すれば取消(2024-06-13~)
46
48
  const authorizeInvoiceAction = (yield repos.action.search({
47
49
  limit: 1,
package/package.json CHANGED
@@ -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.46"
115
+ "version": "22.9.0-alpha.48"
116
116
  }