@cinerino/sdk 5.2.0 → 5.3.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.
@@ -0,0 +1,34 @@
1
+ // tslint:disable:no-console
2
+ import * as client from '../../lib/index';
3
+ import { auth } from './auth/clientCredentials';
4
+
5
+ const PROJECT_ID = String(process.env.PROJECT_ID);
6
+
7
+ async function main() {
8
+ const reservationService = new (await client.loadService()).Reservation({
9
+ endpoint: <string>process.env.API_ENDPOINT,
10
+ auth: await auth(),
11
+ project: { id: PROJECT_ID },
12
+ seller: { id: '' }
13
+ });
14
+
15
+ const reservations = await reservationService.searchByOrder(
16
+ {
17
+ confirmationNumber: '36684',
18
+ orderNumber: 'CIN1-3743286-2441943'
19
+ },
20
+ {
21
+ limit: 10,
22
+ page: 1,
23
+ typeOf: client.factory.reservationType.EventReservation
24
+ }
25
+ );
26
+ console.log(reservations.map((reservation) => `${reservation.id} ${reservation.reservationStatus}`));
27
+ console.log(reservations.length, 'reservations found');
28
+ }
29
+
30
+ main()
31
+ .then(() => {
32
+ console.log('success!');
33
+ })
34
+ .catch(console.error);
@@ -90,7 +90,7 @@ export declare class OrderService extends Service {
90
90
  orderNumber: string;
91
91
  }): Promise<void>;
92
92
  /**
93
- * 確認番号で注文オファー検索検索
93
+ * 確認番号で注文オファー検索
94
94
  */
