@cinerino/sdk 12.11.0 → 12.12.0-alpha.1

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.
@@ -0,0 +1,81 @@
1
+ // tslint:disable:no-console
2
+ // tslint:disable-next-line:no-implicit-dependencies
3
+ import * as moment from 'moment';
4
+ import * as client from '../../../../lib/index';
5
+ import * as auth from '../../auth/authAsAdmin';
6
+
7
+ const PROJECT_ID = String(process.env.PROJECT_ID);
8
+ const SELLER_ID = '64b47a8e43423b261dbcabc5';
9
+ const OFFER_IDENTIFIER = '20251204eventOffer01';
10
+ const itemOfferedId = 'fmiqm5f2j';
11
+ const PAYMENT_METHOD_ID = '5f9a52994f3709000abe6417';
12
+
13
+ // tslint:disable-next-line:max-func-body-length
14
+ async function main() {
15
+ const authClient = await auth.login();
16
+ await authClient.refreshAccessToken();
17
+ const loginTicket = authClient.verifyIdToken({});
18
+ console.log('username is', loginTicket.getUsername());
19
+
20
+ const acceptedPaymentMethodService = await (await client.loadChevreAdmin({
21
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
22
+ auth: authClient
23
+ })).createAcceptedPaymentMethodInstance({
24
+ project: { id: PROJECT_ID },
25
+ seller: { id: SELLER_ID }
26
+ });
27
+
28
+ const now = new Date();
29
+ const validFrom = moment(now)
30
+ .toDate();
31
+ const validThrough = moment(validFrom)
32
+ .add(1, 'minutes')
33
+ .toDate();
34
+ await acceptedPaymentMethodService.createAcceptedPaymentMethodsByIdentifier(
35
+ [
36
+ {
37
+ identifier: OFFER_IDENTIFIER,
38
+ validFrom,
39
+ validThrough,
40
+ acceptedPaymentMethod: { id: PAYMENT_METHOD_ID }
41
+ }
42
+ ],
43
+ {
44
+ itemOfferedId,
45
+ itemOfferedTypeOf: client.factory.eventType.ScreeningEventSeries
46
+ }
47
+ );
48
+ console.log('created.');
49
+
50
+ await acceptedPaymentMethodService.updateAcceptedPaymentMethodsByIdentifier(
51
+ [
52
+ {
53
+ identifier: OFFER_IDENTIFIER,
54
+ validFrom,
55
+ validThrough,
56
+ acceptedPaymentMethod: { id: PAYMENT_METHOD_ID }
57
+ }
58
+ ],
59
+ {
60
+ itemOfferedId,
61
+ itemOfferedTypeOf: client.factory.eventType.ScreeningEventSeries
62
+ }
63
+ );
64
+ console.log('updated.');
65
+
66
+ const offers = await acceptedPaymentMethodService.findAcceptedPaymentMethods({
67
+ limit: 10,
68
+ page: 1,
69
+ // itemOfferedId: '691511df7d9f0e2df3d6dcf7'
70
+ itemOfferedId: itemOfferedId
71
+ });
72
+ // tslint:disable-next-line:no-null-keyword
73
+ console.dir(offers, { depth: null });
74
+ console.log(offers.length, 'offers found');
75
+ }
76
+
77
+ main()
78
+ .then(() => {
79
+ console.log('success!');
80
+ })
81
+ .catch(console.error);
@@ -12,7 +12,9 @@ export function authorizeCreditCardAsyncForcibly(params: {
12
12
  object: Pick<
13
13
  client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail,
14
14
  'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty' | 'ticketToken'
15
- >;
15
+ > & {
16
+ eventIdsAsOrderedItem?: string[];
17
+ };
16
18
  purpose: {
17
19
  typeOf: client.factory.transactionType.PlaceOrder;
18
20
  id: string;
@@ -22,7 +24,27 @@ export function authorizeCreditCardAsyncForcibly(params: {
22
24
  paymentService: client.cloudPay.service.Payment;
23
25
  }): Promise<{ id: string }> => {
24
26
  // 決済承認タスク作成
25
- const authorizeTask = await repos.paymentService.authorizeCreditCardAsync(params);
27
+ const authorizeTask = await new Promise<{ id: string }>((resolve, reject) => {
28
+ repos.paymentService.authorizeCreditCardAsync(params)
29
+ .then(async (task) => {
30
+ console.log('waiting resolve authorizeCreditCardAsync...');
31
+ await wait(5000);
32
+
33
+ resolve(task);
34
+ })
35
+ .catch(reject);
36
+ // 再度承認してみる
37
+ // repos.paymentService.authorizeCreditCardAsync(params)
38
+ // .then(async (task) => {
39
+ // console.log('authorizeCreditCardAsync:', task);
40
+ // })
41
+ // .catch((authorizeCreditCardAsyncError) => {
42
+ // // 同paymentMethodIdでは承認できないはず
43
+ // console.error('authorizeCreditCardAsync:', authorizeCreditCardAsyncError);
44
+ // });
45
+
46
+ });
47
+
26
48
  const giveUpPayment = moment()
27
49
  .add(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_GIVE_UP_SECONDS, 'seconds');
28
50
  let result: { id: string } | undefined;
@@ -46,6 +68,7 @@ export function authorizeCreditCardAsyncForcibly(params: {
46
68
  },
47
69
  purpose: params.purpose
48
70
  });
71
+ console.log('findAuthorizeAction result:', authorizeAction);
49
72
 
50
73
  // アクションIDが存在し、CompletedActionStatusであればタスク完了とみなす
51
74
  if (typeof authorizeAction.id === 'string') {
@@ -4,6 +4,8 @@ import * as readline from 'readline';
4
4
  import * as client from '../../../../lib/index';
5
5
  import { auth } from '../../auth/clientCredentials';
6
6
 
7
+ import { authorizeCreditCardAsyncForcibly } from './authorizeCreditCardAsyncForcibly';
8
+
7
9
  const project = { id: String(process.env.PROJECT_ID) };
8
10
  const { EVENT_ID } = process.env;
9
11
  const APPLICATION_IDENTIFIER = 'SmartTheaterTXN';
@@ -169,8 +171,9 @@ async function main() {
169
171
  retUrl: String(process.env.SECURE_TRAN_RET_URL) // callbackを指定すると3DSとして処理される
170
172
  },
171
173
  issuedThrough: { id: paymentServiceId },
172
- ticketToken
173
- // eventIdsAsOrderedItem: eventIds
174
+ ticketToken,
175
+ eventIdsAsOrderedItem: eventIds
176
+ // eventIdsAsOrderedItem: ['xxx', ...eventIds] // 存在しないイベントを指定すれば決済採用失敗
174
177
  },
175
178
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
176
179
  })({ paymentService });
@@ -222,8 +225,8 @@ async function main() {
222
225
  issuedThrough: { id: paymentServiceId },
223
226
  ticketToken,
224
227
  name: 'samplePaymentMethodName',
225
- additionalProperty: [{ name: 'samplePropertyName', value: 'samplePropertyValue' }]
226
- // eventIdsAsOrderedItem: eventIds
228
+ additionalProperty: [{ name: 'samplePropertyName', value: 'samplePropertyValue' }],
229
+ eventIdsAsOrderedItem: eventIds
227
230
  },
228
231
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
229
232
  })({ paymentService });
