@cinerino/sdk 9.0.0 → 10.0.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.
Files changed (42) hide show
  1. package/example/playground/public/lib/bundle.js +2448 -2233
  2. package/example/src/cloud/findOrderByConfirmationNumber.ts +31 -0
  3. package/example/src/{findReservationByCode.ts → cloud/findReservationByCode.ts} +6 -5
  4. package/example/src/{searchReservationsByOrder.ts → cloud/searchReservationsByOrder.ts} +8 -7
  5. package/example/src/st/person/searchPaymentCards.ts +3 -2
  6. package/lib/abstract/chevreAsset/order/factory.d.ts +12 -1
  7. package/lib/abstract/chevreAsset.d.ts +8 -8
  8. package/lib/abstract/chevreAsset.js +10 -5
  9. package/lib/abstract/cinerino/default.d.ts +1 -49
  10. package/lib/abstract/cinerino/default.js +2 -89
  11. package/lib/abstract/cloud/asset/delivery.d.ts +22 -0
  12. package/lib/abstract/{cinerino/service/reservation.js → cloud/asset/delivery.js} +41 -53
  13. package/lib/abstract/{cinerino/service → cloud/asset}/order.d.ts +2 -2
  14. package/lib/abstract/cloud/asset/order.js +300 -0
  15. package/lib/abstract/{cinerino/service → cloud/asset}/person/ownershipInfo.d.ts +1 -16
  16. package/lib/abstract/cloud/asset/person/ownershipInfo.js +149 -0
  17. package/lib/abstract/cloud/asset/person.d.ts +12 -0
  18. package/lib/abstract/{cinerino/service/delivery.js → cloud/asset/person.js} +35 -32
  19. package/lib/abstract/{cinerino/service → cloud/asset}/reservation.d.ts +1 -2
  20. package/lib/abstract/cloud/asset/reservation.js +127 -0
  21. package/lib/abstract/{cinerino/service → cloud/asset}/token.d.ts +4 -2
  22. package/lib/abstract/{cinerino/service → cloud/asset}/token.js +32 -25
  23. package/lib/abstract/cloud/asset.d.ts +92 -0
  24. package/lib/abstract/cloud/asset.js +224 -0
  25. package/lib/abstract/index.d.ts +18 -1
  26. package/lib/abstract/index.js +39 -1
  27. package/lib/browser.d.ts +2 -2
  28. package/lib/browser.js +2 -1
  29. package/lib/bundle.js +2463 -2227
  30. package/lib/index.d.ts +2 -2
  31. package/lib/index.js +2 -1
  32. package/package.json +2 -2
  33. package/example/src/st/person/getProfile.ts +0 -46
  34. package/example/src/st/person/searchCreditCards.ts +0 -60
  35. package/example/src/st/person/searchMemberships.ts +0 -46
  36. package/example/src/st/person/searchMyOrders.ts +0 -52
  37. package/example/src/st/person/searchReservations.ts +0 -56
  38. package/lib/abstract/cinerino/service/delivery.d.ts +0 -24
  39. package/lib/abstract/cinerino/service/order.js +0 -225
  40. package/lib/abstract/cinerino/service/person/ownershipInfo.js +0 -141
  41. package/lib/abstract/cinerino/service/person.d.ts +0 -23
  42. package/lib/abstract/cinerino/service/person.js +0 -155
