@cinerino/sdk 7.0.0-alpha.3 → 7.0.0-alpha.5

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.
@@ -11961,6 +11961,7 @@ var PaymentService = /** @class */ (function (_super) {
11961
11961
  };
11962
11962
  /**
11963
11963
  * 決済ロケーション発行
11964
+ * @deprecated Use publishCreditCardPaymentUrlAsync
11964
11965
  */
11965
11966
  PaymentService.prototype.publishCreditCardPaymentUrl = function (params) {
11966
11967
  return __awaiter(this, void 0, void 0, function () {
@@ -0,0 +1,201 @@
1
+ // tslint:disable:no-console no-implicit-dependencies no-magic-numbers
2
+ import * as moment from 'moment';
3
+ import * as client from '../../../../lib/index';
4
+
5
+ const project = { id: String(process.env.PROJECT_ID) };
6
+
7
+ const profile = {
8
+ email: <string>process.env.TEST_PROFILE_EMAIL,
9
+ givenName: 'Taro',
10
+ familyName: 'SDK',
11
+ name: 'Taro ☆ SDK',
12
+ telephone: '+819012345678'
13
+ };
14
+
15
+ // export type IAuthorizeReservationAction
16
+ // = client.factory.action.authorize.offer.eventService.IAction<client.factory.service.webAPI.Identifier.Chevre>;
17
+
18
+ // tslint:disable-next-line:max-func-body-length
19
+ async function main() {
20
+ const authClient = await client.auth.ClientCredentials.createInstance({
21
+ domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
22
+ clientId: <string>process.env.CHEVRE_CLIENT_ID,
23
+ clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
24
+ scopes: [],
25
+ state: ''
26
+ });
27
+
28
+ const placeOrderService = await (await client.loadChevreTxn({
29
+ endpoint: `${<string>process.env.CHEVRE_ENDPOINT}/txn`,
30
+ auth: authClient
31
+ })).createPlaceOrderTransactionInstance({
32
+ project,
33
+ seller: { id: '' }
34
+ });
35
+ const offerService = await (await client.loadChevreTxncoa({
36
+ endpoint: `${<string>process.env.CHEVRE_ENDPOINT}/txncoa`,
37
+ auth: authClient
38
+ })).createOfferInstance({
39
+ project,
40
+ seller: { id: '' }
41
+ });
42
+
43
+ console.log('starting transaction...');
44
+ const transaction = await placeOrderService.start({
45
+ agent: {},
46
+ seller: {
47
+ id: '5d0abf30ac3fb200198ebb2c'
48
+ },
49
+ object: {
50
+ // passport: { token: passportToken }
51
+ }
52
+ });
53
+ console.log('transaction started', transaction.id);
54
+
55
+ // 購入者情報入力時間
56
+ // tslint:disable-next-line:no-magic-numbers
57
+ await wait(5000);
58
+
59
+ console.log('creating accept task..,');
60
+ const acceptTask = await offerService.acceptOffer({
61
+ object: {
62
+ event: { id: '120162210202405231202250' },
63
+ acceptedOffer: [{
64
+ seatSection: ' ',
65
+ seatNumber: 'b-34',
66
+ ticketInfo: {
67
+ ticketCode: '171',
68
+ mvtkAppPrice: 0,
69
+ ticketCount: 1,
70
+ addGlasses: 0,
71
+ kbnEisyahousiki: '00',
72
+ mvtkNum: '',
73
+ mvtkKbnDenshiken: '00',
74
+ mvtkKbnMaeuriken: '00',
75
+ mvtkKbnKensyu: '00',
76
+ mvtkSalesPrice: 0,
77
+ kbnMgtk: ''
78
+ }
79
+ }],
80
+ appliesToSurfrock: {
81
+ identifier: '',
82
+ serviceOutput: { typeOf: '' }
83
+ }
84
+ },
85
+ purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
86
+ });
87
+ console.log('acceptTask created,', acceptTask);
88
+
89
+ const giveUpPayment = moment()
90
+ .add(10, 'seconds');
91
+ let result: { id: string } | undefined;
92
+ let error: any;
93
+
94
+ // n秒おきに状態確認
95
+ while (result === undefined && error === undefined) {
96
+ // n秒待機
97
+ await new Promise<void>((resolveWait) => {
98
+ setTimeout(
99
+ () => { resolveWait(); },
100
+ 1000
101
+ );
102
+ });
103
+
104
+ // タスク作成から一定時間経過すればあきらめる
105
+ if (moment()
106
+ .isAfter(giveUpPayment)) {
107
+ error = new client.factory.errors.GatewayTimeout('action gaven up');
108
+ break;
109
+ }
110
+
111
+ const acceptAction = await offerService.findAcceptAction({
112
+ sameAs: { id: acceptTask.id },
113
+ purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
114
+ });
115
+ console.log('acceptAction:,', acceptAction);
116
+
117
+ if (typeof acceptAction.id === 'string') {
118
+ if (acceptAction.actionStatus === client.factory.actionStatusType.CompletedActionStatus) {
119
+ // ステータス完了であれば決済承認アクションIDを保管
120
+ result = { id: acceptAction.id };
121
+ break;
122
+ } else {
123
+ // 待機続行
124
+ }
125
+ }
126
+
127
+ // エラーが存在すれば、これ以上待機する価値はなし
128
+ if (acceptAction.error !== undefined) {
129
+ error = acceptAction.error;
130
+ break;
131
+ }
132
+ }
133
+
134
+ if (typeof result?.id === 'string') {
135
+ // no op
136
+ // return result;
137
+ } else {
138
+ throw error;
139
+ }
140
+ console.log('acceptAcion.result:', result);
141
+
142
+ // 購入者情報入力時間
143
+ // tslint:disable-next-line:no-magic-numbers
144
+ await wait(5000);
145
+
146
+ console.log('authorizing by acceptAction...', result.id);
147
+
148
+ const settingProfile: client.factory.person.IProfile = {
149
+ givenName: profile.givenName,
150
+ familyName: profile.familyName,
151
+ telephone: profile.telephone,
152
+ email: profile.email
153
+ };
154
+ console.log('setting customer profile...');
155
+ await placeOrderService.setProfile({ id: transaction.id, agent: settingProfile });
156
+ console.log('customer profile set');
157
+
158
+ // 購入情報確認時間
159
+ // tslint:disable-next-line:no-magic-numbers
160
+ await wait(5000);
161
+
162
+ await placeOrderService.updateObject({
163
+ id: transaction.id,
164
+ object: { name: 'order from samples' }
165
+ });
166
+
167
+ // 取引を中止する場合はコチラ↓
168
+ // console.log('取引を中止します...');
169
+ // await placeOrderService.cancel({ id: transaction.id });
170
+ // console.log('取引を中止しました。');
171
+
172
+ console.log('confirming transaction...');
173
+ await new Promise<void>(async (resolve, reject) => {
174
+ setTimeout(
175
+ () => {
176
+ reject(new Error('confirming process took too long'));
177
+ },
178
+ 5000
179
+ );
180
+ const confirmResult = await placeOrderService.confirm({
181
+ id: transaction.id,
182
+ sendEmailMessage: true,
183
+ expectsMinimalResponse: true
184
+ // expectsReservationIds: true
185
+ });
186
+ const order = confirmResult.order;
187
+ console.log('transaction confirmed', confirmResult);
188
+ console.log('transaction confirmed', order.orderNumber);
189
+ resolve();
190
+ });
191
+ }
192
+
193
+ async function wait(waitInMilliseconds: number) {
194
+ return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
195
+ }
196
+
197
+ main()
198
+ .then(() => {
199
+ console.log('success!');
200
+ })
201
+ .catch(console.error);
@@ -14,6 +14,74 @@ export interface IAuthorizeResult {
14
14
  export interface ICheckMovieTicketResult {
15
15
  purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
16
16
  }
17
+ export interface IMovieTicketYkknInfo {
18
+ /**
19
+ * 購入管理番号
20
+ */
21
+ knyknrNo: string;
22
+ /**
23
+ * 有効券種区分
24
+ */
25
+ ykknshTyp: string;
26
+ /**
27
+ * 映写方式区分
28
+ */
29
+ eishhshkTyp: string;
30
+ /**
31
+ * 有効券種別枚数
32
+ */
33
+ ykknKnshbtsmiNum: string;
34
+ /**
35
+ * 鑑賞券販売単価
36
+ */
37
+ knshknhmbiUnip: string;
38
+ /**
39
+ * 計上単価
40
+ */
41
+ kijUnip: string;
42
+ }
43
+ export interface IMovieTicketMkknInfo {
44
+ /**
45
+ * 購入管理番号
46
+ */
47
+ knyknrNo: string;
48
+ /**
49
+ * 無効券種区分
50
+ */
51
+ mkknshTyp: string;
52
+ /**
53
+ * 無効券種別枚数
54
+ */
55
+ mkknKnshbtsmiNum: string;
56
+ /**
57
+ * 無効事由区分
58
+ */
59
+ mkjyTyp: string;
60
+ /**
61
+ * 予約日時
62
+ */
63
+ yykDt: string;
64
+ /**
65
+ * 使用上映日時
66
+ */
67
+ shyJeiDt: string;
68
+ /**
69
+ * 使用サイトコード
70
+ */
71
+ shyStCd: string;
72
+ /**
73
+ * 使用スクリーンコード
74
+ */
75
+ shyScrnCd: string;
76
+ /**
77
+ * 使用作品コード
78
+ */
79
+ shySkhnCd: string;
80
+ /**
81
+ * 使用作品名
82
+ */
83
+ shySkhnNm: string;
84
+ }
17
85
  export declare type IAuthorizeAnyPaymentObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'name' | 'additionalProperty'>;
18
86
  export declare type IAuthorizeCreditCardObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty'>;
19
87
  export declare type IAuthorizeMovieTicketObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'issuedThrough' | 'paymentMethod' | 'movieTickets' | 'name' | 'additionalProperty'>;
@@ -21,13 +89,10 @@ export declare type IAuthorizePaymentCardObject = Pick<factory.action.authorize.
21
89
  description?: string;
22
90
  };
23
91
  export declare type IPublishPaymentUrlObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'paymentMethod' | 'method'>;
24
- export interface IPublishPaymentUrlResult {
25
- paymentMethodId: string;
26
- paymentUrl: string;
27
- }
92
+ export declare type IPublishPaymentUrlResult = Pick<factory.action.accept.pay.IResult, 'paymentMethodId' | 'paymentUrl'>;
28
93
  export interface IFindAuthorizeActionResult {
29
94
  /**
30
- * アクションID
95
+ * 承認アクションID
31
96
  */
32
97
  id?: string;
33
98
  /**
@@ -1,6 +1,6 @@
1
1
  import * as factory from '../factory';
2
2
  import { Service } from '../service';
3
- import { IAuthorizeAnyPaymentObject, IAuthorizeCreditCardObject, IAuthorizeMovieTicketObject, IAuthorizePaymentCardObject, IAuthorizeResult, ICheckMovieTicketResult, IFindAuthorizeActionResult, IPublishPaymentUrlObject, IPublishPaymentUrlResult, IPurpose } from './payment/factory';
3
+ import { IAuthorizeAnyPaymentObject, IAuthorizeCreditCardObject, IAuthorizeMovieTicketObject, IAuthorizePaymentCardObject, IAuthorizeResult, ICheckMovieTicketResult, IFindAuthorizeActionResult, IMovieTicketMkknInfo, IMovieTicketYkknInfo, IPublishPaymentUrlObject, IPublishPaymentUrlResult, IPurpose } from './payment/factory';
4
4
  /**
5
5
  * 決済サービス
6
6
  */
@@ -58,6 +58,7 @@ export declare class PaymentService extends Service {
58
58
  }): Promise<IAuthorizeResult>;
59
59
  /**
60
60
  * 決済ロケーション発行
61
+ * @deprecated Use publishCreditCardPaymentUrlAsync
61
62
  */
62
63
  publishCreditCardPaymentUrl(params: {
63
64
  object: IPublishPaymentUrlObject;
@@ -124,9 +125,10 @@ export declare class PaymentService extends Service {
124
125
  id: string;
125
126
  };
126
127
  purpose: IPurpose;
128
+ minimize: boolean;
127
129
  }): Promise<{
128
130
  /**
129
- * アクションID
131
+ * 認証アクションID
130
132
  */
131
133
  id?: string;
132
134
  /**
@@ -142,6 +144,36 @@ export declare class PaymentService extends Service {
142
144
  };
143
145
  result?: Pick<ICheckMovieTicketResult, 'purchaseNumberAuthResult'>;
144
146
  }>;
147
+ /**
148
+ * 決済カード認証アクションから有効券を検索する
149
+ */
150
+ searchYkknInfoByCheckMovieTicketAction(params: {
151
+ /**
152
+ * max: 20
153
+ */
154
+ limit: number;
155
+ page: number;
156
+ /**
157
+ * 認証アクションID
158
+ */
159
+ id: string;
160
+ purpose: IPurpose;
161
+ }): Promise<IMovieTicketYkknInfo[]>;
162
+ /**
163
+ * 決済カード認証アクションから無効券を検索する
164
+ */
165
+ searchMkknInfoByCheckMovieTicketAction(params: {
166
+ /**
167
+ * max: 20
168
+ */
169
+ limit: number;
170
+ page: number;
171
+ /**
172
+ * 認証アクションID
173
+ */
174
+ id: string;
175
+ purpose: IPurpose;
176
+ }): Promise<IMovieTicketMkknInfo[]>;
145
177
  /**
146
178
  * 決済採用アクション検索
147
179
  */
@@ -151,10 +183,6 @@ export declare class PaymentService extends Service {
151
183
  };
152
184
  purpose: IPurpose;
153
185
  }): Promise<{
154
- /**
155
- * アクションID
156
- */
157
- id?: string;
158
186
  /**
159
187
  * アクションステータス
160
188
  */
@@ -218,6 +218,7 @@ var PaymentService = /** @class */ (function (_super) {
218
218
  };
219
219
  /**
220
220
  * 決済ロケーション発行
221
+ * @deprecated Use publishCreditCardPaymentUrlAsync
221
222
  */
222
223
  PaymentService.prototype.publishCreditCardPaymentUrl = function (params) {
223
224
  return __awaiter(this, void 0, void 0, function () {
@@ -339,15 +340,60 @@ var PaymentService = /** @class */ (function (_super) {
339
340
  */
340
341
  PaymentService.prototype.findCheckMovieTicketAction = function (params) {
341
342
  return __awaiter(this, void 0, void 0, function () {
342
- var sameAs, purpose;
343
+ var sameAs, purpose, minimize;
343
344
  var _this = this;
344
345
  return __generator(this, function (_a) {
345
- sameAs = params.sameAs, purpose = params.purpose;
346
+ sameAs = params.sameAs, purpose = params.purpose, minimize = params.minimize;
346
347
  return [2 /*return*/, this.fetch({
347
348
  uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check/" + sameAs.id,
348
349
  method: 'GET',
349
350
  expectedStatusCodes: [http_status_1.OK],
350
- qs: { purpose: { id: purpose.id } }
351
+ qs: {
352
+ purpose: { id: purpose.id },
353
+ minimize: minimize === true
354
+ }
355
+ })
356
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
357
+ return [2 /*return*/, response.json()];
358
+ }); }); })];
359
+ });
360
+ });
361
+ };
362
+ /**
363
+ * 決済カード認証アクションから有効券を検索する
364
+ */
365
+ PaymentService.prototype.searchYkknInfoByCheckMovieTicketAction = function (params) {
366
+ return __awaiter(this, void 0, void 0, function () {
367
+ var id, purpose, limit, page;
368
+ var _this = this;
369
+ return __generator(this, function (_a) {
370
+ id = params.id, purpose = params.purpose, limit = params.limit, page = params.page;
371
+ return [2 /*return*/, this.fetch({
372
+ uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check/" + id + "/result/ykknInfo",
373
+ method: 'GET',
374
+ expectedStatusCodes: [http_status_1.OK],
375
+ qs: { purpose: purpose, limit: limit, page: page }
376
+ })
377
+ .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
378
+ return [2 /*return*/, response.json()];
379
+ }); }); })];
380
+ });
381
+ });
382
+ };
383
+ /**
384
+ * 決済カード認証アクションから無効券を検索する
385
+ */
386
+ PaymentService.prototype.searchMkknInfoByCheckMovieTicketAction = function (params) {
387
+ return __awaiter(this, void 0, void 0, function () {
388
+ var id, purpose, limit, page;
389
+ var _this = this;
390
+ return __generator(this, function (_a) {
391
+ id = params.id, purpose = params.purpose, limit = params.limit, page = params.page;
392
+ return [2 /*return*/, this.fetch({
393
+ uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/check/" + id + "/result/mkknInfo",
394
+ method: 'GET',
395
+ expectedStatusCodes: [http_status_1.OK],
396
+ qs: { purpose: purpose, limit: limit, page: page }
351
397
  })
352
398
  .then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
353
399
  return [2 /*return*/, response.json()];
@@ -0,0 +1,162 @@
1
+ import * as factory from '../factory';
2
+ import { Service } from '../service';
3
+ import { IAuthorizeCOAEventServiceResult } from '../chevreTxn/transaction/placeOrder/factory';
4
+ export interface IPurpose {
5
+ typeOf: factory.transactionType;
6
+ id: string;
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
+ interface IAppliesToSurfrock {
53
+ identifier: string;
54
+ serviceOutput: {
55
+ typeOf: string;
56
+ };
57
+ }
58
+ /**
59
+ * オファーサービス
60
+ */
61
+ export declare class OfferService extends Service {
62
+ acceptOffer(params: {
63
+ object: {
64
+ /**
65
+ * イベント
66
+ */
67
+ event: {
68
+ id: string;
69
+ };
70
+ /**
71
+ * オファー
72
+ */
73
+ acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOfferWithoutDetail4COA[];
74
+ /**
75
+ * 会員オファーの場合の適用MovieTicketを指定する
76
+ */
77
+ appliesToSurfrock?: IAppliesToSurfrock;
78
+ };
79
+ purpose: factory.action.authorize.offer.eventService.IPurpose;
80
+ }): Promise<{
81
+ /**
82
+ * task id
83
+ */
84
+ id: string;
85
+ }>;
86
+ findAcceptAction(params: {
87
+ sameAs: {
88
+ id: string;
89
+ };
90
+ purpose: IPurpose;
91
+ }): Promise<{
92
+ /**
93
+ * 採用アクションID
94
+ */
95
+ id?: string;
96
+ /**
97
+ * アクションステータス
98
+ */
99
+ actionStatus: factory.actionStatusType;
100
+ /**
101
+ * エラー
102
+ */
103
+ error?: {
104
+ name?: string;
105
+ message?: string;
106
+ };
107
+ }>;
108
+ /**
109
+ * 興行オファー承認
110
+ */
111
+ authorizeEventServiceByCOA(params: {
112
+ acceptAction: {
113
+ /**
114
+ * 採用アクションID
115
+ */
116
+ id: string;
117
+ };
118
+ purpose: factory.action.authorize.offer.eventService.IPurpose;
119
+ }): Promise<IAuthorizeCOAEventServiceResult>;
120
+ /**
121
+ * 興行オファー承認取消
122
+ */
123
+ voidAuthorizationByCOA(params: {
124
+ /**
125
+ * 承認アクションID
126
+ */
127
+ id: string;
128
+ /**
129
+ * token
130
+ */
131
+ purpose: string;
132
+ purposeRaw: string;
133
+ }): Promise<{
134
+ theaterCode?: string;
135
+ dateJouei?: string;
136
+ titleCode?: string;
137
+ titleBranchNum?: string;
138
+ timeBegin?: string;
139
+ tmpReserveNum?: string;
140
+ }>;
141
+ /**
142
+ * 興行オファー承認変更
143
+ */
144
+ updateEventServiceByCOA(params: {
145
+ /**
146
+ * 承認アクションID
147
+ */
148
+ id: string;
149
+ object: {
150
+ acceptedOffer: factory.action.authorize.offer.eventService.IAcceptedOfferBeforeAuthorize4COA[];
151
+ event: {
152
+ id: string;
153
+ };
154
+ };
155
+ /**
156
+ * token
157
+ */
158
+ purpose: string;
159
+ purposeRaw: string;
160
+ }): Promise<IAuthorizeCOAEventServiceResult>;
161
+ }
162
+ export {};