@cinerino/sdk 7.1.0 → 7.2.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.
@@ -148,6 +148,7 @@ async function main() {
148
148
  const creditCardPaymentAuth = await authorizeCreditCardAsyncForcibly({
149
149
  object: {
150
150
  amount,
151
+ // amount: 1, // 間違えてみる
151
152
  paymentMethod: paymentMethodType,
152
153
  paymentMethodId, // URL発行時のpaymentMethodIdを指定
153
154
  method: '1',
@@ -268,16 +269,16 @@ async function authorizeSeatReservationByEvent(params: {
268
269
  });
269
270
 
270
271
  const selectedTicketOffer = ticketOffers.shift();
271
- console.log('ticket offer selected', selectedTicketOffer);
272
+ if (selectedTicketOffer === undefined) {
273
+ throw new Error('selectedTicketOffer undefined');
274
+ }
275
+ console.log('ticket offer selected', selectedTicketOffer.id, selectedTicketOffer.identifier, selectedTicketOffer.name.ja);
272
276
 
273
277
  // 座席をランダムに選択
274
278
  const selectedScreeningRoomSection = String(availableSeatOffers[0].containedInPlace?.branchCode);
275
279
  console.log('screening room section selected', selectedScreeningRoomSection);
276
280
  console.log(selectedScreeningRoomSection);
277
281
  const selectedSeatOffers = availableSeatOffers.slice(0, 1);
278
- if (selectedTicketOffer === undefined) {
279
- throw new Error('selectedTicketOffer undefined');
280
- }
281
282
  console.log(selectedSeatOffers.length, 'seats selected');
282
283
 
283
284
  await wait(3000);
@@ -137,6 +137,7 @@ async function main() {
137
137
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
138
138
  })({ paymentService });
139
139
  console.log('credit card payment authorized', creditCardPaymentAuth.id);
140
+ // throw new Error('force error');
140
141
 
141
142
  // 購入情報確認時間
142
143
  // tslint:disable-next-line:no-magic-numbers
@@ -201,7 +202,6 @@ async function authorizeSeatReservationByEvent(params: {
201
202
  seller: { id: '' }
202
203
  });
203
204
 
204
- const screeningEvent = params.event;
205
205
  const transaction = params.transaction;
206
206
 
207
207
  await wait(3000);
@@ -209,7 +209,8 @@ async function authorizeSeatReservationByEvent(params: {
209
209
  const seatReservationAuth = await placeOrderService.createSeatReservationAuthorization({
210
210
  object: {
211
211
  event: {
212
- id: screeningEvent.id
212
+ id: params.event.id
213
+ // id: '120162210202406131200920'
213
214
  },
214
215
  acceptedOffer: [
215
216
  {
@@ -234,6 +235,7 @@ async function authorizeSeatReservationByEvent(params: {
234
235
  purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
235
236
  });
236
237
  console.log('seat reservation authorized', seatReservationAuth.result.responseBody.tmpReserveNum, seatReservationAuth);
238
+ // throw new Error('force error');
237
239
 
238
240
  const amount = seatReservationAuth.result.price;
239
241
  console.log('amount:', amount);
@@ -0,0 +1,21 @@
1
+ import * as factory from '../../factory';
2
+ declare type IAuthorizeCOAEventServiceActionResult = factory.action.authorize.offer.eventService.IResult<factory.service.webAPI.Identifier.COA>;
3
+ declare type ICOAResponseBody = factory.action.authorize.offer.eventService.IResponseBody<factory.service.webAPI.Identifier.COA>;
4
+ declare type IOptimizedAuthorizeCOAEventServiceActionResult = Pick<IAuthorizeCOAEventServiceActionResult, 'price'> & {
5
+ /**
6
+ * COA仮予約レスポンス
7
+ * tmpReserveNum: 仮予約番号
8
+ */
9
+ responseBody: Pick<ICOAResponseBody, 'tmpReserveNum'>;
10
+ };
11
+ /**
12
+ * COA興行オファー承認レスポンス
13
+ */
14
+ export interface IAuthorizeCOAEventServiceResult {
15
+ /**
16
+ * 承認アクションID
17
+ */
18
+ id: string;
19
+ result: IOptimizedAuthorizeCOAEventServiceActionResult;
20
+ }
21
+ export {};
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
- import { IAuthorizeCOAEventServiceResult } from '../chevreTxn/transaction/placeOrder/factory';
3
+ import { IAuthorizeCOAEventServiceResult } from './offer/factory';
4
4
  interface IAppliesToSurfrock {
5
5
  identifier: string;
6
6
  serviceOutput: {
@@ -1,54 +1,10 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
- import { IAuthorizeCOAEventServiceResult, IAuthorizeEventServiceResult, IAuthorizeProductOfferResult, IMinimalAuthorizeEventServiceResult } from './transaction/placeOrder/factory';
3
+ import { IAuthorizeEventServiceResult, IAuthorizeProductOfferResult, IMinimalAuthorizeEventServiceResult } from './transaction/placeOrder/factory';
4
4
  export interface IPurpose {
5
5
  typeOf: factory.transactionType;
6
6
  id: string;
7
7
  }
8
- export declare enum FlgMember {
9
- /**
10
- * 非会員
11
- */
12
- NonMember = "0",
13
- /**
14
- * 会員
15
- */
16
- Member = "1"
17
- }
18
- export interface ICOAPointOffer {
19
- /**
20
- * オファーID
21
- */
22
- id: string;
23
- /**
24
- * オファーコード
25
- */
26
- identifier: string;
27
- /**
28
- * チケットコード
29
- */
30
- ticketCode: string;
31
- /**
32
- * チケット名
33
- */
34
- ticketName: string;
35
- /**
36
- * チケット名(カナ)
37
- */
38
- ticketNameKana: string;
39
- /**
40
- * チケット名(英)
41
- */
42
- ticketNameEng: string;
43
- /**
44
- * ポイント購入の場合の消費ポイント
45
- */
46
- usePoint: number;
47
- /**
48
- * 会員用フラグ
49
- */
50
- flgMember?: FlgMember;
51
- }
52
8
  /**
53
9
  * オファーサービス
54
10
  */
@@ -88,73 +44,4 @@ export declare class OfferService extends Service {
88
44
  };
89
45
  purpose: IPurpose;
90
46
  }): Promise<void>;
91
- /**
92
- * 興行オファー承認
93
- */
94
- authorizeEventServiceByCOA(params: {
95
- object: {
96
- acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOfferBeforeAuthorize4COA[];
97
- event: {
98
- id: string;
99
- };
100
- };
101
- /**
102
- * token
103
- */
104
- purpose: string;
105
- purposeRaw: string;
106
- result: {
107
- requestBody: factory.action.authorize.offer.eventService.IRequestBody<factory.service.webAPI.Identifier.COA>;
108
- responseBody: factory.action.authorize.offer.eventService.IResponseBody<factory.service.webAPI.Identifier.COA>;
109
- };
110
- }): Promise<IAuthorizeCOAEventServiceResult>;
111
- /**
112
- * 興行オファー承認取消
113
- */
114
- voidAuthorizationByCOA(params: {
115
- /**
116
- * 承認アクションID
117
- */
118
- id: string;
119
- /**
120
- * token
121
- */
122
- purpose: string;
123
- purposeRaw: string;
124
- }): Promise<{
125
- theaterCode?: string;
126
- dateJouei?: string;
127
- titleCode?: string;
128
- titleBranchNum?: string;
129
- timeBegin?: string;
130
- tmpReserveNum?: string;
131
- }>;
132
- /**
133
- * 興行オファー承認変更
134
- */
135
- updateEventServiceByCOA(params: {
136
- /**
137
- * 承認アクションID
138
- */
139
- id: string;
140
- object: {
141
- acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOfferBeforeAuthorize4COA[];
142
- event: {
143
- id: string;
144
- };
145
- };
146
- /**
147
- * token
148
- */
149
- purpose: string;
150
- purposeRaw: string;
151
- }): Promise<IAuthorizeCOAEventServiceResult>;
152
- findCOAInfo(params: {
153
- object: {
154
- id: string;
155
- };
156
- purpose: {
157
- id: string;
158
- };
159
- }): Promise<Pick<factory.event.screeningEvent.ICOAInfo, 'dateJouei' | 'screenCode' | 'theaterCode' | 'timeBegin' | 'timeEnd' | 'titleBranchNum' | 'titleCode'>>;
160
47
  }
@@ -73,21 +73,10 @@ var __rest = (this && this.__rest) || function (s, e) {
73
73
  return t;
74
74
  };
75
75
  Object.defineProperty(exports, "__esModule", { value: true });
76
- exports.OfferService = exports.FlgMember = void 0;
76
+ exports.OfferService = void 0;
77
77
  var http_status_1 = require("http-status");
78
78
  var factory = require("../factory");
79
79
  var service_1 = require("../service");
80
- var FlgMember;
81
- (function (FlgMember) {
82
- /**
83
- * 非会員
84
- */
85
- FlgMember["NonMember"] = "0";
86
- /**
87
- * 会員
88
- */
89
- FlgMember["Member"] = "1";
90
- })(FlgMember = exports.FlgMember || (exports.FlgMember = {}));
91
80
  /**
92
81
  * オファーサービス
93
82
  */
@@ -164,95 +153,6 @@ var OfferService = /** @class */ (function (_super) {
164
153
  });
165
154
  });
166
155
  };
167
- /**
168
- * 興行オファー承認
169
- */
170
- OfferService.prototype.authorizeEventServiceByCOA = function (params) {
171
- return __awaiter(this, void 0, void 0, function () {
172
- var _this = this;
173
- return __generator(this, function (_a) {
174
- return [2 /*return*/, this.fetch({
175
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/authorize",
176
- method: 'POST',
177
- expectedStatusCodes: [http_status_1.CREATED],
178
- body: params,
179
- qs: {
180
- purpose: { id: params.purposeRaw } // 追加(2024-04-01~)
181
- }
182
- })
183
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
184
- return [2 /*return*/, response.json()];
185
- }); }); })];
186
- });
187
- });
188
- };
189
- /**
190
- * 興行オファー承認取消
191
- */
192
- OfferService.prototype.voidAuthorizationByCOA = function (params) {
193
- return __awaiter(this, void 0, void 0, function () {
194
- var id, body;
195
- var _this = this;
196
- return __generator(this, function (_a) {
197
- id = params.id, body = __rest(params, ["id"]);
198
- return [2 /*return*/, this.fetch({
199
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/authorize/" + id + "/void",
200
- method: 'PUT',
201
- expectedStatusCodes: [http_status_1.OK],
202
- body: body,
203
- qs: {
204
- purpose: { id: params.purposeRaw } // 追加(2024-04-01~)
205
- }
206
- })
207
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
208
- return [2 /*return*/, response.json()];
209
- }); }); })];
210
- });
211
- });
212
- };
213
- /**
214
- * 興行オファー承認変更
215
- */
216
- OfferService.prototype.updateEventServiceByCOA = function (params) {
217
- return __awaiter(this, void 0, void 0, function () {
218
- var id, body;
219
- var _this = this;
220
- return __generator(this, function (_a) {
221
- id = params.id, body = __rest(params, ["id"]);
222
- return [2 /*return*/, this.fetch({
223
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/authorize/" + id,
224
- method: 'PATCH',
225
- expectedStatusCodes: [http_status_1.OK],
226
- body: body,
227
- qs: {
228
- purpose: { id: params.purposeRaw } // 追加(2024-04-01~)
229
- }
230
- })
231
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
232
- return [2 /*return*/, response.json()];
233
- }); }); })];
234
- });
235
- });
236
- };
237
- OfferService.prototype.findCOAInfo = function (params) {
238
- return __awaiter(this, void 0, void 0, function () {
239
- var _this = this;
240
- return __generator(this, function (_a) {
241
- return [2 /*return*/, this.fetch({
242
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/events/" + String(params.object.id) + "/coaInfo",
243
- method: 'GET',
244
- expectedStatusCodes: [http_status_1.OK],
245
- body: params,
246
- qs: {
247
- purpose: { id: params.purpose.id }
248
- }
249
- })
250
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
251
- return [2 /*return*/, response.json()];
252
- }); }); })];
253
- });
254
- });
255
- };
256
156
  return OfferService;