@@ -0,0 +1,300 @@
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 __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __generator = (this && this.__generator) || function (thisArg, body) {
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f) throw new TypeError("Generator is already executing.");
43
+ while (_) try {
44
+ 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;
45
+ if (y = 0, t) op = [op[0] & 2, t.value];
46
+ switch (op[0]) {
47
+ case 0: case 1: t = op; break;
48
+ case 4: _.label++; return { value: op[1], done: false };
49
+ case 5: _.label++; y = op[1]; op = [0]; continue;
50
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
+ default:
52
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
+ if (t[2]) _.ops.pop();
57
+ _.trys.pop(); continue;
58
+ }
59
+ op = body.call(thisArg, _);
60
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
+ }
63
+ };
64
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
65
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
66
+ to[j] = from[i];
67
+ return to;
68
+ };
69
+ Object.defineProperty(exports, "__esModule", { value: true });
70
+ exports.OrderService = void 0;
71
+ var index_1 = require("../../index");
72
+ var service_1 = require("../../service");
73
+ // export const DEFAULT_PROJECTION: { [key: string]: 0 } = {
74
+ // // _id: 0, // IDを使用(2023-02-14~)
75
+ // acceptedOffers: 0,
76
+ // discounts: 0,
77
+ // identifier: 0,
78
+ // isGift: 0,
79
+ // 'paymentMethods.issuedThrough.serviceOutput': 0,
80
+ // returner: 0,
81
+ // // 'seller.telephone': 0, // ドキュメントからunset済なので不要(2024-03-14~)
82
+ // // 'seller.url': 0, // ドキュメントからunset済なので不要(2024-03-14~)
83
+ // url: 0,
84
+ // additionalProperty: 0,
85
+ // };
86
+ /**
87
+ * 注文サービス
88
+ */
89
+ var OrderService = /** @class */ (function (_super) {
90
+ __extends(OrderService, _super);
91
+ function OrderService() {
92
+ return _super !== null && _super.apply(this, arguments) || this;
93
+ }
94
+ // constructor(options: IAdditionalOptions & Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>) {
95
+ // super({ ...options, retryableStatusCodes: [BAD_GATEWAY, FORBIDDEN, UNAUTHORIZED] });
96
+ // }
97
+ /**
98
+ * 注文作成
99
+ * 確定した注文取引に対して、同期的に注文データを作成
100
+ * すでに注文が作成済の場合、何もしない
101
+ */
102
+ OrderService.prototype.placeOrder = function (params) {
103
+ return __awaiter(this, void 0, void 0, function () {
104
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, object, confirmationNumber, orderNumber, orderService;
105
+ return __generator(this, function (_b) {
106
+ switch (_b.label) {
107
+ case 0:
108
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
109
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
110
+ case 1:
111
+ chevreAsset = _b.sent();
112
+ object = params.object;
113
+ confirmationNumber = object.confirmationNumber, orderNumber = object.orderNumber;
114
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
115
+ project: project,
116
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
117
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
118
+ })];
119
+ case 2:
120
+ orderService = _b.sent();
121
+ return [4 /*yield*/, orderService.createIfNotExist({ confirmationNumber: confirmationNumber, orderNumber: orderNumber })];
122
+ case 3:
123
+ _b.sent();
124
+ return [2 /*return*/];
125
+ }
126
+ });
127
+ });
128
+ };
129
+ /**
130
+ * 確認番号で検索
131
+ * 確認番号と購入者情報で注文を検索します
132
+ */
133
+ OrderService.prototype.findByConfirmationNumber = function (params) {
134
+ return __awaiter(this, void 0, void 0, function () {
135
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, confirmationNumber, customer, orderDateFrom, orderDateThrough, orderNumber, orderService;
136
+ return __generator(this, function (_b) {
137
+ switch (_b.label) {
138
+ case 0:
139
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
140
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
141
+ case 1:
142
+ chevreAsset = _b.sent();
143
+ confirmationNumber = params.confirmationNumber, customer = params.customer, orderDateFrom = params.orderDateFrom, orderDateThrough = params.orderDateThrough, orderNumber = params.orderNumber;
144
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
145
+ project: project,
146
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
147
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
148
+ })];
149
+ case 2:
150
+ orderService = _b.sent();
151
+ return [2 /*return*/, orderService.findByConfirmationNumber(__assign(__assign(__assign(__assign({ confirmationNumber: confirmationNumber }, (customer !== undefined) ? { customer: customer } : undefined), (orderDateFrom !== undefined) ? { orderDateFrom: orderDateFrom } : undefined), (orderDateThrough !== undefined) ? { orderDateThrough: orderDateThrough } : undefined), (typeof orderNumber === 'string') ? { orderNumber: orderNumber } : undefined))];
152
+ }
153
+ });
154
+ });
155
+ };
156
+ /**
157
+ * イベントIDと確認番号で検索
158
+ */
159
+ OrderService.prototype.findByEventAndConfirmationNumber = function (params) {
160
+ return __awaiter(this, void 0, void 0, function () {
161
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, confirmationNumber, customer, event, orderService;
162
+ return __generator(this, function (_b) {
163
+ switch (_b.label) {
164
+ case 0:
165
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
166
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
167
+ case 1:
168
+ chevreAsset = _b.sent();
169
+ confirmationNumber = params.confirmationNumber, customer = params.customer, event = params.event;
170
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
171
+ project: project,
172
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
173
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
174
+ })];
175
+ case 2:
176
+ orderService = _b.sent();
177
+ return [2 /*return*/, orderService.findByEventAndConfirmationNumber(__assign({ confirmationNumber: confirmationNumber, event: event }, (typeof (customer === null || customer === void 0 ? void 0 : customer.telephone) === 'string') ? { customer: customer } : undefined))];
178
+ }
179
+ });
180
+ });
181
+ };
182
+ /**
183
+ * 予約番号と電話番号で注文情報を取得する(sskts専用)
184
+ */
185
+ OrderService.prototype.findByOrderInquiryKey4sskts = function (params) {
186
+ return __awaiter(this, void 0, void 0, function () {
187
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, confirmationNumber, telephone, theaterCode, orderService;
188
+ return __generator(this, function (_b) {
189
+ switch (_b.label) {
190
+ case 0:
191
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
192
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
193
+ case 1:
194
+ chevreAsset = _b.sent();
195
+ confirmationNumber = params.confirmationNumber, telephone = params.telephone, theaterCode = params.theaterCode;
196
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
197
+ project: project,
198
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
199
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
200
+ })];
201
+ case 2:
202
+ orderService = _b.sent();
203
+ return [2 /*return*/, orderService.findByOrderInquiryKey4sskts({
204
+ confirmationNumber: confirmationNumber, telephone: telephone, theaterCode: theaterCode
205
+ // $projection: DEFAULT_PROJECTION // fixed on server side(2024-07-22~)
206
+ })];
207
+ }
208
+ });
209
+ });
210
+ };
211
+ /**
212
+ * 注文番号と何かしらで注文照会
213
+ */
214
+ OrderService.prototype.findOneByOrderNumberAndSomething = function (params) {
215
+ return __awaiter(this, void 0, void 0, function () {
216
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, customer, orderNumber, orderService;
217
+ return __generator(this, function (_b) {
218
+ switch (_b.label) {
219
+ case 0:
220
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
221
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
222
+ case 1:
223
+ chevreAsset = _b.sent();
224
+ customer = params.customer, orderNumber = params.orderNumber;
225
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
226
+ project: project,
227
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
228
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
229
+ })];
230
+ case 2:
231
+ orderService = _b.sent();
232
+ return [2 /*return*/, orderService.findOneByOrderNumberAndSomething(__assign({ orderNumber: orderNumber }, (typeof (customer === null || customer === void 0 ? void 0 : customer.telephone) === 'string') ? { customer: customer } : undefined))];
233
+ }
234
+ });
235
+ });
236
+ };
237
+ /**
238
+ * 注文承認
239
+ * 注文コードを発行する
240
+ */
241
+ OrderService.prototype.authorize = function (params) {
242
+ return __awaiter(this, void 0, void 0, function () {
243
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, orderNumber, object, result, orderService, code;
244
+ return __generator(this, function (_b) {
245
+ switch (_b.label) {
246
+ case 0:
247
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
248
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
249
+ case 1:
250
+ chevreAsset = _b.sent();
251
+ orderNumber = params.object.orderNumber;
252
+ object = params.object, result = params.result;
253
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
254
+ project: project,
255
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
256
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
257
+ })];
258
+ case 2:
259
+ orderService = _b.sent();
260
+ return [4 /*yield*/, orderService.authorize(__assign({ object: {
261
+ customer: object.customer,
262
+ orderNumber: orderNumber
263
+ } }, ((result === null || result === void 0 ? void 0 : result.expiresInSeconds) !== undefined) ? { result: result } : undefined))];
264
+ case 3:
265
+ code = (_b.sent()).code;
266
+ return [2 /*return*/, { code: code }];
267
+ }
268
+ });
269
+ });
270
+ };
271
+ /**
272
+ * 確認番号で注文オファー検索
273
+ */
274
+ OrderService.prototype.searchAcceptedOffersByConfirmationNumber = function (params) {
275
+ return __awaiter(this, void 0, void 0, function () {
276
+ var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreAsset, orderNumber, limit, page, confirmationNumber, orderService;
277
+ return __generator(this, function (_b) {
278
+ switch (_b.label) {
279
+ case 0:
280
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
281
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
282
+ case 1:
283
+ chevreAsset = _b.sent();
284
+ orderNumber = params.orderNumber;
285
+ limit = params.limit, page = params.page, confirmationNumber = params.confirmationNumber;
286
+ return [4 /*yield*/, chevreAsset.createOrderInstance({
287
+ project: project,
288
+ seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
289
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
290
+ })];
291
+ case 2:
292
+ orderService = _b.sent();
293
+ return [2 /*return*/, orderService.searchAcceptedOffersByConfirmationNumber(__assign(__assign({ confirmationNumber: confirmationNumber, orderNumber: orderNumber }, (typeof limit === 'number') ? { limit: limit } : undefined), (typeof page === 'number') ? { page: page } : undefined))];
294
+ }
295
+ });
296
+ });
297
+ };
298
+ return OrderService;
299
+ }(service_1.Service));
300
+ exports.OrderService = OrderService;
@@ -3,33 +3,18 @@ import { IOptions, ISearchResult, Service } from '../../../service';
3
3
  declare type IPermitWithAccountDetails = Omit<factory.permit.IPermit, 'paymentAccount'> & {
4
4
  paymentAccount?: factory.permit.IPaymentAccountWithDetail;
5
5
  };