@@ -551,94 +554,6 @@ function publishPaymentUrlAsyncForcibly(params: {
551
554
  };
552
555
  }
553
556
 
554
- function authorizeCreditCardAsyncForcibly(params: {
555
- object: Pick<
556
- client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail,
557
- 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty' | 'ticketToken'
558
- > & {
559
- eventIdsAsOrderedItem?: string[];
560
- };
561
- purpose: {
562
- typeOf: client.factory.transactionType.PlaceOrder;
563
- id: string;
564
- };
565
- }) {
566
- return async (repos: {
567
- paymentService: client.cloudPay.service.Payment;
568
- }): Promise<{ id: string }> => {
569
- // 決済承認タスク作成
570
- const authorizeTask = await new Promise<{ id: string }>((resolve, reject) => {
571
- repos.paymentService.authorizeCreditCardAsync(params)
572
- .then(async (task) => {
573
- console.log('waiting resolve authorizeCreditCardAsync...');
574
- await wait(5000);
575
-
576
- resolve(task);
577
- })
578
- .catch(reject);
579
- // 再度承認してみる
580
- // repos.paymentService.authorizeCreditCardAsync(params)
581
- // .then(async (task) => {
582
- // console.log('authorizeCreditCardAsync:', task);
583
- // })
584
- // .catch((authorizeCreditCardAsyncError) => {
585
- // // 同paymentMethodIdでは承認できないはず
586
- // console.error('authorizeCreditCardAsync:', authorizeCreditCardAsyncError);
587
- // });
588
-
589
- });
590
-
591
- const giveUpPayment = moment()
592
- .add(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_GIVE_UP_SECONDS, 'seconds');
593
- let result: { id: string } | undefined;
594
- let error: { name?: string; message?: string } | undefined;
595
-
596
- // n秒おきに状態確認
597
- while (result === undefined && error === undefined) {
598
- await wait(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_CHECK_INTERVAL_MS); // n秒待機
599
-
600
- // タスク作成から一定時間経過すればあきらめる
601
- if (moment()
602
- .isAfter(giveUpPayment)) {
603
- error = new client.factory.errors.GatewayTimeout('action given up');
604
- break;
605
- }
606
-
607
- const authorizeAction = await repos.paymentService.findAuthorizeAction({
608
- sameAs: { id: authorizeTask.id },
609
- object: {
610
- typeOf: client.factory.service.paymentService.PaymentServiceType.CreditCard
611
- },
612
- purpose: params.purpose
613
- });
614
- console.log('findAuthorizeAction result:', authorizeAction);
615
-
616
- // アクションIDが存在し、CompletedActionStatusであればタスク完了とみなす
617
- if (typeof authorizeAction.id === 'string') {
618
- if (authorizeAction.actionStatus === client.factory.actionStatusType.CompletedActionStatus) {
619
- // ステータス完了であれば決済承認アクションIDを保管
620
- result = { id: authorizeAction.id };
621
- break;
622
- } else {
623
- // 待機続行
624
- }
625
- }
626
-
627
- // エラーが存在すれば、これ以上待機する価値はなし
628
- if (authorizeAction.error !== undefined) {
629
- error = authorizeAction.error;
630
- break;
631
- }
632
- }
633
-
634
- if (typeof result?.id === 'string') {
635
- return result;
636
- }
637
-
638
- throw error;
639
- };
640
- }
641
-
642
557
  main()