257
157
  }(service_1.Service));
258
158
  exports.OfferService = OfferService;
@@ -37,25 +37,6 @@ export interface IStartParams {
37
37
  };
38
38
  }
39
39
  export declare type IStartPlaceOrderResult = Pick<factory.transaction.ITransaction<factory.transactionType.PlaceOrder>, 'expires' | 'startDate' | 'id'>;
40
- declare type IAuthorizeCOAEventServiceActionResult = factory.action.authorize.offer.eventService.IResult<factory.service.webAPI.Identifier.COA>;
41
- declare type ICOAResponseBody = factory.action.authorize.offer.eventService.IResponseBody<factory.service.webAPI.Identifier.COA>;
42
- declare type IOptimizedAuthorizeCOAEventServiceActionResult = Pick<IAuthorizeCOAEventServiceActionResult, 'price'> & {
43
- /**
44
- * COA仮予約レスポンス
45
- * tmpReserveNum: 仮予約番号
46
- */
47
- responseBody: Pick<ICOAResponseBody, 'tmpReserveNum'>;
48
- };
49
- /**
50
- * COA興行オファー承認レスポンス
51
- */
52
- export interface IAuthorizeCOAEventServiceResult {
53
- /**
54
- * 承認アクションID
55
- */
56
- id: string;
57
- result: IOptimizedAuthorizeCOAEventServiceActionResult;
58
- }
59
40
  declare type IAuthorizeEventServiceAction = factory.action.authorize.offer.eventService.IAction<factory.service.webAPI.Identifier.Chevre>;