6
- declare type IOwnershipInfoWithDetail = Omit<factory.ownershipInfo.IOwnershipInfo<IPermitWithAccountDetails | factory.ownershipInfo.IReservationWithDetail>, 'acquiredFrom' | 'identifier' | 'ownedBy'>;
7
6
  declare type IPaymentCardOwnershipInfoWithDetail = Omit<factory.ownershipInfo.IOwnershipInfo<IPermitWithAccountDetails>, 'acquiredFrom' | 'identifier' | 'ownedBy'>;
8
7
  /**
9
8
  * 会員所有権サービス
10
9
  */
11
10
  export declare class PersonOwnershipInfoService extends Service<IOptions> {
12
- constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>);
13
11
  /**
14
- * マイペイメントカード検索
12
+ * ペイメントカード所有権検索
15
13
  */
16
14
  searchMyPaymentCards(params: {
17
15
  limit?: number;
18
16
  page?: number;
19
17
  sort?: factory.ownershipInfo.ISortOrder;
20
- ownedFrom?: Date;
21
- ownedThrough?: Date;
22
- iss: string;
23
18
  }): Promise<ISearchResult<IPaymentCardOwnershipInfoWithDetail[]>>;
24
- /**
25
- * 所有権検索
26
- */
27
- search(params: Omit<factory.ownershipInfo.ISearchConditions, 'ownedBy' | 'project'> & {
28
- /**
29
- * 未指定の場合`me`がセットされます
30
- */
31
- id?: string;
32
- iss: string;
33
- }): Promise<ISearchResult<IOwnershipInfoWithDetail[]>>;
34
19
  }
