@cinerino/sdk 12.9.0-alpha.0 → 12.9.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.
- package/example/src/cloud/admin/adminEventOffersByIdentifier.ts +99 -0
- package/example/src/cloud/transaction/processPlaceOrderByCreditCard3DS.ts +85 -20
- package/lib/abstract/chevre/eventOffer.d.ts +1 -1
- package/lib/abstract/chevreAdmin/eventOffer.d.ts +3 -4
- package/lib/abstract/chevreAdmin/eventOffer.js +1 -1
- package/lib/abstract/chevrePay/payment/factory.d.ts +12 -2
- package/lib/abstract/chevrePay/payment.js +6 -6
- package/lib/abstract/cinerino/service/event.d.ts +4 -1
- package/lib/abstract/cloud/admin/eventOffer.d.ts +40 -0
- package/lib/abstract/cloud/admin/eventOffer.js +145 -0
- package/lib/abstract/cloud/admin.d.ts +9 -0
- package/lib/abstract/cloud/admin.js +20 -0
- package/lib/abstract/cloud/search/eventOffer.d.ts +11 -0
- package/lib/abstract/cloud/search/eventOffer.js +89 -0
- package/lib/abstract/cloud/search.d.ts +12 -0
- package/lib/abstract/cloud/search.js +23 -0
- package/lib/bundle.js +698 -417
- package/package.json +2 -2
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import * as moment from 'moment';
|
|
4
|
+
import * as client from '../../../../lib/index';
|
|
5
|
+
import * as auth from '../../auth/authAsAdmin';
|
|
6
|
+
|
|
7
|
+
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
8
|
+
/**
|
|
9
|
+
* イベント提供販売者ID
|
|
10
|
+
*/
|
|
11
|
+
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
12
|
+
/**
|
|
13
|
+
* イベントオファーコード
|
|
14
|
+
*/
|
|
15
|
+
const OFFER_IDENTIFIER = '20251120eventOffer01';
|
|
16
|
+
/**
|
|
17
|
+
* 対象イベントID
|
|
18
|
+
*/
|
|
19
|
+
const itemOfferedId = '691e5b3ba84891e2b630fca9';
|
|
20
|
+
/**
|
|
21
|
+
* 販売アプリケーションコード
|
|
22
|
+
* 全ての取引アプリケーションにコードが割り当てられているので、別途確認
|
|
23
|
+
*/
|
|
24
|
+
const APPLICATION_IDENTIFIER = 'SmartTheaterTXN';
|
|
25
|
+
|
|
26
|
+
// tslint:disable-next-line:max-func-body-length
|
|
27
|
+
async function main() {
|
|
28
|
+
const authClient = await auth.login();
|
|
29
|
+
await authClient.refreshAccessToken();
|
|
30
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
31
|
+
console.log('username is', loginTicket.getUsername());
|
|
32
|
+
|
|
33
|
+
const eventOfferService = await (await client.loadCloudAdmin({
|
|
34
|
+
endpoint: <string>process.env.API_ADMIN_ENDPOINT,
|
|
35
|
+
auth: authClient
|
|
36
|
+
})).createEventOfferInstance({
|
|
37
|
+
project: { id: PROJECT_ID },
|
|
38
|
+
seller: { id: SELLER_ID }
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
// validFrom~validThroughで有効なイベントオファーを作成する
|
|
42
|
+
const now = new Date();
|
|
43
|
+
const validFrom = moment(now)
|
|
44
|
+
.toDate();
|
|
45
|
+
const validThrough = moment(validFrom)
|
|
46
|
+
.add(1, 'minutes')
|
|
47
|
+
.toDate();
|
|
48
|
+
|
|
49
|
+
await eventOfferService.createEventOfferByIdentifier(
|
|
50
|
+
[
|
|
51
|
+
{
|
|
52
|
+
identifier: OFFER_IDENTIFIER, // オファーコードに対してなければ作成(既に存在すれば何もしない)
|
|
53
|
+
availableAtOrFrom: {
|
|
54
|
+
identifier: APPLICATION_IDENTIFIER
|
|
55
|
+
},
|
|
56
|
+
validFrom,
|
|
57
|
+
validThrough
|
|
58
|
+
}
|
|
59
|
+
],
|
|
60
|
+
{
|
|
61
|
+
itemOfferedId
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
console.log('created.');
|
|
65
|
+
|
|
66
|
+
// オファーコードでオファーを編集する
|
|
67
|
+
await eventOfferService.updateEventOfferByIdentifier(
|
|
68
|
+
[
|
|
69
|
+
{
|
|
70
|
+
identifier: OFFER_IDENTIFIER,
|
|
71
|
+
availableAtOrFrom: {
|
|
72
|
+
identifier: APPLICATION_IDENTIFIER
|
|
73
|
+
},
|
|
74
|
+
validFrom,
|
|
75
|
+
validThrough
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
{
|
|
79
|
+
itemOfferedId
|
|
80
|
+
}
|
|
81
|
+
);
|
|
82
|
+
console.log('updated.');
|
|
83
|
+
|
|
84
|
+
// イベントオファーの検索
|
|
85
|
+
const offers = await eventOfferService.findEventOffers({
|
|
86
|
+
limit: 10,
|
|
87
|
+
page: 1,
|
|
88
|
+
itemOfferedId: itemOfferedId
|
|
89
|
+
});
|
|
90
|
+
// tslint:disable-next-line:no-null-keyword
|
|
91
|
+
console.dir(offers, { depth: null });
|
|
92
|
+
console.log(offers.length, 'offers found');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
main()
|
|
96
|
+
.then(() => {
|
|
97
|
+
console.log('success!');
|
|
98
|
+
})
|
|
99
|
+
.catch(console.error);
|
|
@@ -5,7 +5,8 @@ import * as client from '../../../../lib/index';
|
|
|
5
5
|
import { auth } from '../../auth/clientCredentials';
|
|
6
6
|
|
|
7
7
|
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
-
const { EVENT_ID
|
|
8
|
+
const { EVENT_ID } = process.env;
|
|
9
|
+
const APPLICATION_IDENTIFIER = 'SmartTheaterTXN';
|
|
9
10
|
const profile: client.factory.person.IProfile = {
|
|
10
11
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
12
|
givenName: 'Taro ##\n##\r##\n\n\n##\r\r\r##\r\n\r\n\r\n##',
|
|
@@ -28,6 +29,23 @@ const creditCard: client.factory.paymentMethod.paymentCard.creditCard.IUnchecked
|
|
|
28
29
|
holderName: 'AA AA'
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
type ISellerMakesOffer = Omit<client.factory.event.screeningEvent.ISellerMakesOffer, 'availableAtOrFrom'> & {
|
|
33
|
+
availableAtOrFrom?: client.factory.event.screeningEvent.IOfferAvailableAtOrFrom
|
|
34
|
+
| client.factory.event.screeningEvent.IOfferAvailableAtOrFrom[];
|
|
35
|
+
};
|
|
36
|
+
type ISeller = Omit<client.factory.event.screeningEvent.ISeller, 'makesOffer'> & {
|
|
37
|
+
makesOffer: ISellerMakesOffer[];
|
|
38
|
+
};
|
|
39
|
+
type IScreeningEventOffer = Omit<client.factory.event.screeningEvent.IOffer, 'seller'> & {
|
|
40
|
+
seller: ISeller;
|
|
41
|
+
};
|
|
42
|
+
type IScreeningEventExtensibleOffer = Omit<client.factory.event.screeningEvent.IExtensibleEventOffer, 'seller'> & {
|
|
43
|
+
seller: ISeller;
|
|
44
|
+
};
|
|
45
|
+
type IEvent = Omit<client.factory.event.screeningEvent.IEvent, 'offers'> & {
|
|
46
|
+
offers?: IScreeningEventOffer | IScreeningEventExtensibleOffer;
|
|
47
|
+
};
|
|
48
|
+
|
|
31
49
|
// tslint:disable-next-line:max-func-body-length
|
|
32
50
|
async function main() {
|
|
33
51
|
const eventService = new (await client.loadService()).Event({
|
|
@@ -83,7 +101,7 @@ async function main() {
|
|
|
83
101
|
});
|
|
84
102
|
console.log(searchScreeningEventsResult.data.length, 'events found');
|
|
85
103
|
|
|
86
|
-
const availableEvents = searchScreeningEventsResult.data;
|
|
104
|
+
const availableEvents = <IEvent[]>searchScreeningEventsResult.data;
|
|
87
105
|
if (availableEvents.length === 0) {
|
|
88
106
|
throw new Error('No available events');
|
|
89
107
|
}
|
|
@@ -107,18 +125,20 @@ async function main() {
|
|
|
107
125
|
let amount = 0;
|
|
108
126
|
// tslint:disable-next-line:max-line-length
|
|
109
127
|
const authorizeSeatReservationResults: { price: number }[] = [];
|
|
128
|
+
const eventIds: string[] = [];
|
|
110
129
|
|
|
111
130
|
// tslint:disable-next-line:no-increment-decrement
|
|
112
131
|
for (let i = 0; i < numEvents; i++) {
|
|
113
132
|
// イベント決定
|
|
114
133
|
// tslint:disable-next-line:insecure-random
|
|
115
|
-
const screeningEvent = availableEvents[Math.floor(availableEvents.length * Math.random())];
|
|
134
|
+
const screeningEvent: IEvent = availableEvents[Math.floor(availableEvents.length * Math.random())];
|
|
116
135
|
const authorizeSeatReservationResult = await authorizeSeatReservationByEvent({
|
|
117
136
|
event: screeningEvent,
|
|
118
137
|
transaction: transaction
|
|
119
138
|
});
|
|
120
139
|
amount += Number(authorizeSeatReservationResult.price);
|
|
121
140
|
authorizeSeatReservationResults.push(authorizeSeatReservationResult);
|
|
141
|
+
eventIds.push(screeningEvent.id);
|
|
122
142
|
}
|
|
123
143
|
|
|
124
144
|
// 出力メンバーシップ対応の場合チケット発行
|
|
@@ -150,6 +170,7 @@ async function main() {
|
|
|
150
170
|
},
|
|
151
171
|
issuedThrough: { id: paymentServiceId },
|
|
152
172
|
ticketToken
|
|
173
|
+
// eventIdsAsOrderedItem: eventIds
|
|
153
174
|
},
|
|
154
175
|
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
155
176
|
})({ paymentService });
|
|
@@ -202,6 +223,7 @@ async function main() {
|
|
|
202
223
|
ticketToken,
|
|
203
224
|
name: 'samplePaymentMethodName',
|
|
204
225
|
additionalProperty: [{ name: 'samplePropertyName', value: 'samplePropertyValue' }]
|
|
226
|
+
// eventIdsAsOrderedItem: eventIds
|
|
205
227
|
},
|
|
206
228
|
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
207
229
|
})({ paymentService });
|
|
@@ -282,7 +304,7 @@ type IAuthorizeReservationAction = Pick<client.factory.action.authorize.offer.ev
|
|
|
282
304
|
|
|
283
305
|
// tslint:disable-next-line:max-func-body-length
|
|
284
306
|
async function authorizeSeatReservationByEvent(params: {
|
|
285
|
-
event:
|
|
307
|
+
event: IEvent;
|
|
286
308
|
transaction: Pick<client.factory.transaction.placeOrder.ITransaction, 'id'>;
|
|
287
309
|
}): Promise<{
|
|
288
310
|
price: number;
|
|
@@ -302,6 +324,13 @@ async function authorizeSeatReservationByEvent(params: {
|
|
|
302
324
|
seller: { id: '' }
|
|
303
325
|
});
|
|
304
326
|
|
|
327
|
+
const eventOfferService = await (await client.loadCloudSearch({
|
|
328
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
329
|
+
auth: await auth()
|
|
330
|
+
})).createEventOfferInstance({
|
|
331
|
+
project,
|
|
332
|
+
seller: { id: '' }
|
|
333
|
+
});
|
|
305
334
|
const screeningEvent = params.event;
|
|
306
335
|
const transaction = params.transaction;
|
|
307
336
|
|
|
@@ -364,20 +393,50 @@ async function authorizeSeatReservationByEvent(params: {
|
|
|
364
393
|
const selectedSeatOffers = availableSeatOffers.slice(0, 1);
|
|
365
394
|
console.log(selectedSeatOffers.length, 'seats selected');
|
|
366
395
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
//
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
396
|
+
/**
|
|
397
|
+
* 拡張イベントオファー使用の場合のオファーチケットトークン
|
|
398
|
+
*/
|
|
399
|
+
let ticketToken: string | undefined;
|
|
400
|
+
// 拡張イベントオファー使用の場合、イベントオファーチケットを発行する
|
|
401
|
+
if (screeningEvent.offers?.typeOf === client.factory.offerType.AggregateOffer) {
|
|
402
|
+
// イベントに対するイベントオファー検索
|
|
403
|
+
await wait(3000);
|
|
404
|
+
const eventOffers = await eventOfferService.findEventOffers({
|
|
405
|
+
limit: 20,
|
|
406
|
+
page: 1,
|
|
407
|
+
itemOfferedId: screeningEvent.id,
|
|
408
|
+
availableAtOrFromIdentifier: APPLICATION_IDENTIFIER // 指定のアプリケーションで有効なオファー
|
|
409
|
+
});
|
|
410
|
+
console.log(eventOffers.length, 'eventOffers found.', eventOffers);
|
|
411
|
+
|
|
412
|
+
// 有効なイベントオファーは?
|
|
413
|
+
const now = new Date();
|
|
414
|
+
const validEventOffer = eventOffers.find((eventOffer) => {
|
|
415
|
+
return moment(eventOffer.validFrom)
|
|
416
|
+
.isSameOrBefore(now)
|
|
417
|
+
&& moment(eventOffer.validThrough)
|
|
418
|
+
.isSameOrAfter(now);
|
|
419
|
+
});
|
|
420
|
+
if (validEventOffer === undefined) {
|
|
421
|
+
throw new Error('有効なイベントオファーが見つかりません');
|
|
378
422
|
}
|
|
379
|
-
|
|
380
|
-
|
|
423
|
+
console.log('有効なイベントオファーが見つかりました', validEventOffer.id, validEventOffer.identifier);
|
|
424
|
+
|
|
425
|
+
await wait(3000);
|
|
426
|
+
// 拡張オファー使用の場合、オファーコードを指定してオファーチケットを発行
|
|
427
|
+
const issueEventServiceOfferTicketResult = await offerService.issueEventServiceOfferTicket({
|
|
428
|
+
audience: { id: transaction.id },
|
|
429
|
+
eventId: screeningEvent.id,
|
|
430
|
+
eventOfferId: validEventOffer.id // 拡張オファー使用の場合、イベントオファーIDを指定する
|
|
431
|
+
// ticketedOffer: {
|
|
432
|
+
// ...(typeof SAMPLE_EVENT_OFFER_TOKEN === 'string') ? { token: SAMPLE_EVENT_OFFER_TOKEN } : undefined
|
|
433
|
+
// }
|
|
434
|
+
});
|
|
435
|
+
console.log('offer ticket issued.', ticketToken);
|
|
436
|
+
ticketToken = issueEventServiceOfferTicketResult.ticketToken;
|
|
437
|
+
} else {
|
|
438
|
+
// no op
|
|
439
|
+
}
|
|
381
440
|
|
|
382
441
|
await wait(3000);
|
|
383
442
|
console.log('authorizing seat reservation...');
|
|
@@ -410,7 +469,9 @@ async function authorizeSeatReservationByEvent(params: {
|
|
|
410
469
|
},
|
|
411
470
|
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
412
471
|
instrument: [
|
|
413
|
-
|
|
472
|
+
...(typeof ticketToken === 'string')
|
|
473
|
+
? [{ ticketToken, typeOf: <'Ticket'>'Ticket' }]
|
|
474
|
+
: [] // オファーチケットを指定する
|
|
414
475
|
]
|
|
415
476
|
});
|
|
416
477
|
console.log('seat reservation authorized', seatReservationAuth.id);
|
|
@@ -432,7 +493,9 @@ async function wait(waitInMilliseconds: number) {
|
|
|
432
493
|
const USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_GIVE_UP_SECONDS = 10;
|
|
433
494
|
const USE_FORCE_AUTHORIZE_PAYMENT_ASYNC_CHECK_INTERVAL_MS = 1000;
|
|
434
495
|
function publishPaymentUrlAsyncForcibly(params: {
|
|
435
|
-
object: Pick<client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'paymentMethod' | 'method' | 'ticketToken'
|
|
496
|
+
object: Pick<client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'paymentMethod' | 'method' | 'ticketToken'> & {
|
|
497
|
+
eventIdsAsOrderedItem?: string[];
|
|
498
|
+
};
|
|
436
499
|
purpose: {
|
|
437
500
|
typeOf: client.factory.transactionType.PlaceOrder;
|
|
438
501
|
id: string;
|
|
@@ -492,7 +555,9 @@ function authorizeCreditCardAsyncForcibly(params: {
|
|
|
492
555
|
object: Pick<
|
|
493
556
|
client.factory.action.authorize.paymentMethod.any.IObjectWithoutDetail,
|
|
494
557
|
'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty' | 'ticketToken'
|
|
495
|
-
|
|
558
|
+
> & {
|
|
559
|
+
eventIdsAsOrderedItem?: string[];
|
|
560
|
+
};
|
|
496
561
|
purpose: {
|
|
497
562
|
typeOf: client.factory.transactionType.PlaceOrder;
|
|
498
563
|
id: string;
|
|
@@ -20,7 +20,7 @@ export interface IFindParams {
|
|
|
20
20
|
*/
|
|
21
21
|
itemOfferedIds?: string[];
|
|
22
22
|
}
|
|
23
|
-
export declare type IEventOfferAsFindResult = Pick<factory.eventOffer.IEventOffer, 'availableAtOrFrom' | 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough'>;
|
|
23
|
+
export declare type IEventOfferAsFindResult = Pick<factory.eventOffer.IEventOffer, 'availableAtOrFrom' | 'identifier' | 'itemOffered' | 'offeredBy' | 'validFrom' | 'validThrough' | 'id'>;
|
|
24
24
|
/**
|
|
25
25
|
* 拡張イベントオファーサービス
|
|
26
26
|
*/
|
|
@@ -27,8 +27,9 @@ export interface IFindParams {
|
|
|
27
27
|
identifiers?: string[];
|
|
28
28
|
id?: string;
|
|
29
29
|
}
|
|
30
|
+
export declare type IEventOfferAsFindResult = Pick<factory.eventOffer.IEventOffer, 'availableAtOrFrom' | 'id' | 'identifier' | 'itemOffered' | 'offeredBy' | 'typeOf' | 'validFrom' | 'validThrough'>;
|
|
30
31
|
/**
|
|
31
|
-
*
|
|
32
|
+
* 拡張可能なイベントオファーサービス
|
|
32
33
|
*/
|
|
33
34
|
export declare class EventOfferService extends Service {
|
|
34
35
|
createEventOfferByIdentifier(
|
|
@@ -51,9 +52,7 @@ export declare class EventOfferService extends Service {
|
|
|
51
52
|
*/
|
|
52
53
|
itemOfferedId: string;
|
|
53
54
|
}): Promise<void>;
|
|
54
|
-
findEventOffers(params: IFindParams): Promise<
|
|
55
|
-
id: string;
|
|
56
|
-
})[]>;
|
|
55
|
+
findEventOffers(params: IFindParams): Promise<IEventOfferAsFindResult[]>;
|
|
57
56
|
/**
|
|
58
57
|
* 有効なイベントオファートークンを発行する(開発使用目的)
|
|
59
58
|
*/
|
|
@@ -56,7 +56,7 @@ var http_status_1 = require("http-status");
|
|
|
56
56
|
var service_1 = require("../service");
|
|
57
57
|
var BASE_URI = '/eventOffers';
|
|
58
58
|
/**
|
|
59
|
-
*
|
|
59
|
+
* 拡張可能なイベントオファーサービス
|
|
60
60
|
*/
|
|
61
61
|
var EventOfferService = /** @class */ (function (_super) {
|
|
62
62
|
__extends(EventOfferService, _super);
|
|
@@ -32,12 +32,22 @@ export declare type IMovieTicketMkknInfo = factory.action.check.paymentMethod.mo
|
|
|
32
32
|
knyknrNo: string;
|
|
33
33
|
};
|
|
34
34
|
export declare type IAuthorizeAnyPaymentObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizeAnyPaymentObject, 'amount' | 'issuedThrough' | 'paymentMethod' | 'name' | 'additionalProperty' | 'ticketToken'>;
|
|
35
|
-
export declare type IAuthorizeCreditCardObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizeCreditCardObject, 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty' | 'ticketToken'
|
|
35
|
+
export declare type IAuthorizeCreditCardObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizeCreditCardObject, 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty' | 'ticketToken'> & {
|
|
36
|
+
/**
|
|
37
|
+
* 関連注文に含まれるイベントIDリスト
|
|
38
|
+
*/
|
|
39
|
+
eventIdsAsOrderedItem?: string[];
|
|
40
|
+
};
|
|
36
41
|
export declare type IAuthorizeMovieTicketObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizeMovieTicketObject, 'issuedThrough' | 'paymentMethod' | 'movieTickets' | 'name' | 'additionalProperty' | 'ticketToken'>;
|
|
37
42
|
export declare type IAuthorizePaymentCardObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizePaymentCardObject, 'amount' | 'issuedThrough' | 'paymentMethod' | 'fromLocation' | 'name' | 'additionalProperty'> & {
|
|
38
43
|
description?: string;
|
|
39
44
|
};
|
|
40
|
-
export declare type IPublishPaymentUrlObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizeCreditCardObject, 'amount' | 'creditCard' | 'issuedThrough' | 'paymentMethod' | 'method' | 'ticketToken'
|
|
45
|
+
export declare type IPublishPaymentUrlObject = Pick<factory.action.authorize.paymentMethod.any.IAuthorizeCreditCardObject, 'amount' | 'creditCard' | 'issuedThrough' | 'paymentMethod' | 'method' | 'ticketToken'> & {
|
|
46
|
+
/**
|
|
47
|
+
* 関連注文に含まれるイベントIDリスト
|
|
48
|
+
*/
|
|
49
|
+
eventIdsAsOrderedItem?: string[];
|
|
50
|
+
};
|
|
41
51
|
export declare type IPublishPaymentUrlResult = Pick<factory.action.accept.pay.IResult, 'paymentMethodId' | 'paymentUrl'>;
|
|
42
52
|
export interface IFindAuthorizeActionResult {
|
|
43
53
|
/**
|
|
@@ -156,17 +156,17 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
156
156
|
*/
|
|
157
157
|
PaymentService.prototype.authorizeCreditCard = function (params, __) {
|
|
158
158
|
return __awaiter(this, void 0, void 0, function () {
|
|
159
|
-
var object, purpose, amount, issuedThrough, paymentMethod, creditCard, method, paymentMethodId, name, additionalProperty, ticketToken;
|
|
159
|
+
var object, purpose, amount, issuedThrough, paymentMethod, creditCard, method, paymentMethodId, name, additionalProperty, ticketToken, eventIdsAsOrderedItem;
|
|
160
160
|
var _this = this;
|
|
161
161
|
return __generator(this, function (_a) {
|
|
162
162
|
object = params.object, purpose = params.purpose;
|
|
163
|
-
amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, creditCard = object.creditCard, method = object.method, paymentMethodId = object.paymentMethodId, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken;
|
|
163
|
+
amount = object.amount, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, creditCard = object.creditCard, method = object.method, paymentMethodId = object.paymentMethodId, name = object.name, additionalProperty = object.additionalProperty, ticketToken = object.ticketToken, eventIdsAsOrderedItem = object.eventIdsAsOrderedItem;
|
|
164
164
|
return [2 /*return*/, this.fetch({
|
|
165
165
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/authorize",
|
|
166
166
|
method: 'POST',
|
|
167
167
|
expectedStatusCodes: [http_status_1.ACCEPTED, http_status_1.CREATED],
|
|
168
168
|
body: {
|
|
169
|
-
object: __assign(__assign(__assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof paymentMethodId === 'string') ? { paymentMethodId: paymentMethodId } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined),
|
|
169
|
+
object: __assign(__assign(__assign(__assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof name === 'string') ? { name: name } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof paymentMethodId === 'string') ? { paymentMethodId: paymentMethodId } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(additionalProperty)) ? { additionalProperty: additionalProperty } : undefined), (Array.isArray(eventIdsAsOrderedItem)) ? { eventIdsAsOrderedItem: eventIdsAsOrderedItem } : undefined),
|
|
170
170
|
purpose: purpose
|
|
171
171
|
},
|
|
172
172
|
qs: {
|
|
@@ -244,17 +244,17 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
244
244
|
*/
|
|
245
245
|
PaymentService.prototype.publishCreditCardPaymentUrlAsync = function (params) {
|
|
246
246
|
return __awaiter(this, void 0, void 0, function () {
|
|
247
|
-
var object, purpose, amount, creditCard, issuedThrough, paymentMethod, method, ticketToken;
|
|
247
|
+
var object, purpose, amount, creditCard, issuedThrough, paymentMethod, method, ticketToken, eventIdsAsOrderedItem;
|
|
248
248
|
var _this = this;
|
|
249
249
|
return __generator(this, function (_a) {
|
|
250
250
|
object = params.object, purpose = params.purpose;
|
|
251
|
-
amount = object.amount, creditCard = object.creditCard, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, method = object.method, ticketToken = object.ticketToken;
|
|
251
|
+
amount = object.amount, creditCard = object.creditCard, issuedThrough = object.issuedThrough, paymentMethod = object.paymentMethod, method = object.method, ticketToken = object.ticketToken, eventIdsAsOrderedItem = object.eventIdsAsOrderedItem;
|
|
252
252
|
return [2 /*return*/, this.fetch({
|
|
253
253
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/publishPaymentUrl",
|
|
254
254
|
method: 'POST',
|
|
255
255
|
expectedStatusCodes: [http_status_1.ACCEPTED],
|
|
256
256
|
body: {
|
|
257
|
-
object: __assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined),
|
|
257
|
+
object: __assign(__assign(__assign(__assign({ amount: amount, issuedThrough: issuedThrough, paymentMethod: paymentMethod }, (creditCard !== undefined && creditCard !== null) ? { creditCard: creditCard } : undefined), (typeof method === 'string') ? { method: method } : undefined), (typeof ticketToken === 'string') ? { ticketToken: ticketToken } : undefined), (Array.isArray(eventIdsAsOrderedItem)) ? { eventIdsAsOrderedItem: eventIdsAsOrderedItem } : undefined),
|
|
258
258
|
purpose: purpose
|
|
259
259
|
},
|
|
260
260
|
qs: {
|
|
@@ -21,8 +21,11 @@ declare type IScreeningEventOffer = Omit<factory.event.screeningEvent.IOffer, 's
|
|
|
21
21
|
declare type IScreeningEventOffer4COA = Omit<factory.event.screeningEvent.IOffer4COA, 'seller'> & {
|
|
22
22
|
seller: ISeller4COA;
|
|
23
23
|
};
|
|
24
|
+
declare type IScreeningEventExtensibleOffer = Omit<factory.event.screeningEvent.IExtensibleEventOffer, 'seller'> & {
|
|
25
|
+
seller: ISeller;
|
|
26
|
+
};
|
|
24
27
|
export declare type IEvent = Omit<factory.event.screeningEvent.IEvent, 'offers'> & {
|
|
25
|
-
offers?: IScreeningEventOffer | IScreeningEventOffer4COA;
|
|
28
|
+
offers?: IScreeningEventOffer | IScreeningEventOffer4COA | IScreeningEventExtensibleOffer;
|
|
26
29
|
};
|
|
27
30
|
export declare type IMinimizedEvent = Pick<factory.event.screeningEvent.IEvent, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'id' | 'location' | 'maximumAttendeeCapacity' | 'remainingAttendeeCapacity' | 'startDate' | 'superEvent'>;
|
|
28
31
|
/**
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ICreatingEventOffer, IEventOfferAsFindResult, IFindParams } from '../../chevreAdmin/eventOffer';
|
|
2
|
+
import { Service } from '../../service';
|
|
3
|
+
/**
|
|
4
|
+
* イベントオファー管理サービス
|
|
5
|
+
* イベントとアプリケーションに対して有効なオファーを定義します
|
|
6
|
+
*/
|
|
7
|
+
export declare class EventOfferService extends Service {
|
|
8
|
+
private chevreAdminEventOffer;
|
|
9
|
+
/**
|
|
10
|
+
* イベントオファーを追加する(イベントIDとオファーコードに対して、存在しなければ作成)
|
|
11
|
+
*/
|
|
12
|
+
createEventOfferByIdentifier(
|
|
13
|
+
/**
|
|
14
|
+
* max: 20
|
|
15
|
+
*/
|
|
16
|
+
params: ICreatingEventOffer[], options: {
|
|
17
|
+
/**
|
|
18
|
+
* イベントID
|
|
19
|
+
*/
|
|
20
|
+
itemOfferedId: string;
|
|
21
|
+
}): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
* イベントオファーを編集する
|
|
24
|
+
*/
|
|
25
|
+
updateEventOfferByIdentifier(
|
|
26
|
+
/**
|
|
27
|
+
* max: 20
|
|
28
|
+
*/
|
|
29
|
+
params: ICreatingEventOffer[], options: {
|
|
30
|
+
/**
|
|
31
|
+
* イベントID
|
|
32
|
+
*/
|
|
33
|
+
itemOfferedId: string;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* イベントオファーを検索する
|
|
37
|
+
*/
|
|
38
|
+
findEventOffers(params: IFindParams): Promise<IEventOfferAsFindResult[]>;
|
|
39
|
+
private getChevreAdminEventOffer;
|
|
40
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
18
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
+
function step(op) {
|
|
31
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
+
while (_) try {
|
|
33
|
+
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;
|
|
34
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
+
switch (op[0]) {
|
|
36
|
+
case 0: case 1: t = op; break;
|
|
37
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
+
default:
|
|
41
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
+
if (t[2]) _.ops.pop();
|
|
46
|
+
_.trys.pop(); continue;
|
|
47
|
+
}
|
|
48
|
+
op = body.call(thisArg, _);
|
|
49
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.EventOfferService = void 0;
|
|
55
|
+
var index_1 = require("../../index");
|
|
56
|
+
var service_1 = require("../../service");
|
|
57
|
+
/**
|
|
58
|
+
* イベントオファー管理サービス
|
|
59
|
+
* イベントとアプリケーションに対して有効なオファーを定義します
|
|
60
|
+
*/
|
|
61
|
+
var EventOfferService = /** @class */ (function (_super) {
|
|
62
|
+
__extends(EventOfferService, _super);
|
|
63
|
+
function EventOfferService() {
|
|
64
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* イベントオファーを追加する(イベントIDとオファーコードに対して、存在しなければ作成)
|
|
68
|
+
*/
|
|
69
|
+
EventOfferService.prototype.createEventOfferByIdentifier = function (
|
|
70
|
+
/**
|
|
71
|
+
* max: 20
|
|
72
|
+
*/
|
|
73
|
+
params, options) {
|
|
74
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
75
|
+
return __generator(this, function (_a) {
|
|
76
|
+
switch (_a.label) {
|
|
77
|
+
case 0: return [4 /*yield*/, this.getChevreAdminEventOffer()];
|
|
78
|
+
case 1: return [4 /*yield*/, (_a.sent()).createEventOfferByIdentifier(params, options)];
|
|
79
|
+
case 2:
|
|
80
|
+
_a.sent();
|
|
81
|
+
return [2 /*return*/];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
/**
|
|
87
|
+
* イベントオファーを編集する
|
|
88
|
+
*/
|
|
89
|
+
EventOfferService.prototype.updateEventOfferByIdentifier = function (
|
|
90
|
+
/**
|
|
91
|
+
* max: 20
|
|
92
|
+
*/
|
|
93
|
+
params, options) {
|
|
94
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, this.getChevreAdminEventOffer()];
|
|
98
|
+
case 1: return [4 /*yield*/, (_a.sent()).updateEventOfferByIdentifier(params, options)];
|
|
99
|
+
case 2:
|
|
100
|
+
_a.sent();
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* イベントオファーを検索する
|
|
108
|
+
*/
|
|
109
|
+
EventOfferService.prototype.findEventOffers = function (params) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
switch (_a.label) {
|
|
113
|
+
case 0: return [4 /*yield*/, this.getChevreAdminEventOffer()];
|
|
114
|
+
case 1: return [2 /*return*/, (_a.sent()).findEventOffers(params)];
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
EventOfferService.prototype.getChevreAdminEventOffer = function () {
|
|
120
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
121
|
+
var _a, auth, endpoint, project, seller, chevreAdmin, _b;
|
|
122
|
+
return __generator(this, function (_c) {
|
|
123
|
+
switch (_c.label) {
|
|
124
|
+
case 0:
|
|
125
|
+
if (!(this.chevreAdminEventOffer === undefined)) return [3 /*break*/, 3];
|
|
126
|
+
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller;
|
|
127
|
+
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint })];
|
|
128
|
+
case 1:
|
|
129
|
+
chevreAdmin = _c.sent();
|
|
130
|
+
_b = this;
|
|
131
|
+
return [4 /*yield*/, chevreAdmin.createEventOfferInstance({
|
|
132
|
+
project: project,
|
|
133
|
+
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
134
|
+
})];
|
|
135
|
+
case 2:
|
|
136
|
+
_b.chevreAdminEventOffer = _c.sent();
|
|
137
|
+
_c.label = 3;
|
|
138
|
+
case 3: return [2 /*return*/, this.chevreAdminEventOffer];
|
|
139
|
+
}
|
|
140
|
+
});
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
return EventOfferService;
|
|
144
|
+
}(service_1.Service));
|
|
145
|
+
exports.EventOfferService = EventOfferService;
|
|
@@ -2,6 +2,7 @@ import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from '../serv
|
|
|
2
2
|
import type { CreativeWorkService } from './admin/creativeWork';
|
|
3
3
|
import type { CustomerService } from './admin/customer';
|
|
4
4
|
import type { EventService } from './admin/event';
|
|
5
|
+
import type { EventOfferService } from './admin/eventOffer';
|
|
5
6
|
import type { MeService } from './admin/me';
|
|
6
7
|
import type { NoteAboutOrderService } from './admin/noteAboutOrder';
|
|
7
8
|
import type { OfferService } from './admin/offer';
|
|
@@ -35,6 +36,13 @@ export declare namespace service {
|
|
|
35
36
|
namespace Event {
|
|
36
37
|
let svc: typeof EventService | undefined;
|
|
37
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* イベントオファーサービス
|
|
41
|
+
*/
|
|
42
|
+
type EventOffer = EventOfferService;
|
|
43
|
+
namespace EventOffer {
|
|
44
|
+
let svc: typeof EventOfferService | undefined;
|
|
45
|
+
}
|
|
38
46
|
/**
|
|
39
47
|
* 管理者サービス
|
|
40
48
|
*/
|
|
@@ -115,6 +123,7 @@ export declare class CloudAdmin {
|
|
|
115
123
|
createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
|
|
116
124
|
createCustomerInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CustomerService>;
|
|
117
125
|
createEventInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventService>;
|
|
126
|
+
createEventOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EventOfferService>;
|
|
118
127
|
createMeInstance(): Promise<MeService>;
|
|
119
128
|
createNoteInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<NoteAboutOrderService>;
|
|
120
129
|
createOfferInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OfferService>;
|