@cinerino/sdk 12.10.0 → 12.11.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54,7 +54,10 @@ async function main() {
54
54
  identifier: APPLICATION_IDENTIFIER
55
55
  },
56
56
  validFrom,
57
- validThrough
57
+ validThrough,
58
+ offeredBy: {
59
+ identifier: 'xxx' // 外部組織定義のイベントオファーの場合、組織コードを指定する
60
+ }
58
61
  }
59
62
  ],
60
63
  {
@@ -72,7 +75,10 @@ async function main() {
72
75
  identifier: APPLICATION_IDENTIFIER
73
76
  },
74
77
  validFrom,
75
- validThrough
78
+ validThrough,
79
+ offeredBy: {
80
+ identifier: 'xxx' // 外部組織定義のイベントオファーの場合、組織コードを指定する
81
+ }
76
82
  }
77
83
  ],
78
84
  {
@@ -4,7 +4,16 @@ import * as client from '../../../../lib/index';
4
4
  import { auth } from '../../auth/clientCredentials';
5
5
 
6
6
  const project = { id: String(process.env.PROJECT_ID) };
7
- const { EVENT_ID } = process.env;
7
+ const {
8
+ /**
9
+ * 予約対象のイベントID
10
+ */
11
+ EVENT_ID,
12
+ /**
13
+ * 外部組織の発行したイベントオファートークン
14
+ */
15
+ SAMPLE_EVENT_OFFER_TOKEN
16
+ } = process.env;
8
17
  const APPLICATION_IDENTIFIER = 'SmartTheaterTXN';
9
18
 
10
19
  type ISellerMakesOffer = Omit<client.factory.event.screeningEvent.ISellerMakesOffer, 'availableAtOrFrom'> & {
@@ -241,12 +250,29 @@ async function authorizeSeatReservationByEvent(params: {
241
250
  }
242
251
  console.log('有効なイベントオファーが見つかりました', validEventOffer.id, validEventOffer.identifier);
243
252
 
253
+ /**
254
+ * 外部組織発行のイベントオファートークンが必要かどうか
255
+ */
256
+ const eventOfferTokenRequired = typeof validEventOffer.offeredBy?.identifier === 'string';
257
+ if (eventOfferTokenRequired) {
258
+ if (typeof SAMPLE_EVENT_OFFER_TOKEN !== 'string' || SAMPLE_EVENT_OFFER_TOKEN === '') {
259
+ throw new Error('イベントオファートークンが必要です');
260
+ }
261
+ }
262
+
244
263
  await wait(3000);
245
264
  // 拡張オファー使用の場合、オファーコードを指定してオファーチケットを発行
246
265
  const issueEventServiceOfferTicketResult = await offerService.issueEventServiceOfferTicket({
247
266
  audience: { id: transaction.id },
248
267
  eventId: screeningEvent.id,
249
- eventOfferId: validEventOffer.id // 拡張オファー使用の場合、イベントオファーIDを指定する
268
+ eventOfferId: validEventOffer.id, // 拡張オファー使用の場合、イベントオファーIDを指定する
269
+ ...(eventOfferTokenRequired)
270
+ ? {
271
+ ticketedOffer: {
272
+ token: SAMPLE_EVENT_OFFER_TOKEN // イベントオファートークンを指定する場合
273
+ }
274
+ }
275
+ : undefined
250
276
  });
251
277
  console.log('offer ticket issued.', ticketToken);
252
278
  ticketToken = issueEventServiceOfferTicketResult.ticketToken;
@@ -26,6 +26,10 @@ export interface IFindParams {
26
26
  */
27
27
  identifiers?: string[];
28
28
  id?: string;
29
+ /**
30
+ * オファー提供者コード
31
+ */
32
+ offeredByIdentifier?: string;
29
33
  }
30
34
  export declare type IEventOfferAsFindResult = Pick<factory.eventOffer.IEventOffer, 'availableAtOrFrom' | 'id' | 'identifier' | 'itemOffered' | 'offeredBy' | 'typeOf' | 'validFrom' | 'validThrough'>;
31
35
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cinerino/sdk",
3
- "version": "12.10.0",
3
+ "version": "12.11.0-alpha.1",
4
4
  "description": "Cinerino SDK",
5
5
  "main": "./lib/index.js",
6
6
  "browser": {
@@ -93,7 +93,7 @@
93
93
  "watchify": "^3.11.1"
94
94
  },
95
95
  "dependencies": {
96
- "@chevre/factory": "5.3.0-alpha.1",
96
+ "@chevre/factory": "5.3.0",
97
97
  "debug": "3.2.7",
98
98
  "http-status": "1.7.4",
99
99
  "idtoken-verifier": "2.0.3",