35
20
  export {};
@@ -0,0 +1,149 @@
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 __assign = (this && this.__assign) || function () {
18
+ __assign = Object.assign || function(t) {
19
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
20
+ s = arguments[i];
21
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
+ t[p] = s[p];
23
+ }
24
+ return t;
25
+ };
26
+ return __assign.apply(this, arguments);
27
+ };
28
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
+ return new (P || (P = Promise))(function (resolve, reject) {
31
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
32
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
33
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
34
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
35
+ });
36
+ };
37
+ var __generator = (this && this.__generator) || function (thisArg, body) {
38
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
39
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
40
+ function verb(n) { return function (v) { return step([n, v]); }; }
41
+ function step(op) {
42
+ if (f) throw new TypeError("Generator is already executing.");
43
+ while (_) try {
44
+ 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;
45
+ if (y = 0, t) op = [op[0] & 2, t.value];
46
+ switch (op[0]) {
47
+ case 0: case 1: t = op; break;
48
+ case 4: _.label++; return { value: op[1], done: false };
49
+ case 5: _.label++; y = op[1]; op = [0]; continue;
50
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
51
+ default:
52
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
53
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
54
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
55
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
56
+ if (t[2]) _.ops.pop();
57
+ _.trys.pop(); continue;
58
+ }
59
+ op = body.call(thisArg, _);
60
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
61
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
+ }
63
+ };
64
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
65
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
66
+ to[j] = from[i];
67
+ return to;
68
+ };
69
+ Object.defineProperty(exports, "__esModule", { value: true });
70
+ exports.PersonOwnershipInfoService = void 0;
71
+ var factory = require("../../../factory");
72
+ var index_1 = require("../../../index");
73
+ var service_1 = require("../../../service");
74
+ /**
75
+ * 会員所有権サービス
76
+ */
77
+ var PersonOwnershipInfoService = /** @class */ (function (_super) {
78
+ __extends(PersonOwnershipInfoService, _super);
79
+ function PersonOwnershipInfoService() {
80
+ return _super !== null && _super.apply(this, arguments) || this;
81
+ }
82
+ // constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>) {
83
+ // super({ ...options, retryableStatusCodes: [BAD_GATEWAY, FORBIDDEN, UNAUTHORIZED] });
84
+ // }
85
+ /**
86
+ * ペイメントカード所有権検索
87
+ */
88
+ PersonOwnershipInfoService.prototype.searchMyPaymentCards = function (params) {
89
+ var _a, _b, _c;
90
+ return __awaiter(this, void 0, void 0, function () {
91
+ var limit, page, sort, searchConditions, _d, auth, endpoint, project, disableAutoRetry, retryableStatusCodes, chevreAsset, personOwnershipInfoService, data, paymentCardOwnershipInfos;
92
+ return __generator(this, function (_e) {
93
+ switch (_e.label) {
94
+ case 0:
95
+ limit = params.limit, page = params.page, sort = params.sort;
96
+ searchConditions = {
97
+ typeOfGood: {
98
+ issuedThrough: { typeOf: { $eq: factory.product.ProductType.PaymentCard } }
99
+ },
100
+ // 未指定であれば、ownedFromでのソートを保証する
101
+ sort: (sort !== undefined && sort !== null)
102
+ ? sort
103
+ : { ownedFrom: factory.sortType.Descending },
104
+ // tslint:disable-next-line:no-magic-numbers
105
+ limit: (typeof limit === 'number') ? Math.min(limit, 100) : 100,
106
+ page: (typeof page === 'number') ? Math.max(page, 1) : 1
107
+ };
108
+ // ペイメントカードのみ受け付ける
109
+ if (((_c = (_b = (_a = searchConditions.typeOfGood) === null || _a === void 0 ? void 0 : _a.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) === null || _c === void 0 ? void 0 : _c.$eq) !== factory.product.ProductType.PaymentCard) {
110
+ throw new factory.errors.Argument('typeOfGood', "typeOfGood.issuedThrough.typeOf.$eq must be " + factory.product.ProductType.PaymentCard);
111
+ }
112
+ _d = this.options, auth = _d.auth, endpoint = _d.endpoint, project = _d.project, disableAutoRetry = _d.disableAutoRetry, retryableStatusCodes = _d.retryableStatusCodes;
113
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
114
+ case 1:
115
+ chevreAsset = _e.sent();
116
+ return [4 /*yield*/, chevreAsset.createPersonOwnershipInfoInstance({
117
+ project: project,
118
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
119
+ })];
120
+ case 2:
121
+ personOwnershipInfoService = _e.sent();
122
+ return [4 /*yield*/, personOwnershipInfoService.search(searchConditions)];
123
+ case 3:
124
+ data = (_e.sent()).data;
125
+ paymentCardOwnershipInfos = data.map(function (ownershipInfo) {
126
+ var _a, _b;
127
+ var id = ownershipInfo.id, ownedFrom = ownershipInfo.ownedFrom, ownedThrough = ownershipInfo.ownedThrough, typeOf = ownershipInfo.typeOf, typeOfGood = ownershipInfo.typeOfGood;
128
+ if (((_a = typeOfGood.issuedThrough) === null || _a === void 0 ? void 0 : _a.typeOf) !== factory.product.ProductType.PaymentCard) {
129
+ throw new factory.errors.NotImplemented(((_b = typeOfGood.issuedThrough) === null || _b === void 0 ? void 0 : _b.typeOf) + " not implemented");
130
+ }
131
+ var permit = typeOfGood;
132
+ return {
133
+ id: id,
134
+ ownedFrom: ownedFrom,
135
+ ownedThrough: ownedThrough,
136
+ project: ownershipInfo.project,
137
+ typeOf: typeOf,
138
+ // 互換性維持対応としてaccount.statusを補完(2023-02-16~)
139
+ typeOfGood: __assign(__assign({}, permit), { paymentAccount: __assign(__assign({}, permit.paymentAccount), { status: 'Opened' }) })
140
+ };
141
+ });
142
+ return [2 /*return*/, { data: paymentCardOwnershipInfos }];
143
+ }
144
+ });
145
+ });
146
+ };
147
+ return PersonOwnershipInfoService;
148
+ }(service_1.Service));
149
+ exports.PersonOwnershipInfoService = PersonOwnershipInfoService;
@@ -0,0 +1,12 @@
1
+ import * as factory from '../../factory';
2
+ import { IOptions, Service } from '../../service';
3
+ export declare type IPerson = factory.person.IProfile & factory.person.IPerson;
4
+ /**
5
+ * 会員サービス
6
+ */
7
+ export declare class PersonService extends Service<IOptions> {
8
+ /**
9
+ * 会員削除
10
+ */
11
+ deleteById(): Promise<void>;
12
+ }
@@ -14,17 +14,6 @@ var __extends = (this && this.__extends) || (function () {
14
14
  d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
15
  };
16
16
  })();