95
95
  searchAcceptedOffersByConfirmationNumber(params: {
96
96
  limit?: number;
@@ -77,11 +77,7 @@ var OrderService = /** @class */ (function (_super) {
77
77
  /**
78
78
  * なければ作成する
79
79
  */
80
- OrderService.prototype.createIfNotExist = function (params
81
- // options: {
82
- // byTransaction?: '1';
83
- // }
84
- ) {
80
+ OrderService.prototype.createIfNotExist = function (params) {
85
81
  return __awaiter(this, void 0, void 0, function () {
86
82
  return __generator(this, function (_a) {
87
83
  switch (_a.label) {
@@ -89,7 +85,6 @@ var OrderService = /** @class */ (function (_super) {
89
85
  uri: "/orders/" + params.orderNumber,
90
86
  method: 'PUT',
91
87
  body: params,
92
- // qs: options,
93
88
  expectedStatusCodes: [http_status_1.NO_CONTENT]
94
89
  })];
95
90
  case 1:
@@ -199,7 +194,7 @@ var OrderService = /** @class */ (function (_super) {
199
194
  });
200
195
  };
201
196
  /**
202
- * 確認番号で注文オファー検索検索
197
+ * 確認番号で注文オファー検索
203
198
  */
204
199
  OrderService.prototype.searchAcceptedOffersByConfirmationNumber = function (params) {
205
200
  return __awaiter(this, void 0, void 0, function () {
@@ -0,0 +1,21 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ /**
4
+ * 予約サービス
5
+ */
6
+ export declare class ReservationService extends Service {
7
+ /**
8
+ * 注文に含まれる予約照会
9
+ */
10
+ searchByOrder(params: {
11
+ confirmationNumber: string;
12
+ orderNumber: string;
13
+ }, qs: {
14
+ /**
15
+ * max: 10
16
+ */
17
+ limit?: number;
18
+ page?: number;
19
+ typeOf: factory.reservationType.EventReservation;
20
+ }): Promise<Pick<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'additionalTicketText' | 'id' | 'reservationStatus'>[]>;
21
+ }
@@ -0,0 +1,87 @@
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.ReservationService = void 0;
55
+ var http_status_1 = require("http-status");
56
+ var service_1 = require("../service");
57
+ /**
58
+ * 予約サービス
59
+ */
60
+ var ReservationService = /** @class */ (function (_super) {
61
+ __extends(ReservationService, _super);
62
+ function ReservationService() {
63
+ return _super !== null && _super.apply(this, arguments) || this;
64
+ }
65
+ /**
66
+ * 注文に含まれる予約照会
67
+ */
68
+ ReservationService.prototype.searchByOrder = function (params, qs) {
69
+ return __awaiter(this, void 0, void 0, function () {
70
+ var _this = this;
71
+ return __generator(this, function (_a) {
72
+ return [2 /*return*/, this.fetch({
73
+ uri: '/reservations/searchByOrder',
74
+ method: 'POST',
75
+ body: params,
76
+ qs: qs,
77
+ expectedStatusCodes: [http_status_1.OK]
78
+ })
79
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
80
+ return [2 /*return*/, response.json()];
81
+ }); }); })];
82
+ });
83
+ });
84
+ };
85
+ return ReservationService;
86
+ }(service_1.Service));
87
+ exports.ReservationService = ReservationService;
@@ -10,6 +10,7 @@ import type { PersonOwnershipInfoService } from './chevre/person/ownershipInfo';
10
10
  import type { PlaceService } from './chevre/place';
11
11
  import type { HasPOSService } from './chevre/place/hasPOS';
12
12
  import type { ProductService } from './chevre/product';
13
+ import type { ReservationService } from './chevre/reservation';
13
14
  import type { SellerService } from './chevre/seller';
14
15
  import type { TokenService } from './chevre/token';
15
16
  import type { TripService } from './chevre/trip';
@@ -103,6 +104,13 @@ export declare namespace service {
103
104
  namespace Seller {
104
105
  let svc: typeof SellerService | undefined;
105
106
  }
107
+ /**
108
+ * 予約サービス
109
+ */
110
+ type Reservation = ReservationService;
111
+ namespace Reservation {
112
+ let svc: typeof ReservationService | undefined;
113
+ }
106
114
  /**
107
115
  * トークンサービス
108
116
  */
@@ -135,6 +143,7 @@ export declare class Chevre {
135
143
  createPlaceInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<PlaceService>;
136
144
  createHasPOSInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<HasPOSService>;
137
145
  createProductInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ProductService>;
146
+ createReservationInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<ReservationService>;
138
147
  createSellerInstance(params: Pick<IOptions, 'project'>): Promise<SellerService>;
139
148
  createTokenInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TokenService>;
140
149
  createTripInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<TripService>;
@@ -93,6 +93,9 @@ var service;
93
93
  var Seller;
94
94
  (function (Seller) {
95
95
  })(Seller = service.Seller || (service.Seller = {}));
96
+ var Reservation;
97
+ (function (Reservation) {
98
+ })(Reservation = service.Reservation || (service.Reservation = {}));
96
99
  var Token;
97
100
  (function (Token) {
98
101
  })(Token = service.Token || (service.Token = {}));
@@ -294,6 +297,23 @@ var Chevre = /** @class */ (function () {
294
297
  });
295
298
  });
296
299
  };
300
+ Chevre.prototype.createReservationInstance = function (params) {
301
+ return __awaiter(this, void 0, void 0, function () {
302
+ var _a;
303
+ return __generator(this, function (_b) {
304
+ switch (_b.label) {
305
+ case 0:
306
+ if (!(service.Reservation.svc === undefined)) return [3 /*break*/, 2];
307
+ _a = service.Reservation;
308
+ return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevre/reservation'); })];
309
+ case 1:
310
+ _a.svc = (_b.sent()).ReservationService;
311
+ _b.label = 2;
312
+ case 2: return [2 /*return*/, new service.Reservation.svc(__assign(__assign({}, this.options), params))];
313
+ }
314
+ });
315
+ });
316
+ };
297
317
  Chevre.prototype.createSellerInstance = function (params) {
298
318
  return __awaiter(this, void 0, void 0, function () {
299
319
  var _a;
@@ -145,7 +145,7 @@ export declare class OrderService extends Service {
145
145
  page?: number;
146
146
  }): Promise<IAcceptedOffer[]>;
147
147
  /**
148
- * 確認番号で注文オファー検索検索
148
+ * 確認番号で注文オファー検索
149
149
  */
150
150
  searchAcceptedOffersByConfirmationNumber(params: {
151
151
  limit?: number;
@@ -265,7 +265,7 @@ var OrderService = /** @class */ (function (_super) {
265
265
  });
266
266
  };
267
267
  /**
268
- * 確認番号で注文オファー検索検索
268
+ * 確認番号で注文オファー検索
269
269
  */
270
270
  OrderService.prototype.searchAcceptedOffersByConfirmationNumber = function (params) {
271
271
  return __awaiter(this, void 0, void 0, function () {
@@ -65,4 +65,18 @@ export declare class ReservationService extends Service {
65
65
  id: string;
66
66
  };
67
67
  }): Promise<void>;
68
+ /**
69
+ * 注文に含まれる予約照会
70
+ */
71
+ searchByOrder(params: {
72
+ confirmationNumber: string;
73
+ orderNumber: string;
74
+ }, qs: {
75
+ /**
76
+ * max: 10
77
+ */
78
+ limit?: number;
79
+ page?: number;
80
+ typeOf: factory.reservationType.EventReservation;
81
+ }): Promise<Pick<factory.reservation.IReservation<factory.reservationType.EventReservation>, 'additionalTicketText' | 'id' | 'reservationStatus'>[]>;
68
82
  }
@@ -161,6 +161,26 @@ var ReservationService = /** @class */ (function (_super) {
161
161
  });
162
162
  });
163
163
  };
164
+ /**
165
+ * 注文に含まれる予約照会
166
+ */
167
+ ReservationService.prototype.searchByOrder = function (params, qs) {
168
+ return __awaiter(this, void 0, void 0, function () {
169
+ var _this = this;
170
+ return __generator(this, function (_a) {
171
+ return [2 /*return*/, this.fetch({
172
+ uri: '/reservations/searchByOrder',
173
+ method: 'POST',
174
+ body: params,
175
+ qs: qs,
176
+ expectedStatusCodes: [http_status_1.OK]
177
+ })
178
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
179
+ return [2 /*return*/, response.json()];
180
+ }); }); })];
181
+ });
182
+ });
183
+ };
164
184
  return ReservationService;
165
185
  }(service_1.Service));
166
186
  exports.ReservationService = ReservationService;