60
41
  export declare type IAuthorizeEventServiceResult = Pick<IAuthorizeEventServiceAction, 'id'> & {
61
42
  result?: {
@@ -1,4 +1,4 @@
1
- import { IAuthorizeCOAEventServiceResult } from '../../../chevreTxn/transaction/placeOrder/factory';
1
+ import { IAuthorizeCOAEventServiceResult } from '../../../chevreTxc/offer/factory';
2
2
  import * as factory from '../../../factory';
3
3
  import { IAdditionalOptions, IOptions } from '../../../service';
4
4
  import { PlaceOrderTransactionService } from './placeOrder';
package/lib/bundle.js CHANGED
@@ -14605,21 +14605,10 @@ var __rest = (this && this.__rest) || function (s, e) {
14605
14605
  return t;
14606
14606
  };
14607
14607
  Object.defineProperty(exports, "__esModule", { value: true });
14608
- exports.OfferService = exports.FlgMember = void 0;
14608
+ exports.OfferService = void 0;
14609
14609
  var http_status_1 = require("http-status");
14610
14610
  var factory = require("../factory");
14611
14611
  var service_1 = require("../service");
14612
- var FlgMember;
14613
- (function (FlgMember) {
14614
- /**
14615
- * 非会員
14616
- */
14617
- FlgMember["NonMember"] = "0";
14618
- /**
14619
- * 会員
14620
- */
14621
- FlgMember["Member"] = "1";
14622
- })(FlgMember = exports.FlgMember || (exports.FlgMember = {}));
14623
14612
  /**
14624
14613
  * オファーサービス
14625
14614
  */
@@ -14696,95 +14685,6 @@ var OfferService = /** @class */ (function (_super) {
14696
14685
  });
14697
14686
  });
