@cinerino/sdk 7.0.0-alpha.0 → 7.0.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.
@@ -14,7 +14,7 @@ export declare namespace service {
14
14
  * 決済サービス
15
15
  */
16
16
  export declare class ChevrePay {
17
- options: Pick<IOptions, 'auth' | 'endpoint'>;
18
- constructor(options: Pick<IOptions, 'auth' | 'endpoint'>);
19
- createPaymentInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentService>;
17
+ options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry'>;
18
+ constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'disableAutoRetry'>);
19
+ createPaymentInstance(params: Pick<IOptions, 'project' | 'retryableStatusCodes'> & Pick<IAdditionalOptions, 'seller'>): Promise<PaymentService>;
20
20
  }
@@ -46,6 +46,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
46
46
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
47
  }
48
48
  };
49
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
50
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
51
+ to[j] = from[i];
52
+ return to;
53
+ };
49
54
  Object.defineProperty(exports, "__esModule", { value: true });
50
55
  exports.ChevrePay = exports.service = void 0;
51
56
  var service;
@@ -73,7 +78,7 @@ var ChevrePay = /** @class */ (function () {
73
78
  case 1:
74
79
  _a.svc = (_b.sent()).PaymentService;
75
80
  _b.label = 2;
76
- case 2: return [2 /*return*/, new service.Payment.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
81
+ case 2: return [2 /*return*/, new service.Payment.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: __spreadArray([], (Array.isArray(params.retryableStatusCodes)) ? params.retryableStatusCodes : []) }))];
77
82
  }
78
83
  });
79
84
  });
@@ -1,5 +1,4 @@
1
1
  "use strict";