643
558
  .then(() => {
644
559
  console.log('success!');
@@ -3,6 +3,8 @@ import * as moment from 'moment';
3
3
  import * as client from '../../../../lib/index';
4
4
  import { auth } from '../../auth/clientCredentials';
5
5
 
6
+ import { authorizeCreditCardAsyncForcibly } from './authorizeCreditCardAsyncForcibly';
7
+
6
8
  const project = { id: String(process.env.PROJECT_ID) };
7
9
 
8
10
  const profile = {
@@ -122,7 +124,8 @@ async function main() {
122
124
  paymentMethod: 'CreditCard',
123
125
  method: '1',
124
126
  creditCard,
125
- issuedThrough: { id: PAYMENT_SERVICE_ID }
127
+ issuedThrough: { id: PAYMENT_SERVICE_ID },
128
+ eventIdsAsOrderedItem: [screeningEvent.id]
126
129
  },
127
130
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
128
131
  })({ paymentService });
@@ -147,7 +150,8 @@ async function main() {
147
150
  paymentMethod: 'CreditCard',
148
151
  method: '1',
149
152
  creditCard,
150
- issuedThrough: { id: PAYMENT_SERVICE_ID }
153
+ issuedThrough: { id: PAYMENT_SERVICE_ID },
154
+ eventIdsAsOrderedItem: [screeningEvent.id]
151
155
  },
152
156
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
153
157
  })({ paymentService });
@@ -273,73 +277,6 @@ async function wait(waitInMilliseconds: number) {
273
277
  return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
274
278
  }
275
279
 
