@cinerino/sdk 12.8.0-alpha.2 → 12.9.0-alpha.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/chevre/admin/adminEventOffersByIdentifier.ts +18 -6
- package/example/src/cloud/admin/adminEventsByIdentifier.ts +1 -1
- package/example/src/cloud/transaction/processPlaceOrderByCreditCard3DS.ts +21 -6
- package/example/src/cloud/transaction/processPlaceOrderUsingMemberProgramTier.ts +11 -7
- package/lib/abstract/chevreAdmin/event.d.ts +7 -6
- package/lib/abstract/chevreAdmin/eventOffer.d.ts +8 -0
- package/lib/abstract/chevreAdmin/eventOffer.js +20 -0
- package/lib/abstract/chevreTxn/offer.d.ts +12 -2
- package/lib/abstract/chevreTxn/offer.js +22 -0
- package/lib/abstract/chevreTxn/transaction/placeOrder/factory.d.ts +9 -0
- package/lib/abstract/cloud/admin/event.d.ts +1 -10
- package/lib/abstract/cloud/admin/event.js +0 -32
- package/lib/abstract/cloud/txn/offer.d.ts +11 -1
- package/lib/abstract/cloud/txn/offer.js +28 -1
- package/lib/bundle.js +70 -33
- package/package.json +2 -2
- package/example/src/chevre/admin/adminCreateEventIfNotExistByIdentifier.ts +0 -138
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
// tslint:disable:no-console
|
|
2
2
|
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
+
import * as moment from 'moment';
|
|
3
4
|
import * as client from '../../../../lib/index';
|
|
4
5
|
import * as auth from '../../auth/authAsAdmin';
|
|
5
6
|
|
|
6
7
|
const PROJECT_ID = String(process.env.PROJECT_ID);
|
|
7
8
|
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
8
|
-
const OFFER_IDENTIFIER = '
|
|
9
|
-
const itemOfferedId = '
|
|
9
|
+
const OFFER_IDENTIFIER = '20251120eventOffer01';
|
|
10
|
+
const itemOfferedId = '691e5b3ba84891e2b630fca9';
|
|
10
11
|
|
|
11
12
|
// tslint:disable-next-line:max-func-body-length
|
|
12
13
|
async function main() {
|
|
@@ -24,13 +25,21 @@ async function main() {
|
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
const now = new Date();
|
|
28
|
+
const validFrom = moment(now)
|
|
29
|
+
.toDate();
|
|
30
|
+
const validThrough = moment(validFrom)
|
|
31
|
+
.add(1, 'minutes')
|
|
32
|
+
.toDate();
|
|
27
33
|
await eventOfferService.createEventOfferByIdentifier(
|
|
28
34
|
[
|
|
29
35
|
{
|
|
30
36
|
identifier: OFFER_IDENTIFIER,
|
|
31
37
|
availableAtOrFrom: { identifier: 'SmartTheaterTXN' },
|
|
32
|
-
validFrom
|
|
33
|
-
validThrough
|
|
38
|
+
validFrom,
|
|
39
|
+
validThrough
|
|
40
|
+
// offeredBy: {
|
|
41
|
+
// identifier: 'DefaultTokenIssuer'
|
|
42
|
+
// }
|
|
34
43
|
}
|
|
35
44
|
],
|
|
36
45
|
{
|
|
@@ -44,8 +53,11 @@ async function main() {
|
|
|
44
53
|
{
|
|
45
54
|
identifier: OFFER_IDENTIFIER,
|
|
46
55
|
availableAtOrFrom: { identifier: 'SmartTheaterTXN' },
|
|
47
|
-
validFrom
|
|
48
|
-
validThrough
|
|
56
|
+
validFrom,
|
|
57
|
+
validThrough
|
|
58
|
+
// offeredBy: {
|
|
59
|
+
// identifier: 'DefaultTokenIssuer'
|
|
60
|
+
// }
|
|
49
61
|
}
|
|
50
62
|
],
|
|
51
63
|
{
|
|
@@ -34,7 +34,7 @@ async function main() {
|
|
|
34
34
|
const today = moment()
|
|
35
35
|
.tz('Asia/Tokyo')
|
|
36
36
|
.format('YYYY-MM-DD');
|
|
37
|
-
const startDate = moment(`${today}
|
|
37
|
+
const startDate = moment(`${today}T13:00:00Z`)
|
|
38
38
|
.toDate();
|
|
39
39
|
const endDate = moment(startDate)
|
|
40
40
|
.add(1, 'hour')
|
|
@@ -5,7 +5,7 @@ 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 } = process.env;
|
|
8
|
+
const { EVENT_ID, SAMPLE_EVENT_OFFER_TOKEN } = process.env;
|
|
9
9
|
const profile: client.factory.person.IProfile = {
|
|
10
10
|
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
11
|
givenName: 'Taro ##\n##\r##\n\n\n##\r\r\r##\r\n\r\n\r\n##',
|
|
@@ -364,15 +364,27 @@ async function authorizeSeatReservationByEvent(params: {
|
|
|
364
364
|
const selectedSeatOffers = availableSeatOffers.slice(0, 1);
|
|
365
365
|
console.log(selectedSeatOffers.length, 'seats selected');
|
|
366
366
|
|
|
367
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
368
|
+
// TODO 拡張イベントオファー検索
|
|
369
|
+
|
|
370
|
+
await wait(3000);
|
|
371
|
+
// 拡張オファー使用の場合、オファーコードを指定してオファーチケットを発行
|
|
372
|
+
const { ticketToken } = await offerService.issueEventServiceOfferTicket({
|
|
373
|
+
audience: { id: transaction.id },
|
|
374
|
+
eventId: screeningEvent.id,
|
|
375
|
+
eventOfferId: '691e5bb3929e69df1ec6e9a6', // 拡張オファー使用の場合、イベントオファーIDを指定する
|
|
376
|
+
ticketedOffer: {
|
|
377
|
+
...(typeof SAMPLE_EVENT_OFFER_TOKEN === 'string') ? { token: SAMPLE_EVENT_OFFER_TOKEN } : undefined
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
console.log('offer ticket issued.', ticketToken);
|
|
381
|
+
|
|
367
382
|
await wait(3000);
|
|
368
383
|
console.log('authorizing seat reservation...');
|
|
369
384
|
const seatReservationAuth = <IAuthorizeReservationAction>await offerService.authorizeEventService({
|
|
370
385
|
object: {
|
|
371
386
|
reservationFor: {
|
|
372
|
-
id: screeningEvent.id
|
|
373
|
-
offers: {
|
|
374
|
-
identifier: '20251113eventOffer' // 拡張オファー使用の場合、オファーコードを指定する
|
|
375
|
-
}
|
|
387
|
+
id: screeningEvent.id
|
|
376
388
|
},
|
|
377
389
|
acceptedOffer: selectedSeatOffers.map((o) => {
|
|
378
390
|
return {
|
|
@@ -396,7 +408,10 @@ async function authorizeSeatReservationByEvent(params: {
|
|
|
396
408
|
};
|
|
397
409
|
})
|
|
398
410
|
},
|
|
399
|
-
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
411
|
+
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
412
|
+
instrument: [
|
|
413
|
+
{ ticketToken, typeOf: 'Ticket' } // オファーチケットを指定する
|
|
414
|
+
]
|
|
400
415
|
});
|
|
401
416
|
console.log('seat reservation authorized', seatReservationAuth.id);
|
|
402
417
|
|
|
@@ -323,17 +323,21 @@ async function authorizeSeatReservationByEvent(params: {
|
|
|
323
323
|
if (typeof MEMBER_PROGRAM_TIER_TOKEN !== 'string') {
|
|
324
324
|
throw new Error('process.env.MEMBER_PROGRAM_TIER_TOKEN required');
|
|
325
325
|
}
|
|
326
|
+
|
|
327
|
+
// tslint:disable-next-line:no-suspicious-comment
|
|
328
|
+
// TODO オファーチケット発行
|
|
329
|
+
// offers: {
|
|
330
|
+
// validForMemberTier: {
|
|
331
|
+
// token: MEMBER_PROGRAM_TIER_TOKEN,
|
|
332
|
+
// isTierOf: { identifier: 'DefaultMemberProgram' }
|
|
333
|
+
// }
|
|
334
|
+
// }
|
|
335
|
+
|
|
326
336
|
console.log('authorizing seat reservation...');
|
|
327
337
|
const seatReservationAuth = <IAuthorizeReservationAction>await offerService.authorizeEventService({
|
|
328
338
|
object: {
|
|
329
339
|
reservationFor: {
|
|
330
|
-
id: screeningEvent.id
|
|
331
|
-
offers: {
|
|
332
|
-
validForMemberTier: {
|
|
333
|
-
token: MEMBER_PROGRAM_TIER_TOKEN,
|
|
334
|
-
isTierOf: { identifier: 'DefaultMemberProgram' }
|
|
335
|
-
}
|
|
336
|
-
}
|
|
340
|
+
id: screeningEvent.id
|
|
337
341
|
},
|
|
338
342
|
acceptedOffer: selectedSeatOffers.map((o) => {
|
|
339
343
|
return {
|
|
@@ -3,18 +3,19 @@ import { Service } from '../service';
|
|
|
3
3
|
declare type ISendEmailMessageOnEventUpdated = Pick<factory.action.transfer.send.message.email.IAttributes, 'purpose' | 'recipient'> & {
|
|
4
4
|
object: factory.action.transfer.send.message.email.IObjectAsEmailMessage;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* 識別子によるイベント追加パラメータ
|
|
8
|
+
*/
|
|
6
9
|
export declare type ICreateParamsByIdentifier = Pick<factory.event.screeningEvent.ICreateParams, 'additionalProperty' | 'doorTime' | 'endDate' | 'eventStatus' | 'maximumPhysicalAttendeeCapacity' | 'offers' | 'startDate'> & {
|
|
7
10
|
identifier: string;
|
|
8
11
|
offers: Pick<factory.event.screeningEvent.IOffers4create, 'eligibleQuantity' | 'seller' | 'unacceptedPaymentMethod'> & {
|
|
9
12
|
itemOffered: Pick<factory.event.screeningEvent.IItemOffered, 'id'>;
|
|
10
13
|
};
|
|
11
14
|
};
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
superEvent?: never;
|
|
17
|
-
};
|
|
15
|
+
/**
|
|
16
|
+
* 識別子によるイベント編集パラメータ
|
|
17
|
+
*/
|
|
18
|
+
export declare type IUpdateParamsByIdentifier = factory.event.screeningEvent.IUpdateByIdentifierParams;
|
|
18
19
|
export interface IUpdateEventSellerMakesOfferParamsByIdentifier {
|
|
19
20
|
/**
|
|
20
21
|
* イベント識別子
|
|
@@ -54,4 +54,12 @@ export declare class EventOfferService extends Service {
|
|
|
54
54
|
findEventOffers(params: IFindParams): Promise<(Omit<factory.eventOffer.IEventOffer, 'project'> & {
|
|
55
55
|
id: string;
|
|
56
56
|
})[]>;
|
|
57
|
+
/**
|
|
58
|
+
* 有効なイベントオファートークンを発行する(開発使用目的)
|
|
59
|
+
*/
|
|
60
|
+
issueEventOfferToken(params: {
|
|
61
|
+
id: string;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
token: string;
|
|
64
|
+
}>;
|
|
57
65
|
}
|
|
@@ -129,6 +129,26 @@ var EventOfferService = /** @class */ (function (_super) {
|
|
|
129
129
|
});
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
|
+
/**
|
|
133
|
+
* 有効なイベントオファートークンを発行する(開発使用目的)
|
|
134
|
+
*/
|
|
135
|
+
EventOfferService.prototype.issueEventOfferToken = function (params) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
137
|
+
var id;
|
|
138
|
+
var _this = this;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
id = params.id;
|
|
141
|
+
return [2 /*return*/, this.fetch({
|
|
142
|
+
uri: BASE_URI + "/" + encodeURIComponent(String(id)) + "/tokens",
|
|
143
|
+
method: 'POST',
|
|
144
|
+
expectedStatusCodes: [http_status_1.CREATED]
|
|
145
|
+
})
|
|
146
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
147
|
+
return [2 /*return*/, response.json()];
|
|
148
|
+
}); }); })];
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
};
|
|
132
152
|
return EventOfferService;
|
|
133
153
|
}(service_1.Service));
|
|
134
154
|
exports.EventOfferService = EventOfferService;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
import { IAuthorizeEventServiceResult, IAuthorizeProductOfferResult, IMinimalAuthorizeEventServiceResult } from './transaction/placeOrder/factory';
|
|
3
|
+
import { IAuthorizeEventServiceResult, IAuthorizeProductOfferResult, IMinimalAuthorizeEventServiceResult, IOfferTicket } from './transaction/placeOrder/factory';
|
|
4
4
|
export interface IPurpose {
|
|
5
5
|
typeOf: factory.transactionType;
|
|
6
6
|
id: string;
|
|
@@ -16,12 +16,22 @@ export declare class OfferService extends Service {
|
|
|
16
16
|
object: factory.action.authorize.offer.product.IObjectWithoutDetail;
|
|
17
17
|
purpose: factory.action.authorize.offer.product.IPurpose;
|
|
18
18
|
}): Promise<IAuthorizeProductOfferResult>;
|
|
19
|
+
/**
|
|
20
|
+
* 興行オファーチケット発行
|
|
21
|
+
*/
|
|
22
|
+
issueEventServiceOfferTicket(params: {
|
|
23
|
+
audience: Pick<factory.action.authorize.offer.eventService.IPurpose, 'id'>;
|
|
24
|
+
eventId: string;
|
|
25
|
+
eventOfferId?: string;
|
|
26
|
+
ticketedOffer?: Pick<factory.authorization.IOfferAsObject, 'token' | 'validForMemberTier'>;
|
|
27
|
+
}): Promise<IOfferTicket>;
|
|
19
28
|
/**
|
|
20
29
|
* 興行オファー承認
|
|
21
30
|
*/
|
|
22
31
|
authorizeEventService(params: {
|
|
23
|
-
object: factory.action.authorize.offer.eventService.IObjectWithoutDetail
|
|
32
|
+
object: Pick<factory.action.authorize.offer.eventService.IObjectWithoutDetail, 'acceptedOffer' | 'reservationFor'>;
|
|
24
33
|
purpose: factory.action.authorize.offer.eventService.IPurpose;
|
|
34
|
+
instrument?: factory.action.reserve.ITicketAsInstrument[];
|
|
25
35
|
}, options?: {
|
|
26
36
|
expectsMinimalResponse?: boolean;
|
|
27
37
|
/**
|
|
@@ -107,6 +107,28 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
107
107
|
});
|
|
108
108
|
});
|
|
109
109
|
};
|
|
110
|
+
/**
|
|
111
|
+
* 興行オファーチケット発行
|
|
112
|
+
*/
|
|
113
|
+
OfferService.prototype.issueEventServiceOfferTicket = function (params) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
115
|
+
var ticketedOffer, audience, eventId, eventOfferId;
|
|
116
|
+
var _this = this;
|
|
117
|
+
return __generator(this, function (_a) {
|
|
118
|
+
ticketedOffer = params.ticketedOffer, audience = params.audience, eventId = params.eventId, eventOfferId = params.eventOfferId;
|
|
119
|
+
return [2 /*return*/, this.fetch({
|
|
120
|
+
uri: "/offers/" + factory.product.ProductType.EventService + "/tickets",
|
|
121
|
+
method: 'POST',
|
|
122
|
+
expectedStatusCodes: [http_status_1.CREATED],
|
|
123
|
+
body: { ticketedOffer: ticketedOffer },
|
|
124
|
+
qs: __assign({ audience: { id: audience.id }, eventId: eventId }, (typeof eventOfferId === 'string') ? { eventOfferId: eventOfferId } : undefined)
|
|
125
|
+
})
|
|
126
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
127
|
+
return [2 /*return*/, response.json()];
|
|
128
|
+
}); }); })];
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
};
|
|
110
132
|
/**
|
|
111
133
|
* 興行オファー承認
|
|
112
134
|
*/
|
|
@@ -69,4 +69,13 @@ export declare type IMinimalOrderAsConfirmResult = Pick<factory.order.IOrder, 'c
|
|
|
69
69
|
export interface IMinimalConfirmResult {
|
|
70
70
|
order: IMinimalOrderAsConfirmResult;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* 興行オファーチケット
|
|
74
|
+
*/
|
|
75
|
+
export interface IOfferTicket {
|
|
76
|
+
/**
|
|
77
|
+
* チケットトークン
|
|
78
|
+
*/
|
|
79
|
+
ticketToken: string;
|
|
80
|
+
}
|
|
72
81
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as factory from '../../factory';
|
|
2
2
|
import { Service } from '../../service';
|
|
3
|
-
import { ICreateParamsByIdentifier,
|
|
3
|
+
import { ICreateParamsByIdentifier, IUpdateParamsByIdentifier } from '../../chevreAdmin/event';
|
|
4
4
|
declare type ISendEmailMessageOnEventUpdated = Pick<factory.action.transfer.send.message.email.IAttributes, 'purpose' | 'recipient'> & {
|
|
5
5
|
object: factory.action.transfer.send.message.email.IObjectAsEmailMessage;
|
|
6
6
|
};
|
|
@@ -39,15 +39,6 @@ export declare class EventService extends Service {
|
|
|
39
39
|
updateEventsByIdentifier(params: IUpdateParamsByIdentifier[], options: {
|
|
40
40
|
typeOf: factory.eventType.ScreeningEvent;
|
|
41
41
|
}): Promise<void>;
|
|
42
|
-
/**
|
|
43
|
-
* イベントのアプリケーションオファー編集(識別子によるイベント複数編集)
|
|
44
|
-
* 識別子のイベントが存在しなければNotFound
|
|
45
|
-
*/
|
|
46
|
-
updateEventsSellerMakesOfferByIdentifier(
|
|
47
|
-
/**
|
|
48
|
-
* max: 10
|
|
49
|
-
*/
|
|
50
|
-
params: IUpdateEventSellerMakesOfferParamsByIdentifier[]): Promise<void>;
|
|
51
42
|
/**
|
|
52
43
|
* イベントステータス更新
|
|
53
44
|
*/
|
|
@@ -136,38 +136,6 @@ var EventService = /** @class */ (function (_super) {
|
|
|
136
136
|
});
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
-
/**
|
|
140
|
-
* イベントのアプリケーションオファー編集(識別子によるイベント複数編集)
|
|
141
|
-
* 識別子のイベントが存在しなければNotFound
|
|
142
|
-
*/
|
|
143
|
-
EventService.prototype.updateEventsSellerMakesOfferByIdentifier = function (
|
|
144
|
-
/**
|
|
145
|
-
* max: 10
|
|
146
|
-
*/
|
|
147
|
-
params) {
|
|
148
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
149
|
-
var _a, auth, endpoint, project, seller, disableAutoRetry, chevreAdmin, eventService;
|
|
150
|
-
return __generator(this, function (_b) {
|
|
151
|
-
switch (_b.label) {
|
|
152
|
-
case 0:
|
|
153
|
-
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry;
|
|
154
|
-
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
|
|
155
|
-
case 1:
|
|
156
|
-
chevreAdmin = _b.sent();
|
|
157
|
-
return [4 /*yield*/, chevreAdmin.createEventInstance({
|
|
158
|
-
project: project,
|
|
159
|
-
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
160
|
-
})];
|
|
161
|
-
case 2:
|
|
162
|
-
eventService = _b.sent();
|
|
163
|
-
return [4 /*yield*/, eventService.updateEventsSellerMakesOfferByIdentifier(params)];
|
|
164
|
-
case 3:
|
|
165
|
-
_b.sent();
|
|
166
|
-
return [2 /*return*/];
|
|
167
|
-
}
|
|
168
|
-
});
|
|
169
|
-
});
|
|
170
|
-
};
|
|
171
139
|
/**
|
|
172
140
|
* イベントステータス更新
|
|
173
141
|
*/
|
|
@@ -1,16 +1,26 @@
|
|
|
1
|
-
import type { IAuthorizeEventServiceResult, IMinimalAuthorizeEventServiceResult } from '../../chevreTxn/transaction/placeOrder/factory';
|
|
1
|
+
import type { IAuthorizeEventServiceResult, IMinimalAuthorizeEventServiceResult, IOfferTicket } from '../../chevreTxn/transaction/placeOrder/factory';
|
|
2
2
|
import * as factory from '../../factory';
|
|
3
3
|
import { Service } from '../../service';
|
|
4
4
|
/**
|
|
5
5
|
* オファーサービス
|
|
6
6
|
*/
|
|
7
7
|
export declare class OfferService extends Service {
|
|
8
|
+
/**
|
|
9
|
+
* 興行オファーチケット発行
|
|
10
|
+
*/
|
|
11
|
+
issueEventServiceOfferTicket(params: {
|
|
12
|
+
audience: Pick<factory.action.authorize.offer.eventService.IPurpose, 'id'>;
|
|
13
|
+
eventId: string;
|
|
14
|
+
eventOfferId?: string;
|
|
15
|
+
ticketedOffer?: Pick<factory.authorization.IOfferAsObject, 'token' | 'validForMemberTier'>;
|
|
16
|
+
}): Promise<IOfferTicket>;
|
|
8
17
|
/**
|
|
9
18
|
* 興行オファー承認
|
|
10
19
|
*/
|
|
11
20
|
authorizeEventService(params: {
|
|
12
21
|
object: factory.action.authorize.offer.eventService.IObjectWithoutDetail;
|
|
13
22
|
purpose: factory.action.authorize.offer.eventService.IPurpose;
|
|
23
|
+
instrument?: factory.action.reserve.ITicketAsInstrument[];
|
|
14
24
|
}, options?: {
|
|
15
25
|
/**
|
|
16
26
|
* レスポンスを最小化する
|
|
@@ -75,6 +75,32 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
75
75
|
// > & IAdditionalOptions) {
|
|
76
76
|
// super(options);
|
|
77
77
|
// }
|
|
78
|
+
/**
|
|
79
|
+
* 興行オファーチケット発行
|
|
80
|
+
*/
|
|
81
|
+
OfferService.prototype.issueEventServiceOfferTicket = function (params) {
|
|
82
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
+
var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreTxn, offerService, ticketedOffer, audience, eventId, eventOfferId;
|
|
84
|
+
return __generator(this, function (_b) {
|
|
85
|
+
switch (_b.label) {
|
|
86
|
+
case 0:
|
|
87
|
+
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
|
|
88
|
+
return [4 /*yield*/, index_1.loadChevreTxn({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
|
|
89
|
+
case 1:
|
|
90
|
+
chevreTxn = _b.sent();
|
|
91
|
+
return [4 /*yield*/, chevreTxn.createOfferInstance({
|
|
92
|
+
project: project,
|
|
93
|
+
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
|
|
94
|
+
retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
|
|
95
|
+
})];
|
|
96
|
+
case 2:
|
|
97
|
+
offerService = _b.sent();
|
|
98
|
+
ticketedOffer = params.ticketedOffer, audience = params.audience, eventId = params.eventId, eventOfferId = params.eventOfferId;
|
|
99
|
+
return [2 /*return*/, offerService.issueEventServiceOfferTicket({ ticketedOffer: ticketedOffer, audience: audience, eventId: eventId, eventOfferId: eventOfferId })];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
78
104
|
/**
|
|
79
105
|
* 興行オファー承認
|
|
80
106
|
*/
|
|
@@ -100,7 +126,8 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
100
126
|
acceptedOffer: params.object.acceptedOffer,
|
|
101
127
|
reservationFor: params.object.reservationFor
|
|
102
128
|
},
|
|
103
|
-
purpose: { id: params.purpose.id, typeOf: factory.transactionType.PlaceOrder }
|
|
129
|
+
purpose: { id: params.purpose.id, typeOf: factory.transactionType.PlaceOrder },
|
|
130
|
+
instrument: (Array.isArray(params.instrument)) ? params.instrument : []
|
|
104
131
|
}, options)];
|
|
105
132
|
}
|
|
106
133
|
});
|
package/lib/bundle.js
CHANGED
|
@@ -3197,6 +3197,26 @@ var EventOfferService = /** @class */ (function (_super) {
|
|
|
3197
3197
|
});
|
|
3198
3198
|
});
|
|
3199
3199
|
};
|
|
3200
|
+
/**
|
|
3201
|
+
* 有効なイベントオファートークンを発行する(開発使用目的)
|
|
3202
|
+
*/
|
|
3203
|
+
EventOfferService.prototype.issueEventOfferToken = function (params) {
|
|
3204
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
3205
|
+
var id;
|
|
3206
|
+
var _this = this;
|
|
3207
|
+
return __generator(this, function (_a) {
|
|
3208
|
+
id = params.id;
|
|
3209
|
+
return [2 /*return*/, this.fetch({
|
|
3210
|
+
uri: BASE_URI + "/" + encodeURIComponent(String(id)) + "/tokens",
|
|
3211
|
+
method: 'POST',
|
|
3212
|
+
expectedStatusCodes: [http_status_1.CREATED]
|
|
3213
|
+
})
|
|
3214
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
3215
|
+
return [2 /*return*/, response.json()];
|
|
3216
|
+
}); }); })];
|
|
3217
|
+
});
|
|
3218
|
+
});
|
|
3219
|
+
};
|
|
3200
3220
|
return EventOfferService;
|
|
3201
3221
|
}(service_1.Service));
|
|
3202
3222
|
exports.EventOfferService = EventOfferService;
|
|
@@ -19295,6 +19315,28 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
19295
19315
|
});
|
|
19296
19316
|
});
|
|
19297
19317
|
};
|
|
19318
|
+
/**
|
|
19319
|
+
* 興行オファーチケット発行
|
|
19320
|
+
*/
|
|
19321
|
+
OfferService.prototype.issueEventServiceOfferTicket = function (params) {
|
|
19322
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
19323
|
+
var ticketedOffer, audience, eventId, eventOfferId;
|
|
19324
|
+
var _this = this;
|
|
19325
|
+
return __generator(this, function (_a) {
|
|
19326
|
+
ticketedOffer = params.ticketedOffer, audience = params.audience, eventId = params.eventId, eventOfferId = params.eventOfferId;
|
|
19327
|
+
return [2 /*return*/, this.fetch({
|
|
19328
|
+
uri: "/offers/" + factory.product.ProductType.EventService + "/tickets",
|
|
19329
|
+
method: 'POST',
|
|
19330
|
+
expectedStatusCodes: [http_status_1.CREATED],
|
|
19331
|
+
body: { ticketedOffer: ticketedOffer },
|
|
19332
|
+
qs: __assign({ audience: { id: audience.id }, eventId: eventId }, (typeof eventOfferId === 'string') ? { eventOfferId: eventOfferId } : undefined)
|
|
19333
|
+
})
|
|
19334
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
19335
|
+
return [2 /*return*/, response.json()];
|
|
19336
|
+
}); }); })];
|
|
19337
|
+
});
|
|
19338
|
+
});
|
|
19339
|
+
};
|
|
19298
19340
|
/**
|
|
19299
19341
|
* 興行オファー承認
|
|
19300
19342
|
*/
|
|
@@ -21745,38 +21787,6 @@ var EventService = /** @class */ (function (_super) {
|
|
|
21745
21787
|
});
|
|
21746
21788
|
});
|
|
21747
21789
|
};
|
|
21748
|
-
/**
|
|
21749
|
-
* イベントのアプリケーションオファー編集(識別子によるイベント複数編集)
|
|
21750
|
-
* 識別子のイベントが存在しなければNotFound
|
|
21751
|
-
*/
|
|
21752
|
-
EventService.prototype.updateEventsSellerMakesOfferByIdentifier = function (
|
|
21753
|
-
/**
|
|
21754
|
-
* max: 10
|
|
21755
|
-
*/
|
|
21756
|
-
params) {
|
|
21757
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
21758
|
-
var _a, auth, endpoint, project, seller, disableAutoRetry, chevreAdmin, eventService;
|
|
21759
|
-
return __generator(this, function (_b) {
|
|
21760
|
-
switch (_b.label) {
|
|
21761
|
-
case 0:
|
|
21762
|
-
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry;
|
|
21763
|
-
return [4 /*yield*/, index_1.loadChevreAdmin({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
|
|
21764
|
-
case 1:
|
|
21765
|
-
chevreAdmin = _b.sent();
|
|
21766
|
-
return [4 /*yield*/, chevreAdmin.createEventInstance({
|
|
21767
|
-
project: project,
|
|
21768
|
-
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' }
|
|
21769
|
-
})];
|
|
21770
|
-
case 2:
|
|
21771
|
-
eventService = _b.sent();
|
|
21772
|
-
return [4 /*yield*/, eventService.updateEventsSellerMakesOfferByIdentifier(params)];
|
|
21773
|
-
case 3:
|
|
21774
|
-
_b.sent();
|
|
21775
|
-
return [2 /*return*/];
|
|
21776
|
-
}
|
|
21777
|
-
});
|
|
21778
|
-
});
|
|
21779
|
-
};
|
|
21780
21790
|
/**
|
|
21781
21791
|
* イベントステータス更新
|
|
21782
21792
|
*/
|
|
@@ -26320,6 +26330,32 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
26320
26330
|
// > & IAdditionalOptions) {
|
|
26321
26331
|
// super(options);
|
|
26322
26332
|
// }
|
|
26333
|
+
/**
|
|
26334
|
+
* 興行オファーチケット発行
|
|
26335
|
+
*/
|
|
26336
|
+
OfferService.prototype.issueEventServiceOfferTicket = function (params) {
|
|
26337
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
26338
|
+
var _a, auth, endpoint, project, seller, disableAutoRetry, retryableStatusCodes, chevreTxn, offerService, ticketedOffer, audience, eventId, eventOfferId;
|
|
26339
|
+
return __generator(this, function (_b) {
|
|
26340
|
+
switch (_b.label) {
|
|
26341
|
+
case 0:
|
|
26342
|
+
_a = this.options, auth = _a.auth, endpoint = _a.endpoint, project = _a.project, seller = _a.seller, disableAutoRetry = _a.disableAutoRetry, retryableStatusCodes = _a.retryableStatusCodes;
|
|
26343
|
+
return [4 /*yield*/, index_1.loadChevreTxn({ auth: auth, endpoint: endpoint, disableAutoRetry: disableAutoRetry })];
|
|
26344
|
+
case 1:
|
|
26345
|
+
chevreTxn = _b.sent();
|
|
26346
|
+
return [4 /*yield*/, chevreTxn.createOfferInstance({
|
|
26347
|
+
project: project,
|
|
26348
|
+
seller: { id: (typeof (seller === null || seller === void 0 ? void 0 : seller.id) === 'string') ? seller.id : '' },
|
|
26349
|
+
retryableStatusCodes: __spreadArray([], (Array.isArray(retryableStatusCodes)) ? retryableStatusCodes : [])
|
|
26350
|
+
})];
|
|
26351
|
+
case 2:
|
|
26352
|
+
offerService = _b.sent();
|
|
26353
|
+
ticketedOffer = params.ticketedOffer, audience = params.audience, eventId = params.eventId, eventOfferId = params.eventOfferId;
|
|
26354
|
+
return [2 /*return*/, offerService.issueEventServiceOfferTicket({ ticketedOffer: ticketedOffer, audience: audience, eventId: eventId, eventOfferId: eventOfferId })];
|
|
26355
|
+
}
|
|
26356
|
+
});
|
|
26357
|
+
});
|
|
26358
|
+
};
|
|
26323
26359
|
/**
|
|
26324
26360
|
* 興行オファー承認
|
|
26325
26361
|
*/
|
|
@@ -26345,7 +26381,8 @@ var OfferService = /** @class */ (function (_super) {
|
|
|
26345
26381
|
acceptedOffer: params.object.acceptedOffer,
|
|
26346
26382
|
reservationFor: params.object.reservationFor
|
|
26347
26383
|
},
|
|
26348
|
-
purpose: { id: params.purpose.id, typeOf: factory.transactionType.PlaceOrder }
|
|
26384
|
+
purpose: { id: params.purpose.id, typeOf: factory.transactionType.PlaceOrder },
|
|
26385
|
+
instrument: (Array.isArray(params.instrument)) ? params.instrument : []
|
|
26349
26386
|
}, options)];
|
|
26350
26387
|
}
|
|
26351
26388
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cinerino/sdk",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.9.0-alpha.0",
|
|
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.2.0
|
|
96
|
+
"@chevre/factory": "5.2.0",
|
|
97
97
|
"debug": "3.2.7",
|
|
98
98
|
"http-status": "1.7.4",
|
|
99
99
|
"idtoken-verifier": "2.0.3",
|
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
// tslint:disable:no-console
|
|
2
|
-
// tslint:disable-next-line:no-implicit-dependencies
|
|
3
|
-
import * as moment from 'moment-timezone';
|
|
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
|
-
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
9
|
-
const EVENT_SERVICE_ID = '681aa7c1b53b6dbbe5efbec7';
|
|
10
|
-
const AVAILABLE_AT_OR_FROM_ID = '51qbjcfr72h62m06vtv5kkhgje';
|
|
11
|
-
const ADDITIONAL_PROPERTY_NAME = 'sampleCreateId';
|
|
12
|
-
|
|
13
|
-
// tslint:disable-next-line:max-func-body-length
|
|
14
|
-
async function main() {
|
|
15
|
-
const authClient = await auth.login();
|
|
16
|
-
await authClient.refreshAccessToken();
|
|
17
|
-
const loginTicket = authClient.verifyIdToken({});
|
|
18
|
-
console.log('username is', loginTicket.getUsername());
|
|
19
|
-
|
|
20
|
-
const eventService = await (await client.loadChevreAdmin({
|
|
21
|
-
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
22
|
-
auth: authClient
|
|
23
|
-
})).createEventInstance({
|
|
24
|
-
project: { id: PROJECT_ID },
|
|
25
|
-
seller: { id: SELLER_ID }
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const today = moment()
|
|
29
|
-
.tz('Asia/Tokyo')
|
|
30
|
-
.format('YYYY-MM-DD');
|
|
31
|
-
// const identifier = `fromSamples${moment()
|
|
32
|
-
// .format('YYYYMMDDTHHmm')}`;
|
|
33
|
-
const identifier = 'fromSamples20251028T1337';
|
|
34
|
-
await eventService.createIfNotExistByIdentifier(
|
|
35
|
-
[
|
|
36
|
-
{
|
|
37
|
-
identifier,
|
|
38
|
-
doorTime: moment(`${today}T13:00:00Z`)
|
|
39
|
-
.toDate(),
|
|
40
|
-
startDate: moment(`${today}T13:00:00Z`)
|
|
41
|
-
.toDate(),
|
|
42
|
-
endDate: moment(`${today}T14:00:00Z`)
|
|
43
|
-
.toDate(),
|
|
44
|
-
eventStatus: client.factory.eventStatusType.EventScheduled,
|
|
45
|
-
additionalProperty: [
|
|
46
|
-
{ name: ADDITIONAL_PROPERTY_NAME, value: identifier }
|
|
47
|
-
],
|
|
48
|
-
maximumPhysicalAttendeeCapacity: 3,
|
|
49
|
-
offers: {
|
|
50
|
-
unacceptedPaymentMethod: [],
|
|
51
|
-
eligibleQuantity: {
|
|
52
|
-
maxValue: 6
|
|
53
|
-
},
|
|
54
|
-
itemOffered: {
|
|
55
|
-
id: EVENT_SERVICE_ID
|
|
56
|
-
},
|
|
57
|
-
seller: {
|
|
58
|
-
makesOffer: [
|
|
59
|
-
{
|
|
60
|
-
typeOf: client.factory.offerType.Offer,
|
|
61
|
-
availableAtOrFrom: { id: AVAILABLE_AT_OR_FROM_ID }, // <-販売アプリケーションIDを指定する
|
|
62
|
-
availabilityStarts: moment(`${today}T00:00:00+09:00`)
|
|
63
|
-
.toDate(),
|
|
64
|
-
availabilityEnds: moment(`${today}T14:00:00Z`)
|
|
65
|
-
.toDate(),
|
|
66
|
-
validFrom: moment(`${today}T00:00:00+09:00`)
|
|
67
|
-
.toDate(),
|
|
68
|
-
validThrough: moment(`${today}T14:00:00Z`)
|
|
69
|
-
.toDate()
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
// makesOfferDefaultを指定するとmakesOfferよりも優先される
|
|
73
|
-
// makesOfferDefault: {
|
|
74
|
-
// typeOf: client.factory.offerType.Offer,
|
|
75
|
-
// availabilityStarts: moment('2024-05-11T00:00:00.000Z')
|
|
76
|
-
// .toDate(),
|
|
77
|
-
// availabilityEnds: moment('2024-05-12T00:00:00.000Z')
|
|
78
|
-
// .toDate(),
|
|
79
|
-
// validFrom: moment('2024-05-11T00:00:00.000Z')
|
|
80
|
-
// .toDate(),
|
|
81
|
-
// validThrough: moment('2024-05-12T00:00:00.000Z')
|
|
82
|
-
// .toDate()
|
|
83
|
-
// }
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
],
|
|
88
|
-
{
|
|
89
|
-
locationBranchCode: '10',
|
|
90
|
-
superEventId: '7k9ayl8hc',
|
|
91
|
-
hasTicketedSeat: true,
|
|
92
|
-
typeOf: client.factory.eventType.ScreeningEvent,
|
|
93
|
-
disableOverwriteMakesOffer: true,
|
|
94
|
-
useExtensibleOffer: false
|
|
95
|
-
}
|
|
96
|
-
);
|
|
97
|
-
console.log('created.');
|
|
98
|
-
|
|
99
|
-
await eventService.updateEventsByIdentifier(
|
|
100
|
-
[
|
|
101
|
-
{
|
|
102
|
-
identifier,
|
|
103
|
-
doorTime: moment(`${today}T13:00:00Z`)
|
|
104
|
-
.toDate(),
|
|
105
|
-
startDate: moment(`${today}T13:00:00Z`)
|
|
106
|
-
.toDate(),
|
|
107
|
-
endDate: moment(`${today}T14:00:00Z`)
|
|
108
|
-
.toDate(),
|
|
109
|
-
eventStatus: client.factory.eventStatusType.EventScheduled,
|
|
110
|
-
additionalProperty: [
|
|
111
|
-
{ name: ADDITIONAL_PROPERTY_NAME, value: identifier }
|
|
112
|
-
],
|
|
113
|
-
maximumPhysicalAttendeeCapacity: 3,
|
|
114
|
-
offers: {
|
|
115
|
-
unacceptedPaymentMethod: [],
|
|
116
|
-
eligibleQuantity: {
|
|
117
|
-
maxValue: 6
|
|
118
|
-
},
|
|
119
|
-
itemOffered: {
|
|
120
|
-
id: EVENT_SERVICE_ID
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
],
|
|
125
|
-
{
|
|
126
|
-
typeOf: client.factory.eventType.ScreeningEvent,
|
|
127
|
-
disableOverwriteMakesOffer: false
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
console.log('updated.');
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
main()
|
|
135
|
-
.then(() => {
|
|
136
|
-
console.log('success!');
|
|
137
|
-
})
|
|
138
|
-
.catch(console.error);
|