@cinerino/sdk 3.92.0 → 3.95.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.
@@ -2,11 +2,11 @@
2
2
  /**
3
3
  * 確認番号で注文検索 & コード発行 & 管理者によるコードチェックサンプル
4
4
  */
5
- import * as decode from 'jwt-decode';
5
+ // import * as decode from 'jwt-decode';
6
6
 
7
7
  import * as client from '../../lib/index';
8
8
  // import * as auth from './auth';
9
- import * as authAsAdmin from './auth/authAsAdmin';
9
+ // import * as authAsAdmin from './auth/authAsAdmin';
10
10
 
11
11
  const project = { id: 'cinerino' };
12
12
 
@@ -40,7 +40,7 @@ async function main() {
40
40
  });
41
41
  console.log(orders.length, 'orders found');
42
42
 
43
- let order = orders[0];
43
+ const order = orders[0];
44
44
  const { code } = await orderService.authorize({
45
45
  object: {
46
46
  orderNumber: order.orderNumber,
@@ -55,49 +55,49 @@ async function main() {
55
55
  console.log('QR code published.', code);
56
56
  // ここまでエンドユーザー
57
57
 
58
- const orderItem = order.acceptedOffers?.shift()?.itemOffered;
59
- // 注文アイテムが予約の場合
60
- if (orderItem?.typeOf === client.factory.reservationType.EventReservation) {
61
- const reservationId = orderItem.id;
58
+ // const orderItem = order.acceptedOffers?.shift()?.itemOffered;
59
+ // // 注文アイテムが予約の場合
60
+ // if (orderItem?.typeOf === client.factory.reservationType.EventReservation) {
61
+ // const reservationId = orderItem.id;
62
62
 
63
- // ここから管理者ユーザー
64
- const adminAuthClient = await authAsAdmin.login();
63
+ // // ここから管理者ユーザー
64
+ // const adminAuthClient = await authAsAdmin.login();
65
65
 
66
- const tokenService = new client.service.Token({
67
- endpoint: <string>process.env.API_ENDPOINT,
68
- auth: adminAuthClient,
69
- project: project
70
- });
71
- const reservationService = new client.service.Reservation({
72
- endpoint: <string>process.env.API_ENDPOINT,
73
- auth: adminAuthClient,
74
- project: project
75
- });
66
+ // const tokenService = new client.service.Token({
67
+ // endpoint: <string>process.env.API_ENDPOINT,
68
+ // auth: adminAuthClient,
69
+ // project: project
70
+ // });
71
+ // const reservationService = new client.service.Reservation({
72
+ // endpoint: <string>process.env.API_ENDPOINT,
73
+ // auth: adminAuthClient,
74
+ // project: project
75
+ // });
76
76
 
77
- // 受け取ったコードをトークンに変換
78
- console.log('getting token by code...');
79
- const { token } = await tokenService.getToken({ code });
80
- // tslint:disable-next-line:no-magic-numbers
81
- console.log('token created.', token.substr(0, 10), '................', token.substr(-10));
82
- // トークン(jsonwebtoken)をデコード(デコード結果は注文)
83
- const payload = decode<client.factory.order.IOrder>(token);
84
- order = payload;
85
- console.log('token decoded. order is', order.typeOf, order.orderNumber);
77
+ // // 受け取ったコードをトークンに変換
78
+ // console.log('getting token by code...');
79
+ // const { token } = await tokenService.getToken({ code });
80
+ // // tslint:disable-next-line:no-magic-numbers
81
+ // console.log('token created.', token.substr(0, 10), '................', token.substr(-10));
82
+ // // トークン(jsonwebtoken)をデコード(デコード結果は注文)
83
+ // const payload = decode<client.factory.order.IOrder>(token);
84
+ // order = payload;
85
+ // console.log('token decoded. order is', order.typeOf, order.orderNumber);
86
86
 
87
- // 入場
88
- console.log('checking token...');
89
- await reservationService.useByToken({
90
- object: { id: reservationId },
91
- instrument: { token: token }
92
- });
93
- console.log('token is valid');
87
+ // // 入場
88
+ // console.log('checking token...');
89
+ // await reservationService.useByToken({
90
+ // object: { id: reservationId },
91
+ // instrument: { token: token }
92
+ // });
93
+ // console.log('token is valid');
94
94
 
95
- // 入場履歴を検索
96
- console.log('searching actions...');
97
- const searchUseActionsResult = await reservationService.searchUseActions({ object: { id: reservationId } });
98
- console.log(searchUseActionsResult.data.length, 'actions returned');
99
- // ここまで管理者ユーザー
100
- }
95
+ // // 入場履歴を検索
96
+ // console.log('searching actions...');
97
+ // const searchUseActionsResult = await reservationService.searchUseActions({ object: { id: reservationId } });
98
+ // console.log(searchUseActionsResult.data.length, 'actions returned');
99
+ // // ここまで管理者ユーザー
100
+ // }
101
101
  }
102
102
 
103
103
  main()