276
- const USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_GIVE_UP_SECONDS = 10;
277
- const USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_CHECK_INTERVAL_MS = 1000;
278
- function authorizeCreditCardAsyncForcibly(params: {
279
- object: Pick<
280
- client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail,
281
- 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty'
282
- >;
283
- purpose: {
284
- typeOf: client.factory.transactionType.PlaceOrder;
285
- id: string;
286
- };
287
- }) {
288
- return async (repos: {
289
- paymentService: client.cloudPay.service.Payment;
290
- }): Promise<{ id: string }> => {
291
- // 決済承認タスク作成
292
- const authorizeTask = await repos.paymentService.authorizeCreditCardAsync(params);
293
- const giveUpPayment = moment()
294
- .add(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_GIVE_UP_SECONDS, 'seconds');
295
- let result: { id: string } | undefined;
296
- let error: { name?: string; message?: string } | undefined;
297
-
298
- // n秒おきに状態確認
299
- while (result === undefined && error === undefined) {
300
- await wait(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_CHECK_INTERVAL_MS); // n秒待機
301
-
302
- // タスク作成から一定時間経過すればあきらめる
303
- if (moment()
304
- .isAfter(giveUpPayment)) {
305
- error = new client.factory.errors.GatewayTimeout('action given up');
306
- break;
307
- }
308
-
309
- const authorizeAction = await repos.paymentService.findAuthorizeAction({
310
- sameAs: { id: authorizeTask.id },
311
- object: {
312
- typeOf: client.factory.service.paymentService.PaymentServiceType.CreditCard
313
- },
314
- purpose: params.purpose
315
- });
316
-
317
- // アクションIDが存在し、CompletedActionStatusであればタスク完了とみなす
318
- if (typeof authorizeAction.id === 'string') {
319
- if (authorizeAction.actionStatus === client.factory.actionStatusType.CompletedActionStatus) {
320
- // ステータス完了であれば決済承認アクションIDを保管
321
- result = { id: authorizeAction.id };
322
- break;
323
- } else {
324
- // 待機続行
325
- }
326
- }
327
-
328
- // エラーが存在すれば、これ以上待機する価値はなし
329
- if (authorizeAction.error !== undefined) {
330
- error = authorizeAction.error;
331
- break;
332
- }
333
- }
334
-
335
- if (typeof result?.id === 'string') {
336
- return result;
337
- }
338
-
339
- throw error;
340
- };
341
- }
342
-
343
280
  main()
