@chevre/domain 24.0.0-alpha.68 → 24.0.0-alpha.69

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.
@@ -103,7 +103,6 @@ import type { TripRepo } from './repo/trip';
103
103
  import type { WebSiteRepo } from './repo/webSite';
104
104
  import type { ConfirmationNumberRepo } from './repo/confirmationNumber';
105
105
  import type { OrderNumberRepo } from './repo/orderNumber';
106
- import type { CreditCardRepo } from './repo/paymentMethod/creditCard';
107
106
  import type { PersonRepo } from './repo/person';
108
107
  export type AcceptedOffer = AcceptedOfferRepo;
109
108
  export declare namespace AcceptedOffer {
@@ -357,15 +356,6 @@ export type PendingReservation = PendingReservationRepo;
357
356
  export declare namespace PendingReservation {
358
357
  function createInstance(...params: ConstructorParameters<typeof PendingReservationRepo>): Promise<PendingReservationRepo>;
359
358
  }
360
- export declare namespace paymentMethod {
361
- /**
362
- * クレジットカードリポジトリ
363
- */
364
- type CreditCard = CreditCardRepo;
365
- namespace CreditCard {
366
- function createInstance(...params: ConstructorParameters<typeof CreditCardRepo>): Promise<CreditCardRepo>;
367
- }
368
- }
369
359
  export type Person = PersonRepo;
370
360
  export declare namespace Person {
371
361
  function createInstance(...params: ConstructorParameters<typeof PersonRepo>): Promise<PersonRepo>;
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.PaymentServiceChannel = exports.PaymentService = exports.Passport = exports.OwnershipInfo = exports.OrderNumber = exports.OrderInTransaction = exports.Order = exports.Offer = exports.OfferItemCondition = exports.OfferCatalogItem = exports.OfferCatalog = exports.NoteAboutOrder = exports.Note = exports.MovieTicketType = exports.Message = exports.MerchantReturnPolicy = exports.MemberProgram = exports.Member = exports.Issuer = exports.IdentityProvider = exports.Identity = exports.EventSeries = exports.EventSellerMakesOffer = exports.EventOffer = exports.Event = exports.EmailMessage = exports.CustomerType = exports.Customer = exports.Credentials = exports.CreativeWork = exports.ConfirmationNumber = exports.Comment = exports.Authorization = exports.CategoryCode = exports.assetTransaction = exports.AssetTransaction = exports.Aggregation = exports.AggregateReservation = exports.AggregateOrder = exports.AggregateOffer = exports.AggregateAction = exports.AdvanceBookingRequirement = exports.AdditionalProperty = exports.action = exports.Action = exports.AccountTransaction = exports.AccountTitle = exports.AccountingReport = exports.Account = exports.AcceptedOffer = void 0;
27
- exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.paymentMethod = exports.PendingReservation = exports.PaymentServiceProvider = void 0;
27
+ exports.WebSite = exports.rateLimit = exports.Trip = exports.TransactionProcess = exports.TransactionNumber = exports.transaction = exports.Transaction = exports.Ticket = exports.Task = exports.StockHolder = exports.setting = exports.Setting = exports.ServiceOutputIdentifier = exports.ServiceOutput = exports.ServiceAvailableHour = exports.SellerReturnPolicy = exports.SellerPaymentAccepted = exports.SellerMakesOffer = exports.Seller = exports.Schedule = exports.Role = exports.ReserveInterface = exports.Reservation = exports.ProjectMakesOffer = exports.Project = exports.ProductOffer = exports.ProductModel = exports.ProductHasOfferCatalog = exports.Product = exports.PriceSpecification = exports.PotentialAction = exports.place = exports.Permit = exports.Person = exports.PendingReservation = exports.PaymentServiceProvider = void 0;
28
28
  var AcceptedOffer;
29
29
  (function (AcceptedOffer) {
30
30
  let repo;
@@ -713,20 +713,6 @@ var PendingReservation;
713
713
  }
714
714
  PendingReservation.createInstance = createInstance;
715
715
  })(PendingReservation || (exports.PendingReservation = PendingReservation = {}));
716
- var paymentMethod;
717
- (function (paymentMethod) {
718
- let CreditCard;
719
- (function (CreditCard) {
720
- let repo;
721
- async function createInstance(...params) {
722
- if (repo === undefined) {
723
- repo = (await Promise.resolve().then(() => __importStar(require('./repo/paymentMethod/creditCard')))).CreditCardRepo;
724
- }
725
- return new repo(...params);
726
- }
727
- CreditCard.createInstance = createInstance;
728
- })(CreditCard = paymentMethod.CreditCard || (paymentMethod.CreditCard = {}));
729
- })(paymentMethod || (exports.paymentMethod = paymentMethod = {}));
730
716
  var Person;
731
717
  (function (Person) {
732
718
  let repo;
@@ -7,5 +7,5 @@ import { factory } from '../../../../factory';
7
7
  */
8
8
  declare function createOnOrderCancelledTasksByTransaction(params: {
9
9
  transaction: Pick<factory.transaction.placeOrder.ITransaction, 'id' | 'project' | 'typeOf'>;
10
- }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
10
+ }): (import("@chevre/factory/lib/task").ITaskAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
11
11
  export { createOnOrderCancelledTasksByTransaction };
@@ -13,5 +13,5 @@ declare function createInformTasks(params: {
13
13
  }, setting: Pick<ISetting, 'onOrderStatusChanged'> | null): factory.task.IAttributes<factory.taskName.TriggerWebhook>[];
14
14
  declare function createNextSendOrderTasks(params: {
15
15
  order: IInTransitOrder;
16
- }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
16
+ }): (import("@chevre/factory/lib/task").ITaskAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
17
17
  export { createInformTasks, createNextSendOrderTasks, IInTransitOrder };
@@ -11,5 +11,5 @@ declare function createInformTasks(order: IReturnedOrder, returnOrderAction: IRe
11
11
  declare function createOnOrderReturnedTasksByTransaction(params: {
12
12
  order: Pick<factory.order.IOrder, 'project' | 'typeOf' | 'orderNumber' | 'customer' | 'price' | 'priceCurrency' | 'orderDate'>;
13
13
  potentialActions?: factory.action.transfer.returnAction.order.IPotentialActions;
14
- }): (import("@chevre/factory/lib/task").IAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
14
+ }): (import("@chevre/factory/lib/task").ITaskAttributes | import("@chevre/factory/lib/task/confirmRegisterService").IAttributes | import("@chevre/factory/lib/task/confirmPayTransaction").IAttributes | import("@chevre/factory/lib/task/confirmRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/confirmReserveTransaction").IAttributes | import("@chevre/factory/lib/task/createAccountingReport").IAttributes | import("@chevre/factory/lib/task/deletePerson").IAttributes | import("@chevre/factory/lib/task/deleteTransaction").IAttributes | import("@chevre/factory/lib/task/givePointAward").IAttributes | import("@chevre/factory/lib/task/onAssetTransactionStatusChanged").IAttributes | import("@chevre/factory/lib/task/onAuthorizationCreated").IAttributes | import("@chevre/factory/lib/task/onEventChanged").IAttributes | import("@chevre/factory/lib/task/onResourceDeleted").IAttributes | import("@chevre/factory/lib/task/onResourceUpdated").IAttributes | import("@chevre/factory/lib/task/onOrderPaymentCompleted").IAttributes | import("@chevre/factory/lib/task/placeOrder").IAttributes | import("@chevre/factory/lib/task/returnOrder").IAttributes | import("@chevre/factory/lib/task/returnPayTransaction").IAttributes | import("@chevre/factory/lib/task/returnPointAward").IAttributes | import("@chevre/factory/lib/task/returnReserveTransaction").IAttributes | import("@chevre/factory/lib/task/sendEmailMessage").IAttributes | import("@chevre/factory/lib/task/sendOrder").IAttributes | import("@chevre/factory/lib/task/triggerWebhook").IAttributes | import("@chevre/factory/lib/task/useReservation").IAttributes | import("@chevre/factory/lib/task/voidPayTransaction").IAttributes | import("@chevre/factory/lib/task/voidRegisterServiceTransaction").IAttributes | import("@chevre/factory/lib/task/voidReserveTransaction").IAttributes)[];
15
15
  export { createInformTasks, createOnOrderReturnedTasksByTransaction, IReturnAction };
@@ -12,7 +12,7 @@ function processAuthorizeCreditCard(params) {
12
12
  let execTranResult;
13
13
  const { shopId, shopPass, orderId } = params;
14
14
  const creditCard = params.object.creditCard;
15
- const { cardSeq, memberId } = creditCard;
15
+ // const { cardSeq, memberId } = creditCard as IUnauthorizedCardOfMember; // 会員カード廃止(2026-04-07~)
16
16
  const { cardNo, cardPass, expire } = creditCard;
17
17
  const { token } = creditCard;
18
18
  const retUrl = creditCard?.retUrl;
@@ -31,15 +31,15 @@ function processAuthorizeCreditCard(params) {
31
31
  }
32
32
  entryTranArgs = {
33
33
  shopId, shopPass, orderId,
34
- jobCd: gmo_service_1.GMO.utils.util.JobCd.Auth,
34
+ jobCd: gmo_service_1.GMO.factory.util.JobCd.Auth,
35
35
  amount: (typeof params.object.amount === 'number')
36
36
  ? params.object.amount
37
37
  : params.object.amount.value,
38
38
  // siteId: params.availableChannel.credentials?.siteId,
39
39
  // sitePass: params.availableChannel.credentials?.sitePass,
40
- tdFlag: gmo_service_1.GMO.utils.util.TdFlag.Version2,
40
+ tdFlag: gmo_service_1.GMO.factory.util.TdFlag.Version2,
41
41
  // tdTenantName: '',
42
- tds2Type: gmo_service_1.GMO.utils.util.Tds2Type.Error
42
+ tds2Type: gmo_service_1.GMO.factory.util.Tds2Type.Error
43
43
  };
44
44
  entryTranResult = await repos.creditCardService.entryTran(entryTranArgs);
45
45
  execTranArgs = {
@@ -49,22 +49,22 @@ function processAuthorizeCreditCard(params) {
49
49
  method: params.object.method,
50
50
  siteId: params.availableChannel.credentials?.siteId,
51
51
  sitePass: params.availableChannel.credentials?.sitePass,
52
- seqMode: gmo_service_1.GMO.utils.util.SeqMode.Physics,
52
+ seqMode: gmo_service_1.GMO.factory.util.SeqMode.Physics,
53
53
  retUrl,
54
- callbackType: (params.callbackType3ds === 'GET') ? gmo_service_1.GMO.utils.util.CallbackType.Get : gmo_service_1.GMO.utils.util.CallbackType.Post,
54
+ callbackType: (params.callbackType3ds === 'GET') ? gmo_service_1.GMO.factory.util.CallbackType.Get : gmo_service_1.GMO.factory.util.CallbackType.Post,
55
55
  ...(typeof cardNo === 'string') ? { cardNo } : undefined,
56
56
  ...(typeof cardPass === 'string') ? { cardPass } : undefined,
57
57
  ...(typeof expire === 'string') ? { expire } : undefined,
58
58
  ...(typeof token === 'string') ? { token } : undefined,
59
- ...(typeof memberId === 'string') ? { memberId } : undefined,
60
- ...(typeof cardSeq === 'number') ? { cardSeq } : undefined
59
+ // ...(typeof memberId === 'string') ? { memberId } : undefined, // 会員カード廃止(2026-04-07~)
60
+ // ...(typeof cardSeq === 'number') ? { cardSeq } : undefined // 会員カード廃止(2026-04-07~)
61
61
  };
62
62
  execTranResult = await repos.creditCardService.execTran3ds(execTranArgs);
63
63
  }
64
64
  else {
65
65
  entryTranArgs = {
66
66
  shopId, shopPass, orderId,
67
- jobCd: gmo_service_1.GMO.utils.util.JobCd.Auth,
67
+ jobCd: gmo_service_1.GMO.factory.util.JobCd.Auth,
68
68
  amount: (typeof params.object.amount === 'number')
69
69
  ? params.object.amount
70
70
  : params.object.amount.value,
@@ -96,13 +96,13 @@ function processAuthorizeCreditCard(params) {
96
96
  method: params.object.method,
97
97
  siteId: params.availableChannel.credentials?.siteId,
98
98
  sitePass: params.availableChannel.credentials?.sitePass,
99
- seqMode: gmo_service_1.GMO.utils.util.SeqMode.Physics,
99
+ seqMode: gmo_service_1.GMO.factory.util.SeqMode.Physics,
100
100
  ...(typeof cardNo === 'string') ? { cardNo } : undefined,
101
101
  ...(typeof cardPass === 'string') ? { cardPass } : undefined,
102
102
  ...(typeof expire === 'string') ? { expire } : undefined,
103
103
  ...(typeof token === 'string') ? { token } : undefined,
104
- ...(typeof memberId === 'string') ? { memberId } : undefined,
105
- ...(typeof cardSeq === 'number') ? { cardSeq } : undefined
104
+ // ...(typeof memberId === 'string') ? { memberId } : undefined, // 会員カード廃止(2026-04-07~)
105
+ // ...(typeof cardSeq === 'number') ? { cardSeq } : undefined // 会員カード廃止(2026-04-07~)
106
106
  };
107
107
  execTranResult = await repos.creditCardService.execTran(execTranArgs);
108
108
  }
@@ -113,28 +113,28 @@ function processAlterTran(params) {
113
113
  throw new factory_1.factory.errors.ArgumentNull('object.paymentMethod.totalPaymentDue?.value');
114
114
  }
115
115
  switch (jobCd) {
116
- case gmo_service_1.GMO.utils.util.JobCd.Capture:
117
- case gmo_service_1.GMO.utils.util.JobCd.Sales:
116
+ case gmo_service_1.GMO.factory.util.JobCd.Capture:
117
+ case gmo_service_1.GMO.factory.util.JobCd.Sales:
118
118
  // すでに即時売上済み
119
119
  alterTranResult = { accessId, accessPass, forward, approve, tranId, tranDate: '' };
120
120
  break;
121
- case gmo_service_1.GMO.utils.util.JobCd.Void:
121
+ case gmo_service_1.GMO.factory.util.JobCd.Void:
122
122
  // 返品手数料決済の場合を追加(状態が取消であれば即時売上)
123
123
  alterTranArgs = {
124
124
  shopId, shopPass, accessId, accessPass,
125
- jobCd: gmo_service_1.GMO.utils.util.JobCd.Capture,
125
+ jobCd: gmo_service_1.GMO.factory.util.JobCd.Capture,
126
126
  amount, // 手数料を指定
127
127
  siteId: params.availableChannel.credentials?.siteId,
128
128
  sitePass: params.availableChannel.credentials?.sitePass,
129
- method: gmo_service_1.GMO.utils.util.Method.Lump // 再オーソリの場合、支払方法指定は必須
129
+ method: gmo_service_1.GMO.factory.util.Method.Lump // 再オーソリの場合、支払方法指定は必須
130
130
  };
131
131
  alterTranResult = await repos.creditService.alterTran(alterTranArgs);
132
132
  break;
133
- case gmo_service_1.GMO.utils.util.JobCd.Auth:
133
+ case gmo_service_1.GMO.factory.util.JobCd.Auth:
134
134
  alterTranArgs = {
135
135
  shopId, shopPass,
136
136
  accessId, accessPass,
137
- jobCd: gmo_service_1.GMO.utils.util.JobCd.Sales,
137
+ jobCd: gmo_service_1.GMO.factory.util.JobCd.Sales,
138
138
  amount: amount,
139
139
  siteId: params.availableChannel.credentials?.siteId,
140
140
  sitePass: params.availableChannel.credentials?.sitePass
@@ -166,7 +166,7 @@ function processAlterTran(params) {
166
166
  }
167
167
  // tranIdが空文字のケース(SPSwrapperで発生)に対応(Voidに対してVoidを実行してしまうので)(2024-04-20~)
168
168
  if (tranId === '' && creditCardSalesBefore.tranId === '') {
169
- if (status === gmo_service_1.GMO.utils.util.Status.Void) {
169
+ if (status === gmo_service_1.GMO.factory.util.Status.Void) {
170
170
  alreadyRefunded = true;
171
171
  }
172
172
  }
@@ -176,7 +176,7 @@ function processAlterTran(params) {
176
176
  // 決済時のGMO取引を確認できれば、既に返金済かどうかを判定
177
177
  // tranIdが空文字のケース(SPSwrapperで発生)に対応(Voidに対してVoidを実行してしまうので)(2024-04-20~)
178
178
  if (tranId === '' && creditCardSalesBefore === undefined) {
179
- if (status === gmo_service_1.GMO.utils.util.Status.Void) {
179
+ if (status === gmo_service_1.GMO.factory.util.Status.Void) {
180
180
  alreadyRefunded = true;
181
181
  }
182
182
  }
@@ -192,7 +192,7 @@ function processAlterTran(params) {
192
192
  try {
193
193
  alterTranArgs = {
194
194
  shopId, shopPass, accessId, accessPass,
195
- jobCd: gmo_service_1.GMO.utils.util.JobCd.Void,
195
+ jobCd: gmo_service_1.GMO.factory.util.JobCd.Void,
196
196
  siteId: params.availableChannel.credentials?.siteId,
197
197
  sitePass: params.availableChannel.credentials?.sitePass
198
198
  };
@@ -204,9 +204,9 @@ function processAlterTran(params) {
204
204
  if (error.name === 'GMOServiceBadRequestError') {
205
205
  if (Array.isArray(error.errors) && error.errors.length === 1
206
206
  && error.errors[0].info === gmoError_1.GMOErrorInfo.JobCodeNotAcceptable) {
207
- if (status === gmo_service_1.GMO.utils.util.Status.Authenticated
208
- || status === gmo_service_1.GMO.utils.util.Status.Void
209
- || status === gmo_service_1.GMO.utils.util.Status.Unprocessed // handle UNPROCESSED(2025-02-26~)
207
+ if (status === gmo_service_1.GMO.factory.util.Status.Authenticated
208
+ || status === gmo_service_1.GMO.factory.util.Status.Void
209
+ || status === gmo_service_1.GMO.factory.util.Status.Unprocessed // handle UNPROCESSED(2025-02-26~)
210
210
  ) {
211
211
  caughtAlterTranError = error;
212
212
  throwsError = false;
@@ -88,13 +88,13 @@ function voidTransaction(params) {
88
88
  }
89
89
  }
90
90
  // 仮売上であれば取消
91
- if (searchTradeResult?.status === gmo_service_1.GMO.utils.util.JobCd.Auth) {
91
+ if (searchTradeResult?.status === gmo_service_1.GMO.factory.util.JobCd.Auth) {
92
92
  await creditCardService.alterTran({
93
93
  shopId: shopId,
94
94
  shopPass: shopPass,
95
95
  accessId: searchTradeResult.accessId,
96
96
  accessPass: searchTradeResult.accessPass,
97
- jobCd: gmo_service_1.GMO.utils.util.JobCd.Void,
97
+ jobCd: gmo_service_1.GMO.factory.util.JobCd.Void,
98
98
  siteId: availableChannel.credentials?.siteId,
99
99
  sitePass: availableChannel.credentials?.sitePass
100
100
  });
@@ -27,14 +27,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.call = call;
30
- const gmo_service_1 = require("@motionpicture/gmo-service");
31
30
  const debug_1 = __importDefault(require("debug"));
32
31
  const factory_1 = require("../../factory");
33
- const person2username_1 = require("../payment/any/person2username");
34
32
  const account_1 = require("../../repo/account");
35
33
  const action_1 = require("../../repo/action");
36
34
  const ownershipInfo_1 = require("../../repo/ownershipInfo");
37
- const creditCard_1 = require("../../repo/paymentMethod/creditCard");
38
35
  const paymentService_1 = require("../../repo/paymentService");
39
36
  const person_1 = require("../../repo/person");
40
37
  const setting_1 = require("../../repo/setting");
@@ -47,7 +44,7 @@ let cognitoIdentityServiceProvider;
47
44
  * タスク実行関数
48
45
  */
49
46
  function call(params) {
50
- return async ({ connection, settings }) => {
47
+ return async ({ connection }) => {
51
48
  if (cognitoIdentityServiceProvider === undefined) {
52
49
  const { CognitoIdentityProvider } = await Promise.resolve().then(() => __importStar(require('@aws-sdk/client-cognito-identity-provider')));
53
50
  const { fromEnv } = await Promise.resolve().then(() => __importStar(require('@aws-sdk/credential-providers')));
@@ -72,31 +69,12 @@ function call(params) {
72
69
  cognitoIdentityServiceProvider
73
70
  });
74
71
  const paymentServiceRepo = new paymentService_1.PaymentServiceRepo(connection);
75
- let creditCardRepo;
76
- if (typeof params.data.paymentMethodType4creditCard === 'string' && params.data.paymentMethodType4creditCard.length > 0) {
77
- const credentials = await getCreditCardPaymentServiceChannel({
78
- project: { id: params.project.id },
79
- paymentMethodType: params.data.paymentMethodType4creditCard
80
- })({ paymentService: paymentServiceRepo });
81
- creditCardRepo = new creditCard_1.CreditCardRepo({
82
- siteId: credentials.siteId,
83
- sitePass: credentials.sitePass,
84
- cardService: new gmo_service_1.GMO.service.Card({
85
- endpoint: credentials.endpoint
86
- }, {
87
- timeout: (params.data.executeBackground)
88
- ? settings.gmo.timeout
89
- : 20000 // cronで実行の場合は長めに(2024-10-05~)
90
- })
91
- });
92
- }
93
72
  await deleteById({
94
73
  ...params.data,
95
74
  project: { id: params.project.id }
96
- }, setting)({
75
+ })({
97
76
  account: new account_1.AccountRepo(connection),
98
77
  action: new action_1.ActionRepo(connection),
99
- creditCard: creditCardRepo,
100
78
  ownershipInfo: new ownershipInfo_1.OwnershipInfoRepo(connection),
101
79
  paymentService: paymentServiceRepo,
102
80
  newPerson: newPersonRepo,
@@ -109,7 +87,9 @@ function call(params) {
109
87
  /**
110
88
  * 会員削除処理
111
89
  */
112
- function deleteById(params, setting) {
90
+ function deleteById(params
91
+ // setting: Pick<ISetting, 'userPoolIdOld'>
92
+ ) {
113
93
  return async (repos) => {
114
94
  const deleteObject = {
115
95
  id: params.id,
@@ -159,17 +139,22 @@ function deleteById(params, setting) {
159
139
  })({ task: repos.task });
160
140
  }
161
141
  if (existingPeople.length > 0) {
162
- if (repos.creditCard !== undefined) {
163
- // クレジットカード削除
164
- await deleteCreditCardsById({
165
- id: params.id,
166
- useUsernameAsGMOMemberId: params.useUsernameAsGMOMemberId
167
- }, setting)({
168
- person: repos.newPerson,
169
- creditCard: repos.creditCard,
170
- cognitoIdentityServiceProvider: repos.cognitoIdentityServiceProvider
171
- });
172
- }
142
+ // if (repos.creditCard !== undefined) {
143
+ // // クレジットカード削除
144
+ // await deleteCreditCardsById(
145
+ // {
146
+ // id: params.id,
147
+ // useUsernameAsGMOMemberId: params.useUsernameAsGMOMemberId
148
+ // },
149
+ // setting
150
+ // )(
151
+ // {
152
+ // person: repos.newPerson,
153
+ // creditCard: repos.creditCard,
154
+ // cognitoIdentityServiceProvider: repos.cognitoIdentityServiceProvider
155
+ // }
156
+ // );
157
+ // }
173
158
  }
174
159
  // 所有権削除
175
160
  debug('task:deletePerson:deleteById: deleteOwnershipInfosById processing... personId:', params.id);
@@ -202,42 +187,55 @@ function deleteById(params, setting) {
202
187
  await repos.action.completeWithVoid({ typeOf: action.typeOf, id: action.id, result: actionResult });
203
188
  };
204
189
  }
205
- function getCreditCardPaymentServiceChannel(params) {
206
- return async (repos) => {
207
- const paymentServices = await repos.paymentService.projectFields({
208
- limit: 1,
209
- project: { id: { $eq: params.project.id } },
210
- typeOf: { $eq: factory_1.factory.service.paymentService.PaymentServiceType.CreditCard },
211
- serviceType: { codeValue: { $eq: params.paymentMethodType } }
212
- }, ['availableChannel']);
213
- const paymentService = paymentServices.shift();
214
- if (paymentService === undefined) {
215
- throw new factory_1.factory.errors.NotFound('PaymentService');
216
- }
217
- if (typeof paymentService.id !== 'string') {
218
- throw new factory_1.factory.errors.NotFound('paymentService.id.id');
219
- }
220
- const availableChannel = await repos.paymentService.findAvailableChannelCreditCard({
221
- project: { id: params.project.id },
222
- id: paymentService.id
223
- });
224
- // const availableChannel = paymentService?.availableChannel;
225
- if (typeof availableChannel?.serviceUrl !== 'string') {
226
- throw new factory_1.factory.errors.NotFound('paymentService.availableChannel.serviceUrl');
227
- }
228
- if (typeof availableChannel?.credentials?.siteId !== 'string') {
229
- throw new factory_1.factory.errors.NotFound('paymentService.availableChannel.credentials.siteId');
230
- }
231
- if (typeof availableChannel?.credentials?.sitePass !== 'string') {
232
- throw new factory_1.factory.errors.NotFound('paymentService.availableChannel.credentials.sitePass');
233
- }
234
- return {
235
- endpoint: availableChannel.serviceUrl,
236
- siteId: availableChannel.credentials.siteId,
237
- sitePass: availableChannel.credentials.sitePass
238
- };
239
- };
240
- }
190
+ // interface ICreditCardPaymentServiceCredentials {
191
+ // endpoint: string;
192
+ // siteId: string;
193
+ // sitePass: string;
194
+ // }
195
+ // function getCreditCardPaymentServiceChannel(params: {
196
+ // project: { id: string };
197
+ // paymentMethodType: string;
198
+ // }) {
199
+ // return async (repos: {
200
+ // paymentService: PaymentServiceRepo;
201
+ // }): Promise<ICreditCardPaymentServiceCredentials> => {
202
+ // const paymentServices = await repos.paymentService.projectFields(
203
+ // {
204
+ // limit: 1,
205
+ // project: { id: { $eq: params.project.id } },
206
+ // typeOf: { $eq: factory.service.paymentService.PaymentServiceType.CreditCard },
207
+ // serviceType: { codeValue: { $eq: params.paymentMethodType } }
208
+ // },
209
+ // ['availableChannel']
210
+ // ) as Pick<factory.service.paymentService.IService, 'availableChannel' | 'id'>[];
211
+ // const paymentService = paymentServices.shift();
212
+ // if (paymentService === undefined) {
213
+ // throw new factory.errors.NotFound('PaymentService');
214
+ // }
215
+ // if (typeof paymentService.id !== 'string') {
216
+ // throw new factory.errors.NotFound('paymentService.id.id');
217
+ // }
218
+ // const availableChannel = await repos.paymentService.findAvailableChannelCreditCard({
219
+ // project: { id: params.project.id },
220
+ // id: paymentService.id
221
+ // });
222
+ // // const availableChannel = paymentService?.availableChannel;
223
+ // if (typeof availableChannel?.serviceUrl !== 'string') {
224
+ // throw new factory.errors.NotFound('paymentService.availableChannel.serviceUrl');
225
+ // }
226
+ // if (typeof availableChannel?.credentials?.siteId !== 'string') {
227
+ // throw new factory.errors.NotFound('paymentService.availableChannel.credentials.siteId');
228
+ // }
229
+ // if (typeof availableChannel?.credentials?.sitePass !== 'string') {
230
+ // throw new factory.errors.NotFound('paymentService.availableChannel.credentials.sitePass');
231
+ // }
232
+ // return {
233
+ // endpoint: availableChannel.serviceUrl,
234
+ // siteId: availableChannel.credentials.siteId,
235
+ // sitePass: availableChannel.credentials.sitePass
236
+ // };
237
+ // };
238
+ // }
241
239
  // function createInformTask(params: {
242
240
  // id: string;
243
241
  // project: { id: string };
@@ -421,68 +419,89 @@ function deleteOwnershipInfosById(params) {
421
419
  });
422
420
  };
423
421
  }
424
- async function sleep(waitTime) {
425
- return new Promise((resolve) => {
426
- setTimeout(() => {
427
- resolve();
428
- }, waitTime);
429
- });
430
- }
431
- const DELETE_CREDIT_CARD_MAX_RETRY_COUNT = 2;
432
- const DELETE_CREDIT_CARD_RETRY_INTERVAL_IN_MS = 1000;
433
- function deleteCreditCardsById(params, setting) {
434
- return async (repos) => {
435
- let retry = true;
436
- let numberOfTry = 0;
437
- while (numberOfTry >= 0) {
438
- try {
439
- numberOfTry += 1;
440
- if (numberOfTry > DELETE_CREDIT_CARD_MAX_RETRY_COUNT) {
441
- retry = false;
442
- }
443
- // retryInterval
444
- if (numberOfTry > 1) {
445
- await sleep(DELETE_CREDIT_CARD_RETRY_INTERVAL_IN_MS * (numberOfTry - 1));
446
- }
447
- // クレジットカード削除
448
- if (params.useUsernameAsGMOMemberId) {
449
- const person = await repos.person.findById({ userId: params.id });
450
- let oldUsername;
451
- try {
452
- oldUsername = await (0, person2username_1.person2username)(person, repos.cognitoIdentityServiceProvider,
453
- // settings
454
- setting);
455
- }
456
- catch (error) {
457
- let throwsPerson2usernameError = true;
458
- // oldUserが存在しないケースをハンドル
459
- if (error instanceof factory_1.factory.errors.NotFound && error.entityName === 'User') {
460
- debug('task:deletePerson:deleteById: deleteCreditCardsById oldUsername not found', 'personId:', params.id, 'numberOfTry:', numberOfTry);
461
- throwsPerson2usernameError = false;
462
- }
463
- if (throwsPerson2usernameError) {
464
- throw error;
465
- }
466
- }
467
- if (typeof oldUsername === 'string') {
468
- debug('task:deletePerson:deleteById: deleteCreditCardsById processing... oldUsername:', oldUsername, 'personId:', params.id, 'numberOfTry:', numberOfTry);
469
- await repos.creditCard.deleteAll({ personId: oldUsername });
470
- }
471
- }
472
- else {
473
- await repos.creditCard.deleteAll({ personId: params.id });
474
- }
475
- debug('task:deletePerson:deleteById: deleteCreditCardsById processed. personId:', params.id, 'numberOfTry:', numberOfTry);
476
- break;
477
- }
478
- catch (error) {
479
- if (retry) {
480
- continue;
481
- }
482
- else {
483
- throw error;
484
- }
485
- }
486
- }
487
- };
488
- }
422
+ // async function sleep(waitTime: number): Promise<void> {
423
+ // return new Promise<void>((resolve) => {
424
+ // setTimeout(
425
+ // () => {
426
+ // resolve();
427
+ // },
428
+ // waitTime
429
+ // );
430
+ // });
431
+ // }
432
+ // const DELETE_CREDIT_CARD_MAX_RETRY_COUNT = 2;
433
+ // const DELETE_CREDIT_CARD_RETRY_INTERVAL_IN_MS = 1000;
434
+ // function deleteCreditCardsById(
435
+ // params: {
436
+ // id: string;
437
+ // useUsernameAsGMOMemberId: boolean;
438
+ // },
439
+ // setting: Pick<ISetting, 'userPoolIdOld'>
440
+ // ) {
441
+ // return async (
442
+ // repos: {
443
+ // person: PersonRepo;
444
+ // creditCard: CreditCardRepo;
445
+ // cognitoIdentityServiceProvider: CognitoIdentityServiceProvider;
446
+ // }
447
+ // ) => {
448
+ // let retry = true;
449
+ // let numberOfTry = 0;
450
+ // while (numberOfTry >= 0) {
451
+ // try {
452
+ // numberOfTry += 1;
453
+ // if (numberOfTry > DELETE_CREDIT_CARD_MAX_RETRY_COUNT) {
454
+ // retry = false;
455
+ // }
456
+ // // retryInterval
457
+ // if (numberOfTry > 1) {
458
+ // await sleep(DELETE_CREDIT_CARD_RETRY_INTERVAL_IN_MS * (numberOfTry - 1));
459
+ // }
460
+ // // クレジットカード削除
461
+ // if (params.useUsernameAsGMOMemberId) {
462
+ // const person = await repos.person.findById({ userId: params.id });
463
+ // let oldUsername: string | undefined;
464
+ // try {
465
+ // oldUsername = await person2username(
466
+ // person, repos.cognitoIdentityServiceProvider,
467
+ // // settings
468
+ // setting
469
+ // );
470
+ // } catch (error) {
471
+ // let throwsPerson2usernameError = true;
472
+ // // oldUserが存在しないケースをハンドル
473
+ // if (error instanceof factory.errors.NotFound && error.entityName === 'User') {
474
+ // debug(
475
+ // 'task:deletePerson:deleteById: deleteCreditCardsById oldUsername not found',
476
+ // 'personId:', params.id,
477
+ // 'numberOfTry:', numberOfTry
478
+ // );
479
+ // throwsPerson2usernameError = false;
480
+ // }
481
+ // if (throwsPerson2usernameError) {
482
+ // throw error;
483
+ // }
484
+ // }
485
+ // if (typeof oldUsername === 'string') {
486
+ // debug(
487
+ // 'task:deletePerson:deleteById: deleteCreditCardsById processing... oldUsername:', oldUsername,
488
+ // 'personId:', params.id,
489
+ // 'numberOfTry:', numberOfTry
490
+ // );
491
+ // await repos.creditCard.deleteAll({ personId: oldUsername });
492
+ // }
493
+ // } else {
494
+ // await repos.creditCard.deleteAll({ personId: params.id });
495
+ // }
496
+ // debug('task:deletePerson:deleteById: deleteCreditCardsById processed. personId:', params.id, 'numberOfTry:', numberOfTry);
497
+ // break;
498
+ // } catch (error) {
499
+ // if (retry) {
500
+ // continue;
501
+ // } else {
502
+ // throw error;
503
+ // }
504
+ // }
505
+ // }
506
+ // };
507
+ // }
package/package.json CHANGED
@@ -11,10 +11,10 @@
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": "6.2.0-alpha.9",
15
- "@cinerino/sdk": "14.0.0-alpha.6",
14
+ "@chevre/factory": "7.0.0-alpha.0",
15
+ "@cinerino/sdk": "14.0.0-alpha.7",
16
16
  "@motionpicture/coa-service": "9.7.0-alpha.2",
17
- "@motionpicture/gmo-service": "6.0.0-alpha.1",
17
+ "@motionpicture/gmo-service": "6.0.0-alpha.2",
18
18
  "@sendgrid/client": "8.1.4",
19
19
  "@surfrock/sdk": "2.0.0-alpha.2",
20
20
  "debug": "^3.2.7",
@@ -96,5 +96,5 @@
96
96
  "postversion": "git push origin --tags",
97
97
  "prepublishOnly": "npm run clean && npm run build"
98
98
  },
99
- "version": "24.0.0-alpha.68"
99
+ "version": "24.0.0-alpha.69"
100
100
  }
@@ -1,65 +0,0 @@
1
- import { GMO } from '@motionpicture/gmo-service';
2
- import { factory } from '../../factory';
3
- export type IUncheckedCardRaw = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw;
4
- export type IUncheckedCardTokenized = factory.paymentMethod.paymentCard.creditCard.IUncheckedCardTokenized;
5
- export type ISearchCardResult = GMO.factory.service.card.ISearchCardResult;
6
- export interface IOptions {
7
- /**
8
- * GMOサイトID
9
- */
10
- siteId: string;
11
- /**
12
- * GMOサイトパス
13
- */
14
- sitePass: string;
15
- /**
16
- * GMOクレジットカードサービス
17
- */
18
- cardService: GMO.service.Card;
19
- }
20
- /**
21
- * クレジットカードリポジトリ
22
- */
23
- export declare class CreditCardRepo {
24
- private readonly options;
25
- constructor(options: IOptions);
26
- /**
27
- * クレジットカード追加
28
- */
29
- save(params: {
30
- /**
31
- * 会員ID
32
- */
33
- personId: string;
34
- creditCard: IUncheckedCardRaw | IUncheckedCardTokenized;
35
- defaultFlag?: boolean;
36
- }): Promise<ISearchCardResult>;
37
- /**
38
- * クレジットカード削除
39
- */
40
- deleteBySequenceNumber(params: {
41
- /**
42
- * 会員ID
43
- */
44
- personId: string;
45
- cardSeq: string;
46
- }): Promise<void>;
47
- /**
48
- * 会員のクレジットカードを全て削除
49
- */
50
- deleteAll(params: {
51
- /**
52
- * 会員ID
53
- */
54
- personId: string;
55
- }): Promise<void>;
56
- /**
57
- * クレジットカード検索
58
- */
59
- search(params: {
60
- /**
61
- * 会員ID
62
- */
63
- personId: string;
64
- }): Promise<ISearchCardResult[]>;
65
- }
@@ -1,206 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CreditCardRepo = void 0;
4
- const gmo_service_1 = require("@motionpicture/gmo-service");
5
- const factory_1 = require("../../factory");
6
- /**
7
- * クレジットカードリポジトリ
8
- */
9
- class CreditCardRepo {
10
- options;
11
- constructor(options) {
12
- this.options = options;
13
- }
14
- /**
15
- * クレジットカード追加
16
- */
17
- async save(params) {
18
- let addedCreditCard;
19
- const memberId = params.personId;
20
- const memberName = params.personId;
21
- try {
22
- // まずGMO会員登録
23
- try {
24
- await this.options.cardService.searchMember({
25
- siteId: this.options.siteId,
26
- sitePass: this.options.sitePass,
27
- memberId: memberId
28
- });
29
- }
30
- catch (searchMemberError) {
31
- // 会員が存在しない場合このエラーになる
32
- if (Array.isArray(searchMemberError.errors) &&
33
- searchMemberError.errors.length === 1 &&
34
- searchMemberError.errors[0].info === 'E01390002') {
35
- await this.options.cardService.saveMember({
36
- siteId: this.options.siteId,
37
- sitePass: this.options.sitePass,
38
- memberId: memberId,
39
- memberName: memberName
40
- });
41
- }
42
- else {
43
- throw searchMemberError;
44
- }
45
- }
46
- const saveCardResult = await this.options.cardService.saveCard({
47
- siteId: this.options.siteId,
48
- sitePass: this.options.sitePass,
49
- memberId: memberId,
50
- seqMode: gmo_service_1.GMO.utils.util.SeqMode.Physics,
51
- cardNo: params.creditCard.cardNo,
52
- cardPass: params.creditCard.cardPass,
53
- expire: params.creditCard.expire,
54
- holderName: params.creditCard.holderName,
55
- token: params.creditCard.token,
56
- defaultFlag: (params.defaultFlag === true) ? /* istanbul ignore next */ '1' : '0'
57
- });
58
- const searchCardResults = await this.options.cardService.searchCard({
59
- siteId: this.options.siteId,
60
- sitePass: this.options.sitePass,
61
- memberId: memberId,
62
- seqMode: gmo_service_1.GMO.utils.util.SeqMode.Physics,
63
- cardSeq: saveCardResult.cardSeq
64
- });
65
- addedCreditCard = searchCardResults[0];
66
- }
67
- catch (error) {
68
- if (error.name === 'GMOServiceBadRequestError') {
69
- throw new factory_1.factory.errors.Argument('creditCard', error.errors[0].content);
70
- }
71
- else {
72
- throw error;
73
- }
74
- }
75
- return addedCreditCard;
76
- }
77
- /**
78
- * クレジットカード削除
79
- */
80
- async deleteBySequenceNumber(params) {
81
- const memberId = params.personId;
82
- try {
83
- // GMOからカード削除
84
- await this.options.cardService.deleteCard({
85
- siteId: this.options.siteId,
86
- sitePass: this.options.sitePass,
87
- memberId: memberId,
88
- seqMode: gmo_service_1.GMO.utils.util.SeqMode.Physics,
89
- cardSeq: params.cardSeq
90
- });
91
- }
92
- catch (error) {
93
- if (error.name === 'GMOServiceBadRequestError') {
94
- throw new factory_1.factory.errors.Argument('cardSeq', error.errors[0].content);
95
- }
96
- else {
97
- throw error;
98
- }
99
- }
100
- }
101
- /**
102
- * 会員のクレジットカードを全て削除
103
- */
104
- async deleteAll(params) {
105
- const memberId = params.personId;
106
- let searchResult;
107
- try {
108
- try {
109
- searchResult = await this.options.cardService.searchMember({
110
- siteId: this.options.siteId,
111
- sitePass: this.options.sitePass,
112
- memberId: memberId
113
- });
114
- }
115
- catch (searchMemberError) {
116
- // 会員が存在しない場合このエラーになる
117
- if (Array.isArray(searchMemberError.errors) &&
118
- searchMemberError.errors.length === 1 &&
119
- searchMemberError.errors[0].info === 'E01390002') {
120
- // すでに存在しなければok
121
- }
122
- else {
123
- throw searchMemberError;
124
- }
125
- }
126
- if (searchResult !== undefined) {
127
- // GMOから会員削除
128
- await this.options.cardService.deleteMember({
129
- siteId: this.options.siteId,
130
- sitePass: this.options.sitePass,
131
- memberId: memberId
132
- });
133
- }
134
- }
135
- catch (error) {
136
- if (error.name === 'GMOServiceBadRequestError') {
137
- throw new factory_1.factory.errors.Argument('cardSeq', error.errors[0].content);
138
- }
139
- else {
140
- throw error;
141
- }
142
- }
143
- }
144
- /**
145
- * クレジットカード検索
146
- */
147
- async search(params) {
148
- let creditCards = [];
149
- try {
150
- const memberId = params.personId;
151
- // const memberName = params.personId;
152
- let searchMemberResult;
153
- try {
154
- // まずGMO会員存在確認
155
- searchMemberResult = await this.options.cardService.searchMember({
156
- siteId: this.options.siteId,
157
- sitePass: this.options.sitePass,
158
- memberId: memberId
159
- });
160
- }
161
- catch (searchMemberError) {
162
- // 会員が存在しない場合このエラーになる
163
- if (Array.isArray(searchMemberError.errors) &&
164
- searchMemberError.errors.length === 1 &&
165
- searchMemberError.errors[0].info === 'E01390002') {
166
- // 存在しなければカードなし
167
- }
168
- else {
169
- throw searchMemberError;
170
- }
171
- }
172
- // 会員が存在していればカード検索
173
- if (searchMemberResult !== undefined) {
174
- creditCards = await this.options.cardService.searchCard({
175
- siteId: this.options.siteId,
176
- sitePass: this.options.sitePass,
177
- memberId: memberId,
178
- seqMode: gmo_service_1.GMO.utils.util.SeqMode.Physics
179
- // 未削除のものに絞り込む
180
- })
181
- .then((results) => results.filter((result) => result.deleteFlag === '0'));
182
- }
183
- }
184
- catch (error) {
185
- if (error.name === 'GMOServiceBadRequestError') {
186
- // カードが存在しない場合このエラーになる
187
- // ErrCode=E01&ErrInfo=E01240002
188
- /* istanbul ignore if: please write tests */
189
- if (Array.isArray(error.errors) &&
190
- error.errors.length === 1 &&
191
- error.errors[0].info === 'E01240002') {
192
- // no op
193
- // 存在しないだけなので何もしない
194
- }
195
- else {
196
- throw new factory_1.factory.errors.Argument('personId', error.errors[0].content);
197
- }
198
- }
199
- else {
200
- throw error;
201
- }
202
- }
203
- return creditCards;
204
- }
205
- }
206
- exports.CreditCardRepo = CreditCardRepo;