14698
14687
  };
14699
- /**
14700
- * 興行オファー承認
14701
- */
14702
- OfferService.prototype.authorizeEventServiceByCOA = function (params) {
14703
- return __awaiter(this, void 0, void 0, function () {
14704
- var _this = this;
14705
- return __generator(this, function (_a) {
14706
- return [2 /*return*/, this.fetch({
14707
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/authorize",
14708
- method: 'POST',
14709
- expectedStatusCodes: [http_status_1.CREATED],
14710
- body: params,
14711
- qs: {
14712
- purpose: { id: params.purposeRaw } // 追加(2024-04-01~)
14713
- }
14714
- })
14715
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
14716
- return [2 /*return*/, response.json()];
14717
- }); }); })];
14718
- });
14719
- });
14720
- };
14721
- /**
14722
- * 興行オファー承認取消
14723
- */
14724
- OfferService.prototype.voidAuthorizationByCOA = function (params) {
14725
- return __awaiter(this, void 0, void 0, function () {
14726
- var id, body;
14727
- var _this = this;
14728
- return __generator(this, function (_a) {
14729
- id = params.id, body = __rest(params, ["id"]);
14730
- return [2 /*return*/, this.fetch({
14731
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/authorize/" + id + "/void",
14732
- method: 'PUT',
14733
- expectedStatusCodes: [http_status_1.OK],
14734
- body: body,
14735
- qs: {
14736
- purpose: { id: params.purposeRaw } // 追加(2024-04-01~)
14737
- }
14738
- })
14739
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
14740
- return [2 /*return*/, response.json()];
14741
- }); }); })];
14742
- });
14743
- });
14744
- };
14745
- /**
14746
- * 興行オファー承認変更
14747
- */
14748
- OfferService.prototype.updateEventServiceByCOA = function (params) {
14749
- return __awaiter(this, void 0, void 0, function () {
14750
- var id, body;
14751
- var _this = this;
14752
- return __generator(this, function (_a) {
14753
- id = params.id, body = __rest(params, ["id"]);
14754
- return [2 /*return*/, this.fetch({
14755
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/authorize/" + id,
14756
- method: 'PATCH',
14757
- expectedStatusCodes: [http_status_1.OK],
14758
- body: body,
14759
- qs: {
14760
- purpose: { id: params.purposeRaw } // 追加(2024-04-01~)
14761
- }
14762
- })
14763
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
14764
- return [2 /*return*/, response.json()];
14765
- }); }); })];
14766
- });
14767
- });
14768
- };
14769
- OfferService.prototype.findCOAInfo = function (params) {
14770
- return __awaiter(this, void 0, void 0, function () {
14771
- var _this = this;
14772
- return __generator(this, function (_a) {
14773
- return [2 /*return*/, this.fetch({
14774
- uri: "/offers/" + factory.product.ProductType.EventService + "ByCOA/events/" + String(params.object.id) + "/coaInfo",
14775
- method: 'GET',
14776
- expectedStatusCodes: [http_status_1.OK],
14777
- body: params,
14778
- qs: {
14779
- purpose: { id: params.purpose.id }
14780
- }
14781
- })
14782
- .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
14783
- return [2 /*return*/, response.json()];
14784
- }); }); })];
14785
- });
14786
- });
14787
- };
14788
14688
  return OfferService;