2
- // import { ACCEPTED, CONFLICT, CREATED, GATEWAY_TIMEOUT, NO_CONTENT, OK, TOO_MANY_REQUESTS } from 'http-status';
3
2
  var __extends = (this && this.__extends) || (function () {
4
3
  var extendStatics = function (d, b) {
5
4
  extendStatics = Object.setPrototypeOf ||
@@ -73,8 +72,14 @@ var __rest = (this && this.__rest) || function (s, e) {
73
72
  }
74
73
  return t;
75
74
  };
75
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
76
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
77
+ to[j] = from[i];
78
+ return to;
79
+ };
76
80
  Object.defineProperty(exports, "__esModule", { value: true });
77
81
  exports.PaymentService = void 0;
82
+ var http_status_1 = require("http-status");
78
83
  var factory = require("../../factory");
79
84
  var index_1 = require("../../index");
80
85
  var service_1 = require("../../service");
@@ -91,17 +96,21 @@ var PaymentService = /** @class */ (function (_super) {
91
96
  */
92
97
  PaymentService.prototype.authorizeAnyPayment = function (params) {
93
98
  return __awaiter(this, void 0, void 0, function () {
94
- var _a, auth, endpoint, project, seller, chevrePay, paymentService;
99
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
95
100
  return __generator(this, function (_b) {
96
101
  switch (_b.label) {
97
102
  case 0:
98
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
99
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
103
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
104
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
100
105
  case 1:
101
106
  chevrePay = _b.sent();
102
107
  return [4 /*yield*/, chevrePay.createPaymentInstance({
103
108
  project: project,
104
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
109
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
110
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
111
+ http_status_1.CONFLICT,
112
+ http_status_1.TOO_MANY_REQUESTS
113
+ ])
105
114
  })];
106
115
  case 2:
107
116
  paymentService = _b.sent();
@@ -115,18 +124,22 @@ var PaymentService = /** @class */ (function (_super) {
115
124
  */
116
125
  PaymentService.prototype.authorizeCreditCardAsync = function (params) {
117
126
  return __awaiter(this, void 0, void 0, function () {
118
- var object, purpose, _a, auth, endpoint, project, seller, chevrePay, paymentService;
127
+ var object, purpose, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
119
128
  return __generator(this, function (_b) {
120
129
  switch (_b.label) {
121
130
  case 0:
122
131
  object = params.object, purpose = params.purpose;
123
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
124
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
132
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
133
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
125
134
  case 1:
126
135
  chevrePay = _b.sent();
127
136
  return [4 /*yield*/, chevrePay.createPaymentInstance({
128
137
  project: project,
129
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
138
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
139
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
140
+ http_status_1.CONFLICT,
141
+ http_status_1.TOO_MANY_REQUESTS
142
+ ])
130
143
  })];
131
144
  case 2:
132
145
  paymentService = _b.sent();
@@ -140,18 +153,22 @@ var PaymentService = /** @class */ (function (_super) {
140
153
  */
141
154
  PaymentService.prototype.authorizeMovieTicket = function (params) {
142
155
  return __awaiter(this, void 0, void 0, function () {
143
- var object, purpose, _a, auth, endpoint, project, seller, chevrePay, paymentService;
156
+ var object, purpose, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
144
157
  return __generator(this, function (_b) {
145
158
  switch (_b.label) {
146
159
  case 0:
147
160
  object = params.object, purpose = params.purpose;
148
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
149
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
161
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
162
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
150
163
  case 1:
151
164
  chevrePay = _b.sent();
152
165
  return [4 /*yield*/, chevrePay.createPaymentInstance({
153
166
  project: project,
154
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
167
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
168
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
169
+ http_status_1.CONFLICT,
170
+ http_status_1.TOO_MANY_REQUESTS
171
+ ])
155
172
  })];
156
173
  case 2:
157
174
  paymentService = _b.sent();
@@ -165,17 +182,22 @@ var PaymentService = /** @class */ (function (_super) {
165
182
  */
166
183
  PaymentService.prototype.publishCreditCardPaymentUrl = function (params) {
167
184
  return __awaiter(this, void 0, void 0, function () {
168
- var _a, auth, endpoint, project, seller, chevrePay, paymentService;
185
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
169
186
  return __generator(this, function (_b) {
170
187
  switch (_b.label) {
171
188
  case 0:
172
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
173
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
189
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
190
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
174
191
  case 1:
175
192
  chevrePay = _b.sent();
176
193
  return [4 /*yield*/, chevrePay.createPaymentInstance({
177
194
  project: project,
178
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
195
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
196
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
197
+ http_status_1.CONFLICT,
198
+ http_status_1.GATEWAY_TIMEOUT,
199
+ http_status_1.TOO_MANY_REQUESTS
200
+ ])
179
201
  })];
180
202
  case 2:
181
203
  paymentService = _b.sent();
@@ -190,19 +212,24 @@ var PaymentService = /** @class */ (function (_super) {
190
212
  PaymentService.prototype.checkMovieTicket = function (params) {
191
213
  var _a, _b, _c, _d, _e, _f, _g, _h;
192
214
  return __awaiter(this, void 0, void 0, function () {
193
- var paymentServiceId, paymentMethodType, _j, auth, endpoint, project, seller, chevrePay, paymentService, purpose, checkAction;
215
+ var paymentServiceId, paymentMethodType, _j, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService, purpose, checkAction;
194
216
  return __generator(this, function (_k) {
195
217
  switch (_k.label) {
196
218
  case 0:
197
219
  paymentServiceId = String((_a = params.object) === null || _a === void 0 ? void 0 : _a.id);
198
220
  paymentMethodType = String((_c = (_b = params.object) === null || _b === void 0 ? void 0 : _b.paymentMethod) === null || _c === void 0 ? void 0 : _c.typeOf);
199
- _j = this.options, auth = _j.auth, endpoint = _j.endpoint, project = _j.project, seller = _j.seller;
200
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
221
+ _j = this.options, auth = _j.auth, endpoint = _j.endpoint, project = _j.project, seller = _j.seller, disableAutoRetry = _j.disableAutoRetry, retryableStatusCodes = _j.retryableStatusCodes;
222
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
201
223
  case 1:
202
224
  chevrePay = _k.sent();
203
225
  return [4 /*yield*/, chevrePay.createPaymentInstance({
204
226
  project: project,
205
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
227
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
228
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
229
+ http_status_1.CONFLICT,
230
+ http_status_1.GATEWAY_TIMEOUT,
231
+ http_status_1.TOO_MANY_REQUESTS
232
+ ])
206
233
  })];
207
234
  case 2:
208
235
  paymentService = _k.sent();
@@ -245,17 +272,21 @@ var PaymentService = /** @class */ (function (_super) {
245
272
  */
246
273
  PaymentService.prototype.voidAnyPayment = function (params) {
247
274
  return __awaiter(this, void 0, void 0, function () {
248
- var _a, auth, endpoint, project, seller, chevrePay, paymentService;
275
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
249
276
  return __generator(this, function (_b) {
250
277
  switch (_b.label) {
251
278
  case 0:
252
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
253
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
279
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
280
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
254
281
  case 1:
255
282
  chevrePay = _b.sent();
256
283
  return [4 /*yield*/, chevrePay.createPaymentInstance({
257
284
  project: project,
258
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
285
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
286
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
287
+ http_status_1.CONFLICT,
288
+ http_status_1.TOO_MANY_REQUESTS
289
+ ])
259
290
  })];
260
291
  case 2:
261
292
  paymentService = _b.sent();
@@ -275,18 +306,23 @@ var PaymentService = /** @class */ (function (_super) {
275
306
  */
276
307
  PaymentService.prototype.voidTransaction = function (params) {
277
308
  return __awaiter(this, void 0, void 0, function () {
278
- var id, object, body, _a, auth, endpoint, project, seller, chevrePay, paymentService;
309
+ var id, object, body, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
279
310
  return __generator(this, function (_b) {
280
311
  switch (_b.label) {
281
312
  case 0:
282
313
  id = params.id, object = params.object, body = __rest(params, ["id", "object"]);
283
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
284
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
314
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
315
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
285
316
  case 1:
286
317
  chevrePay = _b.sent();
287
318
  return [4 /*yield*/, chevrePay.createPaymentInstance({
288
319
  project: project,
289
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
320
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
321
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
322
+ http_status_1.CONFLICT,
323
+ http_status_1.GATEWAY_TIMEOUT,
324
+ http_status_1.TOO_MANY_REQUESTS
325
+ ])
290
326
  })];
291
327
  case 2:
292
328
  paymentService = _b.sent();
@@ -307,18 +343,19 @@ var PaymentService = /** @class */ (function (_super) {
307
343
  */
308
344
  PaymentService.prototype.findAuthorizeAction = function (params) {
309
345
  return __awaiter(this, void 0, void 0, function () {
310
- var sameAs, object, purpose, _a, auth, endpoint, project, seller, chevrePay, paymentService;
346
+ var sameAs, object, purpose, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
311
347
  return __generator(this, function (_b) {
312
348
  switch (_b.label) {
313
349
  case 0:
314
350
  sameAs = params.sameAs, object = params.object, purpose = params.purpose;
315
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
316
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
351
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
352
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
317
353
  case 1:
318
354
  chevrePay = _b.sent();
319
355
  return [4 /*yield*/, chevrePay.createPaymentInstance({
320
356
  project: project,
321
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
357
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
358
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
322
359
  })];
323
360
  case 2:
324
361
  paymentService = _b.sent();
@@ -62,6 +62,13 @@ var defaultPath = '/pay';
62
62
  */
63
63
  var CloudPay = /** @class */ (function () {
64
64
  function CloudPay(options) {
65
+ // 廃止済エンドポイント指定を防止(cloud,cinerino...)
66
+ var isDiscontinuedEndpoint = (new RegExp('cloud|cinerino|dot|appspot')).test(options.endpoint);
67
+ // tslint:disable-next-line:no-single-line-block-comment
68
+ /* istanbul ignore if */
69
+ if (isDiscontinuedEndpoint) {
70
+ throw new Error('endpoint discontinued');
71
+ }
65
72
  this.options = options;
66
73
  }
67
74
  CloudPay.prototype.createPaymentInstance = function (params) {
@@ -297,6 +297,7 @@ var OAuth2client = /** @class */ (function () {
297
297
  error_1 = _c.sent();
298
298
  if (!(error_1 instanceof Error)) return [3 /*break*/, 9];
299
299
  statusCode = error_1.code;
300
+ debug('retry? numberOfTry:', numberOfTry, 'statusCode: ', statusCode, 'retry: ', retry, 'retryableStatusCodes: ', retryableStatusCodes);
300
301
  if (!(retry && retryableStatusCodes.includes(statusCode))) return [3 /*break*/, 9];
301
302
  if (!(typeof this.credentials.refresh_token === 'string' && this.credentials.refresh_token.length > 0)) return [3 /*break*/, 7];
302
303
  return [4 /*yield*/, this.refreshAccessToken()];
package/lib/bundle.js CHANGED
@@ -13614,6 +13614,11 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
13614
13614
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
13615
13615
  }
13616
13616
  };
13617
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
13618
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
13619
+ to[j] = from[i];
13620
+ return to;
13621
+ };
13617
13622
  Object.defineProperty(exports, "__esModule", { value: true });
13618
13623
  exports.ChevrePay = exports.service = void 0;
13619
13624
  var service;
@@ -13641,7 +13646,7 @@ var ChevrePay = /** @class */ (function () {
13641
13646
  case 1:
13642
13647
  _a.svc = (_b.sent()).PaymentService;
13643
13648
  _b.label = 2;
13644
- case 2: return [2 /*return*/, new service.Payment.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
13649
+ case 2: return [2 /*return*/, new service.Payment.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: __spreadArray([], (Array.isArray(params.retryableStatusCodes)) ? params.retryableStatusCodes : []) }))];
13645
13650
  }
13646
13651
  });
13647
13652
  });
@@ -21145,6 +21150,13 @@ var defaultPath = '/pay';
21145
21150
  */
21146
21151
  var CloudPay = /** @class */ (function () {
21147
21152
  function CloudPay(options) {
21153
+ // 廃止済エンドポイント指定を防止(cloud,cinerino...)
21154
+ var isDiscontinuedEndpoint = (new RegExp('cloud|cinerino|dot|appspot')).test(options.endpoint);
21155
+ // tslint:disable-next-line:no-single-line-block-comment
21156
+ /* istanbul ignore if */
21157
+ if (isDiscontinuedEndpoint) {
21158
+ throw new Error('endpoint discontinued');
21159
+ }
21148
21160
  this.options = options;
21149
21161
  }
21150
21162
  CloudPay.prototype.createPaymentInstance = function (params) {
@@ -21170,7 +21182,6 @@ exports.CloudPay = CloudPay;
21170
21182
 
21171
21183
  },{"./pay/payment":129,"http-status":348}],129:[function(require,module,exports){
21172
21184
  "use strict";
21173
- // import { ACCEPTED, CONFLICT, CREATED, GATEWAY_TIMEOUT, NO_CONTENT, OK, TOO_MANY_REQUESTS } from 'http-status';
21174
21185
  var __extends = (this && this.__extends) || (function () {
21175
21186
  var extendStatics = function (d, b) {
21176
21187
  extendStatics = Object.setPrototypeOf ||
@@ -21244,8 +21255,14 @@ var __rest = (this && this.__rest) || function (s, e) {
21244
21255
  }
21245
21256
  return t;
21246
21257
  };
21258
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
21259
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
21260
+ to[j] = from[i];
21261
+ return to;
21262
+ };
21247
21263
  Object.defineProperty(exports, "__esModule", { value: true });
21248
21264
  exports.PaymentService = void 0;
21265
+ var http_status_1 = require("http-status");
21249
21266
  var factory = require("../../factory");
21250
21267
  var index_1 = require("../../index");
21251
21268
  var service_1 = require("../../service");
@@ -21262,17 +21279,21 @@ var PaymentService = /** @class */ (function (_super) {
21262
21279
  */
21263
21280
  PaymentService.prototype.authorizeAnyPayment = function (params) {
21264
21281
  return __awaiter(this, void 0, void 0, function () {
21265
- var _a, auth, endpoint, project, seller, chevrePay, paymentService;
21282
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21266
21283
  return __generator(this, function (_b) {
21267
21284
  switch (_b.label) {
21268
21285
  case 0:
21269
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21270
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21286
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21287
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21271
21288
  case 1:
21272
21289
  chevrePay = _b.sent();
21273
21290
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21274
21291
  project: project,
21275
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21292
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21293
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21294
+ http_status_1.CONFLICT,
21295
+ http_status_1.TOO_MANY_REQUESTS
21296
+ ])
21276
21297
  })];
21277
21298
  case 2:
21278
21299
  paymentService = _b.sent();
@@ -21286,18 +21307,22 @@ var PaymentService = /** @class */ (function (_super) {
21286
21307
  */
21287
21308
  PaymentService.prototype.authorizeCreditCardAsync = function (params) {
21288
21309
  return __awaiter(this, void 0, void 0, function () {
21289
- var object, purpose, _a, auth, endpoint, project, seller, chevrePay, paymentService;
21310
+ var object, purpose, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21290
21311
  return __generator(this, function (_b) {
21291
21312
  switch (_b.label) {
21292
21313
  case 0:
21293
21314
  object = params.object, purpose = params.purpose;
21294
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21295
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21315
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21316
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21296
21317
  case 1:
21297
21318
  chevrePay = _b.sent();
21298
21319
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21299
21320
  project: project,
21300
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21321
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21322
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21323
+ http_status_1.CONFLICT,
21324
+ http_status_1.TOO_MANY_REQUESTS
21325
+ ])
21301
21326
  })];
21302
21327
  case 2:
21303
21328
  paymentService = _b.sent();
@@ -21311,18 +21336,22 @@ var PaymentService = /** @class */ (function (_super) {
21311
21336
  */
21312
21337
  PaymentService.prototype.authorizeMovieTicket = function (params) {
21313
21338
  return __awaiter(this, void 0, void 0, function () {
21314
- var object, purpose, _a, auth, endpoint, project, seller, chevrePay, paymentService;
21339
+ var object, purpose, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21315
21340
  return __generator(this, function (_b) {
21316
21341
  switch (_b.label) {
21317
21342
  case 0:
21318
21343
  object = params.object, purpose = params.purpose;
21319
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21320
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21344
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21345
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21321
21346
  case 1:
21322
21347
  chevrePay = _b.sent();
21323
21348
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21324
21349
  project: project,
21325
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21350
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21351
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21352
+ http_status_1.CONFLICT,
21353
+ http_status_1.TOO_MANY_REQUESTS
21354
+ ])
21326
21355
  })];
21327
21356
  case 2:
21328
21357
  paymentService = _b.sent();
@@ -21336,17 +21365,22 @@ var PaymentService = /** @class */ (function (_super) {
21336
21365
  */
21337
21366
  PaymentService.prototype.publishCreditCardPaymentUrl = function (params) {
21338
21367
  return __awaiter(this, void 0, void 0, function () {
21339
- var _a, auth, endpoint, project, seller, chevrePay, paymentService;
21368
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21340
21369
  return __generator(this, function (_b) {
21341
21370
  switch (_b.label) {
21342
21371
  case 0:
21343
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21344
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21372
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21373
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21345
21374
  case 1:
21346
21375
  chevrePay = _b.sent();
21347
21376
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21348
21377
  project: project,
21349
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21378
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21379
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21380
+ http_status_1.CONFLICT,
21381
+ http_status_1.GATEWAY_TIMEOUT,
21382
+ http_status_1.TOO_MANY_REQUESTS
21383
+ ])
21350
21384
  })];
21351
21385
  case 2:
21352
21386
  paymentService = _b.sent();
@@ -21361,19 +21395,24 @@ var PaymentService = /** @class */ (function (_super) {
21361
21395
  PaymentService.prototype.checkMovieTicket = function (params) {
21362
21396
  var _a, _b, _c, _d, _e, _f, _g, _h;
21363
21397
  return __awaiter(this, void 0, void 0, function () {
21364
- var paymentServiceId, paymentMethodType, _j, auth, endpoint, project, seller, chevrePay, paymentService, purpose, checkAction;
21398
+ var paymentServiceId, paymentMethodType, _j, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService, purpose, checkAction;
21365
21399
  return __generator(this, function (_k) {
21366
21400
  switch (_k.label) {
21367
21401
  case 0:
21368
21402
  paymentServiceId = String((_a = params.object) === null || _a === void 0 ? void 0 : _a.id);
21369
21403
  paymentMethodType = String((_c = (_b = params.object) === null || _b === void 0 ? void 0 : _b.paymentMethod) === null || _c === void 0 ? void 0 : _c.typeOf);
21370
- _j = this.options, auth = _j.auth, endpoint = _j.endpoint, project = _j.project, seller = _j.seller;
21371
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21404
+ _j = this.options, auth = _j.auth, endpoint = _j.endpoint, project = _j.project, seller = _j.seller, disableAutoRetry = _j.disableAutoRetry, retryableStatusCodes = _j.retryableStatusCodes;
21405
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21372
21406
  case 1:
21373
21407
  chevrePay = _k.sent();
21374
21408
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21375
21409
  project: project,
21376
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21410
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21411
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21412
+ http_status_1.CONFLICT,
21413
+ http_status_1.GATEWAY_TIMEOUT,
21414
+ http_status_1.TOO_MANY_REQUESTS
21415
+ ])
21377
21416
  })];
21378
21417
  case 2:
21379
21418
  paymentService = _k.sent();
@@ -21416,17 +21455,21 @@ var PaymentService = /** @class */ (function (_super) {
21416
21455
  */
21417
21456
  PaymentService.prototype.voidAnyPayment = function (params) {
21418
21457
  return __awaiter(this, void 0, void 0, function () {
21419
- var _a, auth, endpoint, project, seller, chevrePay, paymentService;
21458
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21420
21459
  return __generator(this, function (_b) {
21421
21460
  switch (_b.label) {
21422
21461
  case 0:
21423
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21424
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21462
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21463
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21425
21464
  case 1:
21426
21465
  chevrePay = _b.sent();
21427
21466
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21428
21467
  project: project,
21429
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21468
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21469
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21470
+ http_status_1.CONFLICT,
21471
+ http_status_1.TOO_MANY_REQUESTS
21472
+ ])
21430
21473
  })];
21431
21474
  case 2:
21432
21475
  paymentService = _b.sent();
@@ -21446,18 +21489,23 @@ var PaymentService = /** @class */ (function (_super) {
21446
21489
  */
21447
21490
  PaymentService.prototype.voidTransaction = function (params) {
21448
21491
  return __awaiter(this, void 0, void 0, function () {
21449
- var id, object, body, _a, auth, endpoint, project, seller, chevrePay, paymentService;
21492
+ var id, object, body, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21450
21493
  return __generator(this, function (_b) {
21451
21494
  switch (_b.label) {
21452
21495
  case 0:
21453
21496
  id = params.id, object = params.object, body = __rest(params, ["id", "object"]);
21454
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21455
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21497
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21498
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21456
21499
  case 1:
21457
21500
  chevrePay = _b.sent();
21458
21501
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21459
21502
  project: project,
21460
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21503
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21504
+ retryableStatusCodes: __spreadArray(__spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : []), [
21505
+ http_status_1.CONFLICT,
21506
+ http_status_1.GATEWAY_TIMEOUT,
21507
+ http_status_1.TOO_MANY_REQUESTS
21508
+ ])
21461
21509
  })];
21462
21510
  case 2:
21463
21511
  paymentService = _b.sent();
@@ -21478,18 +21526,19 @@ var PaymentService = /** @class */ (function (_super) {
21478
21526
  */
21479
21527
  PaymentService.prototype.findAuthorizeAction = function (params) {
21480
21528
  return __awaiter(this, void 0, void 0, function () {
21481
- var sameAs, object, purpose, _a, auth, endpoint, project, seller, chevrePay, paymentService;
21529
+ var sameAs, object, purpose, _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevrePay, paymentService;
21482
21530
  return __generator(this, function (_b) {
21483
21531
  switch (_b.label) {
21484
21532
  case 0:
21485
21533
  sameAs = params.sameAs, object = params.object, purpose = params.purpose;
21486
- _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
21487
- return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint })];
21534
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
21535
+ return [4 /*yield*/, index_1.loadChevrePay({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
21488
21536
  case 1:
21489
21537
  chevrePay = _b.sent();
21490
21538
  return [4 /*yield*/, chevrePay.createPaymentInstance({
21491
21539
  project: project,
21492
- seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
21540
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
21541
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
21493
21542
  })];
21494
21543
  case 2:
21495
21544
  paymentService = _b.sent();
@@ -21506,7 +21555,7 @@ var PaymentService = /** @class */ (function (_super) {
21506
21555
  }(service_1.Service));
21507
21556
  exports.PaymentService = PaymentService;
21508
21557
 
21509
- },{"../../factory":130,"../../index":131,"../../service":135}],130:[function(require,module,exports){
21558
+ },{"../../factory":130,"../../index":131,"../../service":135,"http-status":348}],130:[function(require,module,exports){
21510
21559
  "use strict";
21511
21560
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
21512
21561
  if (k2 === undefined) k2 = k;
@@ -24022,6 +24071,7 @@ var OAuth2client = /** @class */ (function () {
24022
24071
  error_1 = _c.sent();
24023
24072
  if (!(error_1 instanceof Error)) return [3 /*break*/, 9];
24024
24073
  statusCode = error_1.code;
24074
+ debug('retry? numberOfTry:', numberOfTry, 'statusCode: ', statusCode, 'retry: ', retry, 'retryableStatusCodes: ', retryableStatusCodes);
24025
24075
  if (!(retry && retryableStatusCodes.includes(statusCode))) return [3 /*break*/, 9];
24026
24076
  if (!(typeof this.credentials.refresh_token === 'string' && this.credentials.refresh_token.length > 0)) return [3 /*break*/, 7];
24027
24077
  return [4 /*yield*/, this.refreshAccessToken()];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "7.0.0-alpha.0",
3
+ "version": "7.0.0-alpha.1",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {