@cinerino/sdk 11.0.0 → 11.1.0

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.
@@ -1331,6 +1331,27 @@ var MeService = /** @class */ (function (_super) {
1331
1331
  });
1332
1332
  });
1333
1333
  };
1334
+ /**
1335
+ * マイ販売者検索
1336
+ */
1337
+ MeService.prototype.findMySellers = function (params) {
1338
+ return __awaiter(this, void 0, void 0, function () {
1339
+ var project, conditions;
1340
+ var _this = this;
1341
+ return __generator(this, function (_a) {
1342
+ project = params.project, conditions = params.conditions;
1343
+ return [2 /*return*/, this.fetch({
1344
+ uri: "/members/me/projects/" + String(project === null || project === void 0 ? void 0 : project.id) + "/sellers",
1345
+ method: 'GET',
1346
+ qs: conditions,
1347
+ expectedStatusCodes: [http_status_1.OK]
1348
+ })
1349
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
1350
+ return [2 /*return*/, response.json()];
1351
+ }); }); })];
1352
+ });
1353
+ });
1354
+ };
1334
1355
  return MeService;
1335
1356
  }(service_1.Service));
1336
1357
  exports.MeService = MeService;
@@ -15671,17 +15692,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
15671
15692
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
15672
15693
  }
15673
15694
  };
15674
- var __rest = (this && this.__rest) || function (s, e) {
15675
- var t = {};
15676
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15677
- t[p] = s[p];
15678
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15679
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
15680
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
15681
- t[p[i]] = s[p[i]];
15682
- }
15683
- return t;
15684
- };
15685
15695
  Object.defineProperty(exports, "__esModule", { value: true });
15686
15696
  exports.PaymentService = void 0;
15687
15697
  var http_status_1 = require("http-status");
@@ -15700,15 +15710,17 @@ var PaymentService = /** @class */ (function (_super) {
15700
15710
  */
15701
15711
  PaymentService.prototype.checkMovieTicket = function (params) {
15702
15712
  return __awaiter(this, void 0, void 0, function () {
15713
+ var object, purpose;
15703
15714
  var _this = this;
15704
15715
  return __generator(this, function (_a) {
15716
+ object = params.object, purpose = params.purpose;
15705
15717
  return [2 /*return*/, this.fetch({
15706
15718
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check",
15707
15719
  method: 'POST',
15708
15720
  expectedStatusCodes: [http_status_1.CREATED],
15709
- body: params,
15721
+ body: { object: object, purpose: purpose },
15710
15722
  qs: {
15711
- purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15723
+ purpose: { id: purpose.id } // 追加(2024-04-01~)
15712
15724
  }
15713
15725
  })
15714
15726
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -15722,16 +15734,18 @@ var PaymentService = /** @class */ (function (_super) {
15722
15734
  */
15723
15735
  PaymentService.prototype.checkMovieTicketAsync = function (params) {
15724
15736
  return __awaiter(this, void 0, void 0, function () {
15737
+ var object, purpose;
15725
15738
  var _this = this;
15726
15739
  return __generator(this, function (_a) {
15740
+ object = params.object, purpose = params.purpose;
15727
15741
  return [2 /*return*/, this.fetch({
15728
15742
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check",
15729
15743
  method: 'POST',
15730
15744
  expectedStatusCodes: [http_status_1.ACCEPTED],
15731
- body: params,
15745
+ body: { object: object, purpose: purpose },
15732
15746
  qs: {
15733
15747
  async: true,
15734
- purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15748
+ purpose: { id: purpose.id } // 追加(2024-04-01~)
15735
15749
  }
15736
15750
  })
15737
15751
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -15745,15 +15759,21 @@ var PaymentService = /** @class */ (function (_super) {
15745
15759
  */
15746
15760
  PaymentService.prototype.authorizeAnyPayment = function (params) {
15747
15761
  return __awaiter(this, void 0, void 0, function () {
15762
+ var object, purpose, amount, issuedThrough, paymentMethod, name, additionalProperty, ticketToken;
15748
15763
  var _this = this;
15749
15764
  return __generator(this, function (_a) {
15765
+ object = params.object, purpose = params.purpose;
15766
+ amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
15750
15767
  return [2 /*return*/, this.fetch({
15751
15768
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.FaceToFace + "/authorize",
15752
15769
  method: 'POST',
15753
15770
  expectedStatusCodes: [http_status_1.CREATED],
15754
- body: params,
15771
+ body: {
15772
+ object: __assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (typeof name === 'string') ? { name: name } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
15773
+ purpose: purpose
15774
+ },
15755
15775
  qs: {
15756
- purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15776
+ purpose: { id: purpose.id } // 追加(2024-04-01~)
15757
15777
  }
15758
15778
  })
15759
15779
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -15767,14 +15787,20 @@ var PaymentService = /** @class */ (function (_super) {
15767
15787
  */
15768
15788
  PaymentService.prototype.authorizeCreditCard = function (params, options) {
15769
15789
  return __awaiter(this, void 0, void 0, function () {
15790
+ var object, purpose, amount, issuedThrough, paymentMethod, creditCard, method, paymentMethodId, name, additionalProperty, ticketToken;
15770
15791
  var _this = this;
15771
15792
  return __generator(this, function (_a) {
15793
+ object = params.object, purpose = params.purpose;
15794
+ amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, creditCard = object.creditCard, method = object.method, paymentMethodId = object.paymentMethodId, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
15772
15795
  return [2 /*return*/, this.fetch({
15773
15796
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/authorize",
15774
15797
  method: 'POST',
15775
15798
  expectedStatusCodes: [http_status_1.ACCEPTED, http_status_1.CREATED],
15776
- body: params,
15777
- qs: __assign(__assign({}, options), { purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15799
+ body: {
15800
+ object: __assign(__assign(__assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof paymentMethodId === 'string') ? { paymentMethodId: paymentMethodId } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
15801
+ purpose: purpose
15802
+ },
15803
+ qs: __assign(__assign({}, options), { purpose: { id: purpose.id } // 追加(2024-04-01~)
15778
15804
  })
15779
15805
  })
15780
15806
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -15788,14 +15814,20 @@ var PaymentService = /** @class */ (function (_super) {
15788
15814
  */
15789
15815
  PaymentService.prototype.authorizeMovieTicket = function (params, options) {
15790
15816
  return __awaiter(this, void 0, void 0, function () {
15817
+ var object, purpose, issuedThrough, paymentMethod, movieTickets, name, additionalProperty, ticketToken;
15791
15818
  var _this = this;
15792
15819
  return __generator(this, function (_a) {
15820
+ object = params.object, purpose = params.purpose;
15821
+ issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, movieTickets = object.movieTickets, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
15793
15822
  return [2 /*return*/, this.fetch({
15794
15823
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/authorize",
15795
15824
  method: 'POST',
15796
15825
  expectedStatusCodes: [http_status_1.ACCEPTED, http_status_1.CREATED],
15797
- body: params,
15798
- qs: __assign(__assign({}, options), { purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15826
+ body: {
15827
+ object: __assign(__assign(__assign(__assign({ issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (Array.isArray(movieTickets)) ? { movieTickets: movieTickets } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
15828
+ purpose: purpose
15829
+ },
15830
+ qs: __assign(__assign({}, options), { purpose: { id: purpose.id } // 追加(2024-04-01~)
15799
15831
  })
15800
15832
  })
15801
15833
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -15809,15 +15841,21 @@ var PaymentService = /** @class */ (function (_super) {
15809
15841
  */
15810
15842
  PaymentService.prototype.authorizePaymentCard = function (params) {
15811
15843
  return __awaiter(this, void 0, void 0, function () {
15844
+ var object, purpose, amount, issuedThrough, paymentMethod, name, additionalProperty, fromLocation, description;
15812
15845
  var _this = this;
15813
15846
  return __generator(this, function (_a) {
15847
+ object = params.object, purpose = params.purpose;
15848
+ amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, name = object.name, additionalProperty = object.additionalProperty, fromLocation = object.fromLocation, description = object.description;
15814
15849
  return [2 /*return*/, this.fetch({
15815
15850
  uri: "/payment/" + factory.product.ProductType.PaymentCard + "/authorize",
15816
15851
  method: 'POST',
15817
15852
  expectedStatusCodes: [http_status_1.CREATED],
15818
- body: params,
15853
+ body: {
15854
+ object: __assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (typeof fromLocation === 'string') ? { fromLocation: fromLocation } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof description === 'string') ? { description: description } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
15855
+ purpose: purpose
15856
+ },
15819
15857
  qs: {
15820
- purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15858
+ purpose: { id: purpose.id } // 追加(2024-04-01~)
15821
15859
  }
15822
15860
  })
15823
15861
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -15831,15 +15869,19 @@ var PaymentService = /** @class */ (function (_super) {
15831
15869
  */
15832
15870
  PaymentService.prototype.publishCreditCardPaymentUrlAsync = function (params) {
15833
15871
  return __awaiter(this, void 0, void 0, function () {
15834
- var object, purpose;
15872
+ var object, purpose, amount, creditCard, issuedThrough, paymentMethod, method, ticketToken;
15835
15873
  var _this = this;
15836
15874
  return __generator(this, function (_a) {
15837
15875
  object = params.object, purpose = params.purpose;
15876
+ amount = object.amount, creditCard = object.creditCard, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, method = object.method, ticketToken = object.ticketToken;
15838
15877
  return [2 /*return*/, this.fetch({
15839
15878
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/publishPaymentUrl",
15840
15879
  method: 'POST',
15841
15880
  expectedStatusCodes: [http_status_1.ACCEPTED],
15842
- body: { object: object, purpose: purpose },
15881
+ body: {
15882
+ object: __assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined),
15883
+ purpose: purpose
15884
+ },
15843
15885
  qs: {
15844
15886
  async: true,
15845
15887
  purpose: { id: purpose.id } // 追加(2024-04-01~)
@@ -15856,18 +15898,18 @@ var PaymentService = /** @class */ (function (_super) {
15856
15898
  */
15857
15899
  PaymentService.prototype.voidAnyPayment = function (params) {
15858
15900
  return __awaiter(this, void 0, void 0, function () {
15859
- var id, body;
15901
+ var id, purpose;
15860
15902
  return __generator(this, function (_a) {
15861
15903
  switch (_a.label) {
15862
15904
  case 0:
15863
- id = params.id, body = __rest(params, ["id"]);
15905
+ id = params.id, purpose = params.purpose;
15864
15906
  return [4 /*yield*/, this.fetch({
15865
15907
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.FaceToFace + "/authorize/" + id + "/void",
15866
15908
  method: 'PUT',
15867
15909
  expectedStatusCodes: [http_status_1.NO_CONTENT],
15868
- body: body,
15910
+ body: { purpose: purpose },
15869
15911
  qs: {
15870
- purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15912
+ purpose: { id: purpose.id } // 追加(2024-04-01~)
15871
15913
  }
15872
15914
  })];
15873
15915
  case 1:
@@ -15882,18 +15924,18 @@ var PaymentService = /** @class */ (function (_super) {
15882
15924
  */
15883
15925
  PaymentService.prototype.voidTransaction = function (params) {
15884
15926
  return __awaiter(this, void 0, void 0, function () {
15885
- var id, object, body;
15927
+ var id, object, purpose;
15886
15928
  return __generator(this, function (_a) {
15887
15929
  switch (_a.label) {
15888
15930
  case 0:
15889
- id = params.id, object = params.object, body = __rest(params, ["id", "object"]);
15931
+ id = params.id, object = params.object, purpose = params.purpose;
15890
15932
  return [4 /*yield*/, this.fetch({
15891
15933
  uri: "/payment/" + object.typeOf + "/authorize/" + id + "/void",
15892
15934
  method: 'PUT',
15893
15935
  expectedStatusCodes: [http_status_1.NO_CONTENT],
15894
- body: body,
15936
+ body: { purpose: purpose },
15895
15937
  qs: {
15896
- purpose: { id: params.purpose.id } // 追加(2024-04-01~)
15938
+ purpose: { id: purpose.id } // 追加(2024-04-01~)
15897
15939
  }
15898
15940
  })];
15899
15941
  case 1:
@@ -16023,7 +16065,7 @@ var PaymentService = /** @class */ (function (_super) {
16023
16065
  expectedStatusCodes: [http_status_1.CREATED],
16024
16066
  body: { purpose: purpose },
16025
16067
  qs: {
16026
- purpose: { id: params.purpose.id }
16068
+ purpose: { id: purpose.id }
16027
16069
  }
16028
16070
  })
16029
16071
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -16044,7 +16086,7 @@ var PaymentService = /** @class */ (function (_super) {
16044
16086
  expectedStatusCodes: [http_status_1.CREATED],
16045
16087
  body: { purpose: purpose, ticketedPermit: ticketedPermit },
16046
16088
  qs: {
16047
- purpose: { id: params.purpose.id }
16089
+ purpose: { id: purpose.id }
16048
16090
  }
16049
16091
  })
16050
16092
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -16065,7 +16107,7 @@ var PaymentService = /** @class */ (function (_super) {
16065
16107
  expectedStatusCodes: [http_status_1.CREATED],
16066
16108
  body: { purpose: purpose, ticketedInvoice: ticketedInvoice },
16067
16109
  qs: {
16068
- purpose: { id: params.purpose.id }
16110
+ purpose: { id: purpose.id }
16069
16111
  }
16070
16112
  })
16071
16113
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
@@ -20842,7 +20884,7 @@ exports.MeService = void 0;
20842
20884
  var index_1 = require("../../index");
20843
20885
  var service_1 = require("../../service");
20844
20886
  /**
20845
- * 管理者サービス
20887
+ * 管理者(自分自身)サービス
20846
20888
  */
20847
20889
  var MeService = /** @class */ (function (_super) {
20848
20890
  __extends(MeService, _super);
@@ -20870,6 +20912,27 @@ var MeService = /** @class */ (function (_super) {
20870
20912
  });
20871
20913
  });
20872
20914
  };
20915
+ /**
20916
+ * マイ販売者検索
20917
+ */
20918
+ MeService.prototype.findMySellers = function (params) {
20919
+ return __awaiter(this, void 0, void 0, function () {
20920
+ var _a, auth, endpoint, chevreAdmin, meService;
20921
+ return __generator(this, function (_b) {
20922
+ switch (_b.label) {
20923
+ case 0:
20924
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint;
20925
+ return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
20926
+ case 1:
20927
+ chevreAdmin = _b.sent();
20928
+ return [4 /*yield*/, chevreAdmin.createMeInstance()];
20929
+ case 2:
20930
+ meService = _b.sent();
20931
+ return [2 /*return*/, meService.findMySellers(params)];
20932
+ }
20933
+ });
20934
+ });
20935
+ };
20873
20936
  return MeService;
20874
20937
  }(service_1.Service));
20875
20938
  exports.MeService = MeService;
@@ -27226,6 +27289,17 @@ exports.LoginTicket = LoginTicket;
27226
27289
  },{}],173:[function(require,module,exports){
27227
27290
  (function (Buffer){
27228
27291
  "use strict";
27292
+ var __assign = (this && this.__assign) || function () {
27293
+ __assign = Object.assign || function(t) {
27294
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
27295
+ s = arguments[i];
27296
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
27297
+ t[p] = s[p];
27298
+ }
27299
+ return t;
27300
+ };
27301
+ return __assign.apply(this, arguments);
27302
+ };
27229
27303
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
27230
27304
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27231
27305
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -27297,6 +27371,7 @@ var OAuth2client = /** @class */ (function () {
27297
27371
  // TODO add minimum validation
27298
27372
  this.options = options;
27299
27373
  this.credentials = {};
27374
+ this.events = {};
27300
27375
  }
27301
27376
  OAuth2client.BASE64URLENCODE = function (str) {
27302
27377
  return str.toString('base64')
@@ -27415,12 +27490,22 @@ var OAuth2client = /** @class */ (function () {
27415
27490
  throw new Error('No refresh token is set.');
27416
27491
  }
27417
27492
  return [2 /*return*/, this.refreshToken(this.credentials.refresh_token)
27418
- .then(function (tokens) {
27419
- tokens.refresh_token = _this.credentials.refresh_token;
27420
- debug('setting credentials...', tokens);
27421
- _this.credentials = tokens;
27422
- return _this.credentials;
27423
- })];
27493
+ .then(function (refreshTokenResult) { return __awaiter(_this, void 0, void 0, function () {
27494
+ return __generator(this, function (_a) {
27495
+ switch (_a.label) {
27496
+ case 0:
27497
+ // tokens.refresh_token = this.credentials.refresh_token;
27498
+ debug('setting credentials...', refreshTokenResult);
27499
+ this.credentials = __assign(__assign({}, refreshTokenResult), { refresh_token: this.credentials.refresh_token });
27500
+ if (!(typeof this.events.onTokenRefreshed === 'function')) return [3 /*break*/, 2];
27501
+ return [4 /*yield*/, this.events.onTokenRefreshed(this.credentials)];
27502
+ case 1:
27503
+ _a.sent();
27504
+ _a.label = 2;
27505
+ case 2: return [2 /*return*/, this.credentials];
27506
+ }
27507
+ });
27508
+ }); })];
27424
27509
  });
27425
27510
  });
27426
27511
  };
@@ -27566,6 +27651,12 @@ var OAuth2client = /** @class */ (function () {
27566
27651
  // return this.verifySignedJwt(options.idToken, options.audience, OAuth2Client.ISSUERS_);
27567
27652
  return this.verifySignedJwt(this.credentials.id_token, options.audience);
27568
27653
  };
27654
+ /**
27655
+ * トークン更新イベントハンドラを登録する
27656
+ */
27657
+ OAuth2client.prototype.onTokenRefreshed = function (params) {
27658
+ this.events.onTokenRefreshed = params;
27659
+ };
27569
27660
  /**
27570
27661
  * Provides a request implementation with OAuth 2.0 flow.
27571
27662
  * If credentials have a refresh_token, in cases of HTTP
@@ -27631,7 +27722,7 @@ var OAuth2client = /** @class */ (function () {
27631
27722
  debug('fetching...', options);
27632
27723
  return [2 /*return*/, fetch("https://" + this.options.domain + OAuth2client.OAUTH2_TOKEN_URI, options)
27633
27724
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () {
27634
- var body, body, tokens;
27725
+ var body, body, result, refreshTokenResponse, access_token, id_token, expires_in, token_type;
27635
27726
  return __generator(this, function (_a) {
27636
27727
  switch (_a.label) {
27637
27728
  case 0:
@@ -27647,17 +27738,29 @@ var OAuth2client = /** @class */ (function () {
27647
27738
  body = _a.sent();
27648
27739
  throw new Error(body);
27649
27740
  case 4: return [3 /*break*/, 7];
27650
- case 5: return [4 /*yield*/, response.json()];
27741
+ case 5:
27742
+ result = void 0;
27743
+ return [4 /*yield*/, response.json()];
27651
27744
  case 6:
27652
- tokens = _a.sent();
27745
+ refreshTokenResponse = _a.sent();
27653
27746
  // tslint:disable-next-line:no-single-line-block-comment
27654
27747
  /* istanbul ignore else */
27655
- if (tokens && tokens.expires_in) {
27656
- // tslint:disable-next-line:no-magic-numbers
27657
- tokens.expiry_date = ((new Date()).getTime() + (tokens.expires_in * 1000));
27658
- delete tokens.expires_in;
27748
+ if (refreshTokenResponse !== undefined && typeof refreshTokenResponse.expires_in === 'number') {
27749
+ access_token = refreshTokenResponse.access_token, id_token = refreshTokenResponse.id_token, expires_in = refreshTokenResponse.expires_in, token_type = refreshTokenResponse.token_type;
27750
+ result = {
27751
+ access_token: access_token, id_token: id_token, token_type: token_type,
27752
+ // tslint:disable-next-line:no-magic-numbers
27753
+ expiry_date: ((new Date()).getTime() + (expires_in * 1000))
27754
+ };
27755
+ // delete tokens.expires_in;
27659
27756
  }
27660
- return [2 /*return*/, tokens];
27757
+ else {
27758
+ // 想定していないリフレッシュトークンレスポンスはログ出力
27759
+ // tslint:disable-next-line:no-console
27760
+ console.error('unexpected refreshToken response:', refreshTokenResponse);
27761
+ throw new Error('unexpected refreshToken response.');
27762
+ }
27763
+ return [2 /*return*/, result];
27661
27764
  case 7: return [2 /*return*/];
27662
27765
  }
27663
27766
  });
@@ -15,6 +15,9 @@ export async function login() {
15
15
  redirectUri: 'https://localhost/signIn',
16
16
  logoutUri: 'https://localhost/signOut'
17
17
  });
18
+ auth.onTokenRefreshed(async (params) => {
19
+ console.log('onTokenRefreshed called.', params);
20
+ });
18
21
 
19
22
  const scopes: string[] = [];
20
23
  const state = '12345';
@@ -48,13 +51,13 @@ export async function login() {
48
51
  return;
49
52
  }
50
53
 
51
- let credentials = await auth.getToken(code, codeVerifier);
54
+ const credentials = await auth.getToken(code, codeVerifier);
52
55
  // console.log('credentials published', credentials);
53
56
 
54
57
  auth.setCredentials(credentials);
55
58
 
56
- credentials = await auth.refreshAccessToken();
57
- console.log('credentials refreshed', credentials);
59
+ // credentials = await auth.refreshAccessToken();
60
+ // console.log('credentials refreshed', credentials);
58
61
 
59
62
  // rl.close();
60
63
  resolve();
@@ -0,0 +1,33 @@
1
+ // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
+ import * as client from '../../../../lib/';
3
+ import * as auth from '../../auth/authAsAdmin';
4
+
5
+ const project = { id: String(process.env.PROJECT_ID) };
6
+
7
+ async function main() {
8
+ const authClient = await auth.login();
9
+ // await authClient.refreshAccessToken();
10
+ const loginTicket = authClient.verifyIdToken({});
11
+ console.log('username is', loginTicket.getUsername());
12
+
13
+ const meService = await (await client.loadChevreAdmin({
14
+ endpoint: <string>process.env.CHEVRE_ENDPOINT,
15
+ auth: authClient
16
+ })).createMeInstance();
17
+
18
+ const data = await meService.findMySellers({
19
+ project: { id: project.id },
20
+ conditions: {
21
+ limit: 10,
22
+ page: 1
23
+ }
24
+ });
25
+ console.log(data);
26
+ console.log(data.length);
27
+ }
28
+
29
+ main()
30
+ .then(() => {
31
+ console.log('main processed.');
32
+ })
33
+ .catch(console.error);
@@ -2,7 +2,7 @@
2
2
  import * as moment from 'moment';
3
3
 
4
4
  let startTime = process.hrtime();
5
- import * as client from '../../../lib/index';
5
+ import * as client from '../../../../lib/index';
6
6
  let diff = process.hrtime(startTime);
7
7
  console.log(`importing sdk took ${diff[0]} seconds and ${diff[1]} nanoseconds.`);
8
8
 
@@ -1,10 +1,9 @@
1
1
  // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
- import { loadCloudAdmin } from '../../../lib/';
3
- import * as auth from '../auth/authAsAdmin';
2
+ import { loadCloudAdmin } from '../../../../lib/';
3
+ import * as auth from '../../auth/authAsAdmin';
4
4
 
5
5
  async function main() {
6
6
  const authClient = await auth.login();
7
- await authClient.refreshAccessToken();
8
7
  const loginTicket = authClient.verifyIdToken({});
9
8
  console.log('username is', loginTicket.getUsername());
10
9
 
@@ -0,0 +1,31 @@
1
+ // tslint:disable:no-implicit-dependencies no-console no-magic-numbers
2
+ import { loadCloudAdmin } from '../../../../lib/';
3
+ import * as auth from '../../auth/authAsAdmin';
4
+
5
+ const project = { id: String(process.env.PROJECT_ID) };
6
+ async function main() {
7
+ const authClient = await auth.login();
8
+ const loginTicket = authClient.verifyIdToken({});
9
+ console.log('username is', loginTicket.getUsername());
10
+
11
+ const meService = await (await loadCloudAdmin({
12
+ endpoint: <string>process.env.API_ADMIN_ENDPOINT,
13
+ auth: authClient
14
+ })).createMeInstance();
15
+
16
+ const sellers = await meService.findMySellers({
17
+ project: { id: project.id },
18
+ conditions: {
19
+ limit: 3,
20
+ page: 1
21
+ }
22
+ });
23
+ console.log(sellers);
24
+ console.log(sellers.length, 'sellers found');
25
+ }
26
+
27
+ main()
28
+ .then(() => {
29
+ console.log('main processed.');
30
+ })
31
+ .catch(console.error);
@@ -185,7 +185,9 @@ async function main() {
185
185
  method: '1',
186
186
  creditCard,
187
187
  issuedThrough: { id: paymentServiceId },
188
- ticketToken
188
+ ticketToken,
189
+ name: 'samplePaymentMethodName',
190
+ additionalProperty: [{ name: 'samplePropertyName', value: 'samplePropertyValue' }]
189
191
  },
190
192
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
191
193
  })({ paymentService });
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../factory';
2
2
  import { IOptions, Service } from '../service';
3
- export interface ISearchProjectConditions {
3
+ export interface IFindMyProjectConditions {
4
4
  limit?: number;
5
5
  page?: number;
6
6
  id?: {
@@ -8,7 +8,9 @@ export interface ISearchProjectConditions {
8
8
  $regex?: string;
9
9
  };
10
10
  }
11
+ export declare type IFindMySellerConditions = Pick<factory.seller.ISearchConditions, 'branchCode' | 'id' | 'limit' | 'page' | 'name'>;
11
12
  export declare type IMyProject = Pick<factory.project.IProject, 'id' | 'logo' | 'name'>;
13
+ export declare type IMySeller = Pick<factory.seller.ISeller, 'additionalProperty' | 'branchCode' | 'id' | 'name' | 'telephone' | 'url'>;
12
14
  /**
13
15
  * 管理者(自分自身)サービス
14
16
  */
@@ -17,5 +19,14 @@ export declare class MeService extends Service<IOptions> {
17
19
  /**
18
20
  * マイプロジェクト検索
19
21
  */
20
- findMyProjects(params: ISearchProjectConditions): Promise<IMyProject[]>;
22
+ findMyProjects(params: IFindMyProjectConditions): Promise<IMyProject[]>;
23
+ /**
24
+ * マイ販売者検索
25
+ */
26
+ findMySellers(params: {
27
+ project: {
28
+ id: string;
29
+ };
30
+ conditions: IFindMySellerConditions;
31
+ }): Promise<IMySeller[]>;
21
32
  }
@@ -92,6 +92,27 @@ var MeService = /** @class */ (function (_super) {
92
92
  });
93
93
  });
94
94
  };
95
+ /**
96
+ * マイ販売者検索
97
+ */
98
+ MeService.prototype.findMySellers = function (params) {
99
+ return __awaiter(this, void 0, void 0, function () {
100
+ var project, conditions;
101
+ var _this = this;
102
+ return __generator(this, function (_a) {
103
+ project = params.project, conditions = params.conditions;
104
+ return [2 /*return*/, this.fetch({
105
+ uri: "/members/me/projects/" + String(project === null || project === void 0 ? void 0 : project.id) + "/sellers",
106
+ method: 'GET',
107
+ qs: conditions,
108
+ expectedStatusCodes: [http_status_1.OK]
109
+ })
110
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
111
+ return [2 /*return*/, response.json()];
112
+ }); }); })];
113
+ });
114
+ });
115
+ };
95
116
  return MeService;
96
117
  }(service_1.Service));
97
118
  exports.MeService = MeService;