14789
14689
  }(service_1.Service));
14790
14690
  exports.OfferService = OfferService;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "7.1.0",
3
+ "version": "7.2.0",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -1,36 +0,0 @@
1
- // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
- import * as client from '../../../../lib/index';
3
- import * as auth from '../../auth/authAsAdmin';
4
-
5
- const project = { id: String(process.env.PROJECT_ID) };
6
-
7
- export type IAuthorizeReservationAction
8
- = client.factory.action.authorize.offer.eventService.IAction<client.factory.service.webAPI.Identifier.Chevre>;
9
-
10
- // tslint:disable-next-line:max-func-body-length
11
- async function main() {
12
- const authClient = await auth.login();
13
- await authClient.refreshAccessToken();
14
- const loginTicket = authClient.verifyIdToken({});
15
- console.log('username is', loginTicket.getUsername());
16
-
17
- const offerService = await (await client.loadChevreTxn({
18
- endpoint: `${<string>process.env.CHEVRE_ENDPOINT}/txn`,
19
- auth: authClient
20
- })).createOfferInstance({
21
- project,
22
- seller: { id: '' }
23
- });
24
-
25
- const coaInfo = await offerService.findCOAInfo({
26
- object: { id: '120162210202404291202250' },
27
- purpose: { id: 'xxx' }
28
- });
29
- console.log('coaInfo:', coaInfo);
30
- }
31
-
32
- main()
33
- .then(() => {
34
- console.log('success!');
35
- })
36
- .catch(console.error);