344
281
  .then(() => {
345
282
  console.log('success!');
@@ -4,6 +4,8 @@ import * as readline from 'readline';
4
4
  import * as client from '../../../../lib/index';
5
5
  import { auth } from '../../auth/clientCredentials';
6
6
 
7
+ import { authorizeCreditCardAsyncForcibly } from './authorizeCreditCardAsyncForcibly';
8
+
7
9
  const { EVENT_ID, MEMBER_PROGRAM_TIER_TOKEN } = process.env;
8
10
  const project = { id: String(process.env.PROJECT_ID) };
9
11
  const profile = {
@@ -437,91 +439,6 @@ function publishPaymentUrlAsyncForcibly(params: {
437
439
  };
438
440
  }
439
441
 
440
- function authorizeCreditCardAsyncForcibly(params: {
441
- object: Pick<
442
- client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail,
443
- 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty'
444
- >;
445
- purpose: {
446
- typeOf: client.factory.transactionType.PlaceOrder;
447
- id: string;
448
- };
449
- }) {
450
- return async (repos: {
451
- paymentService: client.cloudPay.service.Payment;
452
- }): Promise<{ id: string }> => {
453
- // 決済承認タスク作成
454
- const authorizeTask = await new Promise<{ id: string }>((resolve, reject) => {
455
- repos.paymentService.authorizeCreditCardAsync(params)
456
- .then(async (task) => {
457
- console.log('waiting resolve authorizeCreditCardAsync...');
458
- await wait(5000);
459
-
460
- resolve(task);
461
- })
462
- .catch(reject);
463
- // 再度承認してみる
464
- // repos.paymentService.authorizeCreditCardAsync(params)
465
- // .then(async (task) => {
466
- // console.log('authorizeCreditCardAsync:', task);
467
- // })
468
- // .catch((authorizeCreditCardAsyncError) => {
469
- // // 同paymentMethodIdでは承認できないはず
470
- // console.error('authorizeCreditCardAsync:', authorizeCreditCardAsyncError);
471
- // });
472
-
473
- });
474
-
475
- const giveUpPayment = moment()
476
- .add(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_GIVE_UP_SECONDS, 'seconds');
477
- let result: { id: string } | undefined;
478
- let error: { name?: string; message?: string } | undefined;
479
-
480
- // n秒おきに状態確認
481
- while (result === undefined && error === undefined) {
482
- await wait(USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_CHECK_INTERVAL_MS); // n秒待機
483
-
484
- // タスク作成から一定時間経過すればあきらめる
485
- if (moment()
486
- .isAfter(giveUpPayment)) {
487
- error = new client.factory.errors.GatewayTimeout('action given up');
488
- break;
489
- }
490
-
491
- const authorizeAction = await repos.paymentService.findAuthorizeAction({
492
- sameAs: { id: authorizeTask.id },
493
- object: {
494
- typeOf: client.factory.service.paymentService.PaymentServiceType.CreditCard
495
- },
496
- purpose: params.purpose
497
- });
498
-
499
- // アクションIDが存在し、CompletedActionStatusであればタスク完了とみなす
500
- if (typeof authorizeAction.id === 'string') {
501
- if (authorizeAction.actionStatus === client.factory.actionStatusType.CompletedActionStatus) {
502
- // ステータス完了であれば決済承認アクションIDを保管
503
- result = { id: authorizeAction.id };
504
- break;
505
- } else {
506
- // 待機続行
507
- }
508
- }
509
-
510
- // エラーが存在すれば、これ以上待機する価値はなし
511
- if (authorizeAction.error !== undefined) {
512
- error = authorizeAction.error;
513
- break;
514
- }
515
- }
516
-
517
- if (typeof result?.id === 'string') {
518
- return result;
519
- }
520
-
521
- throw error;
522
- };
523
- }
524
-
525
442
  main()
526
443
  .then(() => {
527
444
  console.log('success!');
@@ -0,0 +1,66 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ export declare type ICreatingAcceptedPaymentMethod = Pick<factory.acceptedPaymentMethodOffer.IAcceptedPaymentMethodOffer, 'identifier' | 'validFrom' | 'validThrough'> & {
4
+ /**
5
+ * 対応決済方法
6
+ */
7
+ acceptedPaymentMethod: {
8
+ /**
9
+ * 決済サービスID
10
+ */
11
+ id: string;
12
+ };
13
+ };
14
+ export interface ICreateOptions {
15
+ /**
16
+ * リソースID
17
+ */
18
+ itemOfferedId: string;
19
+ /**
20
+ * リソースタイプ
21
+ */
22
+ itemOfferedTypeOf: factory.eventType.ScreeningEventSeries;
23
+ }
24
+ export interface IFindParams {
25
+ /**
26
+ * max: 20
27
+ */
28
+ limit: number;
29
+ page: number;
30
+ /**
31
+ * 決済サービスID
32
+ */
33
+ acceptedPaymentMethodId?: string;
34
+ /**
35
+ * 提供リソースID
36
+ */
37
+ itemOfferedId?: string;
38
+ /**
39
+ * 提供リソースリスト
40
+ * max length: 10
41
+ */
42
+ itemOfferedIds?: string[];
43
+ /**
44
+ * オファーコードリスト
45
+ * max length: 10
46
+ */
47
+ identifiers?: string[];
48
+ id?: string;
49
+ }
50
+ export declare type IAcceptedPaymentMethodAsFindResult = Pick<factory.acceptedPaymentMethodOffer.IAcceptedPaymentMethodOffer, 'id' | 'identifier' | 'itemOffered' | 'typeOf' | 'validFrom' | 'validThrough' | 'acceptedPaymentMethod'>;
51
+ /**
52
+ * 対応決済方法サービス
53
+ */
54
+ export declare class AcceptedPaymentMethodService extends Service {
55
+ createAcceptedPaymentMethodsByIdentifier(
56
+ /**
57
+ * max: 20
58
+ */
59
+ params: ICreatingAcceptedPaymentMethod[], options: ICreateOptions): Promise<void>;
60
+ updateAcceptedPaymentMethodsByIdentifier(
61
+ /**
62
+ * max: 20
63
+ */
64
+ params: ICreatingAcceptedPaymentMethod[], options: ICreateOptions): Promise<void>;
65
+ findAcceptedPaymentMethods(params: IFindParams): Promise<IAcceptedPaymentMethodAsFindResult[]>;
66
+ }
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
+ return new (P || (P = Promise))(function (resolve, reject) {
20
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
24
+ });
25
+ };
26
+ var __generator = (this && this.__generator) || function (thisArg, body) {
27
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
+ function verb(n) { return function (v) { return step([n, v]); }; }
30
+ function step(op) {
31
+ if (f) throw new TypeError("Generator is already executing.");
32
+ while (_) try {
33
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
+ if (y = 0, t) op = [op[0] & 2, t.value];
35
+ switch (op[0]) {
36
+ case 0: case 1: t = op; break;
37
+ case 4: _.label++; return { value: op[1], done: false };
38
+ case 5: _.label++; y = op[1]; op = [0]; continue;
39
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
+ default:
41
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
+ if (t[2]) _.ops.pop();
46
+ _.trys.pop(); continue;
47
+ }
48
+ op = body.call(thisArg, _);
49
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
+ }
52
+ };
53
+ Object.defineProperty(exports, "__esModule", { value: true });
54
+ exports.AcceptedPaymentMethodService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ var BASE_URI = '/acceptedPaymentMethods';
58
+ /**
59
+ * 対応決済方法サービス
60
+ */
61
+ var AcceptedPaymentMethodService = /** @class */ (function (_super) {
62
+ __extends(AcceptedPaymentMethodService, _super);
63
+ function AcceptedPaymentMethodService() {
64
+ return _super !== null && _super.apply(this, arguments) || this;
65
+ }
66
+ AcceptedPaymentMethodService.prototype.createAcceptedPaymentMethodsByIdentifier = function (
67
+ /**
68
+ * max: 20
69
+ */
70
+ params, options) {
71
+ return __awaiter(this, void 0, void 0, function () {
72
+ var itemOfferedId, itemOfferedTypeOf;
73
+ return __generator(this, function (_a) {
74
+ switch (_a.label) {
75
+ case 0:
76
+ itemOfferedId = options.itemOfferedId, itemOfferedTypeOf = options.itemOfferedTypeOf;
77
+ return [4 /*yield*/, this.fetch({
78
+ uri: BASE_URI,
79
+ method: 'POST',
80
+ body: params,
81
+ qs: { itemOfferedId: itemOfferedId, itemOfferedTypeOf: itemOfferedTypeOf },
82
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
83
+ })];
84
+ case 1:
85
+ _a.sent();
86
+ return [2 /*return*/];
87
+ }
88
+ });
89
+ });
90
+ };
91
+ AcceptedPaymentMethodService.prototype.updateAcceptedPaymentMethodsByIdentifier = function (
92
+ /**
93
+ * max: 20
94
+ */
95
+ params, options) {
96
+ return __awaiter(this, void 0, void 0, function () {
97
+ var itemOfferedId, itemOfferedTypeOf;
98
+ return __generator(this, function (_a) {
99
+ switch (_a.label) {
100
+ case 0:
101
+ itemOfferedId = options.itemOfferedId, itemOfferedTypeOf = options.itemOfferedTypeOf;
102
+ return [4 /*yield*/, this.fetch({
103
+ uri: BASE_URI,
104
+ method: 'PUT',
105
+ body: params,
106
+ qs: { itemOfferedId: itemOfferedId, itemOfferedTypeOf: itemOfferedTypeOf },
107
+ expectedStatusCodes: [http_status_1.NO_CONTENT]
108
+ })];
109
+ case 1:
110
+ _a.sent();
111
+ return [2 /*return*/];
112
+ }
113
+ });
114
+ });
115
+ };
116
+ AcceptedPaymentMethodService.prototype.findAcceptedPaymentMethods = function (params) {
117
+ return __awaiter(this, void 0, void 0, function () {
118
+ var _this = this;
119
+ return __generator(this, function (_a) {
120
+ return [2 /*return*/, this.fetch({
121
+ uri: BASE_URI,
122
+ method: 'GET',
123
+ qs: params,
124
+ expectedStatusCodes: [http_status_1.OK]
125
+ })
126
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
127
+ return [2 /*return*/, response.json()];
128
+ }); }); })];
129
+ });
130
+ });
131
+ };
132
+ return AcceptedPaymentMethodService;
133
+ }(service_1.Service));
134
+ exports.AcceptedPaymentMethodService = AcceptedPaymentMethodService;