17
- var __assign = (this && this.__assign) || function () {
18
- __assign = Object.assign || function(t) {
19
- for (var s, i = 1, n = arguments.length; i < n; i++) {
20
- s = arguments[i];
21
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
22
- t[p] = s[p];
23
- }
24
- return t;
25
- };
26
- return __assign.apply(this, arguments);
27
- };
28
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
29
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
30
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -61,43 +50,57 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
61
50
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
62
51
  }
63
52
  };
53
+ var __spreadArray = (this && this.__spreadArray) || function (to, from) {
54
+ for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
55
+ to[j] = from[i];
56
+ return to;
57
+ };
64
58
  Object.defineProperty(exports, "__esModule", { value: true });
65
- exports.DeliveryService = void 0;
66
- var http_status_1 = require("http-status");
59
+ exports.PersonService = void 0;
60
+ var index_1 = require("../../index");
67
61
  var service_1 = require("../../service");
68
62
  /**
69
- * 配送サービス
63
+ * 会員サービス
70
64
  */
71
- var DeliveryService = /** @class */ (function (_super) {
72
- __extends(DeliveryService, _super);
73
- function DeliveryService(options) {
74
- return _super.call(this, __assign(__assign({}, options), { retryableStatusCodes: [http_status_1.BAD_GATEWAY, http_status_1.FORBIDDEN, http_status_1.UNAUTHORIZED] })) || this;
65
+ var PersonService = /** @class */ (function (_super) {
66
+ __extends(PersonService, _super);
67
+ function PersonService() {
68
+ return _super !== null && _super.apply(this, arguments) || this;
75
69
  }
70
+ // constructor(options: Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>) {
71
+ // super({ ...options, retryableStatusCodes: [BAD_GATEWAY, FORBIDDEN, UNAUTHORIZED] });
72
+ // }
76
73
  /**
77
- * 注文を配送する
78
- * 作成された注文データに対して、同期的に注文を配送します(所有権が作成されます)
79
- * すでに配送済の場合、何もしません。
74
+ * 会員削除
80
75
  */
81
- DeliveryService.prototype.sendOrder = function (params) {
76
+ PersonService.prototype.deleteById = function () {
82
77
  return __awaiter(this, void 0, void 0, function () {
83
- var _a, confirmationNumber, orderNumber;
78
+ var _a, auth, endpoint, project, disableAutoRetry, retryableStatusCodes, chevreAsset, personService;
84
79
  return __generator(this, function (_b) {
85
80
  switch (_b.label) {
86
81
  case 0:
87
- _a = params.object, confirmationNumber = _a.confirmationNumber, orderNumber = _a.orderNumber;
88
- return [4 /*yield*/, this.fetch({
89
- uri: "/orders/" + orderNumber + "/deliver",
90
- method: 'POST',
91
- body: { confirmationNumber: confirmationNumber },
92
- expectedStatusCodes: [http_status_1.NO_CONTENT]
93
- })];
82
+ _a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
83
+ return [4 /*yield*/, index_1.loadChevreAsset({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
94
84
  case 1:
85
+ chevreAsset = _b.sent();
86
+ return [4 /*yield*/, chevreAsset.createPersonInstance({
87
+ project: project,
88
+ retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
89
+ })];
90
+ case 2:
91
+ personService = _b.sent();
92
+ return [4 /*yield*/, personService.deleteById({
93
+ id: 'me',
94
+ physically: false,
95
+ iss: '' // 使用されないので空文字でok
96
+ })];
97
+ case 3:
95
98
  _b.sent();
96
99
  return [2 /*return*/];
97
100
  }
98
101
  });
99
102
  });
100
103
  };
101
- return DeliveryService;
104
+ return PersonService;
102
105
  }(service_1.Service));
103
- exports.DeliveryService = DeliveryService;
106
+ exports.PersonService = PersonService;
@@ -1,11 +1,10 @@
1
1
  import { IFindByCodeResult } from '../../chevreAsset/reservation/factory';
2
2
  import * as factory from '../../factory';
3
- import { IAdditionalOptions, IOptions, Service } from '../../service';
3
+ import { Service } from '../../service';
4
4
  /**
5
5
  * 予約サービス
6
6
  */
7
7
  export declare class ReservationService extends Service {
8
- constructor(options: IAdditionalOptions & Pick<IOptions, 'auth' | 'endpoint' | 'transporter' | 'project' | 'defaultPath'>);
9
8
  /**
10
9
  * コードによる予約照会
11
10
  */