@cinerino/sdk 13.1.0 → 13.2.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/default/findAcceptedPaymentMethods.ts +37 -0
- package/example/src/cloud/transaction/placeOrderUsingAcceptedPaymentMethod.ts +214 -0
- package/example/src/cloud/transaction/processPlaceOrderByCreditCard3DS.ts +27 -4
- package/lib/abstract/chevre/acceptedPaymentMethod.d.ts +23 -0
- package/lib/abstract/chevre/acceptedPaymentMethod.js +88 -0
- package/lib/abstract/chevre.d.ts +9 -0
- package/lib/abstract/chevre.js +20 -0
- package/lib/abstract/chevrePay/payment.d.ts +3 -0
- package/lib/abstract/cinerino/service/event.js +1 -4
- package/lib/abstract/cloud/pay/payment.d.ts +7 -1
- package/lib/abstract/cloud/search/acceptedPaymentMethod.d.ts +11 -0
- package/lib/abstract/cloud/search/acceptedPaymentMethod.js +89 -0
- package/lib/abstract/cloud/search.d.ts +12 -0
- package/lib/abstract/cloud/search.js +23 -0
- package/lib/bundle.js +891 -666
- package/package.json +2 -2
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// tslint:disable:no-implicit-dependencies no-console
|
|
2
|
+
import * as client from '../../../../lib/index';
|
|
3
|
+
|
|
4
|
+
const { PROJECT_ID } = process.env;
|
|
5
|
+
const SELLER_ID = '59d20831e53ebc2b4e774466';
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const authClient = await client.auth.ClientCredentials.createInstance({
|
|
9
|
+
domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
|
|
10
|
+
clientId: <string>process.env.CHEVRE_CLIENT_ID,
|
|
11
|
+
clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
|
|
12
|
+
scopes: [],
|
|
13
|
+
state: ''
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const acceptedPaymentMethodService = await (await client.loadChevre({
|
|
17
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
18
|
+
auth: authClient
|
|
19
|
+
})).createAcceptedPaymentMethodInstance({
|
|
20
|
+
project: { id: String(PROJECT_ID) },
|
|
21
|
+
seller: { id: SELLER_ID }
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const result = await acceptedPaymentMethodService.findAcceptedPaymentMethods({
|
|
25
|
+
page: 1,
|
|
26
|
+
limit: 10,
|
|
27
|
+
itemOfferedId: 'fmj6ojobe'
|
|
28
|
+
});
|
|
29
|
+
// tslint:disable-next-line:no-null-keyword
|
|
30
|
+
console.dir(result, { depth: null });
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
main()
|
|
34
|
+
.then(() => {
|
|
35
|
+
console.log('success!');
|
|
36
|
+
})
|
|
37
|
+
.catch(console.error);
|
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
import { auth } from '../../auth/clientCredentials';
|
|
5
|
+
|
|
6
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
7
|
+
const { EVENT_ID } = process.env;
|
|
8
|
+
const paymentMethodType = 'CreditCard';
|
|
9
|
+
/**
|
|
10
|
+
* 決済サービスID
|
|
11
|
+
*/
|
|
12
|
+
const paymentServiceId = '5f9a4fed4f3709000abe6415';
|
|
13
|
+
// 取引に使用するクレジットカード
|
|
14
|
+
const creditCard: client.factory.paymentMethod.paymentCard.creditCard.IUncheckedCardRaw = {
|
|
15
|
+
cardNo: '4100000000000100',
|
|
16
|
+
// cardNo: '4111111111111111',
|
|
17
|
+
expire: '2812',
|
|
18
|
+
cardPass: '123',
|
|
19
|
+
holderName: 'AA AA'
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ISellerMakesOffer = Omit<client.factory.event.screeningEvent.ISellerMakesOffer, 'availableAtOrFrom'> & {
|
|
23
|
+
availableAtOrFrom?: client.factory.event.screeningEvent.IOfferAvailableAtOrFrom
|
|
24
|
+
| client.factory.event.screeningEvent.IOfferAvailableAtOrFrom[];
|
|
25
|
+
};
|
|
26
|
+
type ISeller = Omit<client.factory.event.screeningEvent.ISeller, 'makesOffer'> & {
|
|
27
|
+
makesOffer: ISellerMakesOffer[];
|
|
28
|
+
};
|
|
29
|
+
type IScreeningEventOffer = Omit<client.factory.event.screeningEvent.IOffer, 'seller'> & {
|
|
30
|
+
seller: ISeller;
|
|
31
|
+
};
|
|
32
|
+
type IScreeningEventExtensibleOffer = Omit<client.factory.event.screeningEvent.IExtensibleEventOffer, 'seller'> & {
|
|
33
|
+
seller: ISeller;
|
|
34
|
+
};
|
|
35
|
+
type IEvent = Omit<client.factory.event.screeningEvent.IEvent, 'offers'> & {
|
|
36
|
+
offers?: IScreeningEventOffer | IScreeningEventExtensibleOffer;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// tslint:disable-next-line:max-func-body-length
|
|
40
|
+
async function main() {
|
|
41
|
+
const eventService = new (await client.loadService()).Event({
|
|
42
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
43
|
+
auth: await auth(),
|
|
44
|
+
project,
|
|
45
|
+
seller: { id: '' }
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const sellerService = new (await client.loadService()).Seller({
|
|
49
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
50
|
+
auth: await auth(),
|
|
51
|
+
project
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const placeOrderService = await (await client.loadCloudTxn({
|
|
55
|
+
endpoint: <string>process.env.API_TXN_ENDPOINT,
|
|
56
|
+
auth: await auth()
|
|
57
|
+
})).createPlaceOrderInstance({
|
|
58
|
+
project,
|
|
59
|
+
seller: { id: '' }
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// 新しい決済サービス
|
|
63
|
+
const paymentService = await (await client.loadCloudPay({
|
|
64
|
+
endpoint: <string>process.env.API_PAY_ENDPOINT,
|
|
65
|
+
auth: await auth(),
|
|
66
|
+
disableAutoRetry: true
|
|
67
|
+
})).createPaymentInstance({
|
|
68
|
+
project,
|
|
69
|
+
seller: { id: '' }
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// 販売劇場検索
|
|
73
|
+
const searchSellersResult = await sellerService.search({ branchCode: { $eq: '001' } });
|
|
74
|
+
// tslint:disable-next-line:insecure-random
|
|
75
|
+
const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
|
|
76
|
+
if (seller === undefined) {
|
|
77
|
+
throw new Error('No seller');
|
|
78
|
+
}
|
|
79
|
+
console.log('ordering from seller...', (<client.factory.multilingualString>seller.name).ja);
|
|
80
|
+
|
|
81
|
+
// イベント検索
|
|
82
|
+
const searchScreeningEventsResult = await eventService.search({
|
|
83
|
+
typeOf: client.factory.eventType.ScreeningEvent,
|
|
84
|
+
inSessionFrom: moment()
|
|
85
|
+
.toDate(),
|
|
86
|
+
inSessionThrough: moment()
|
|
87
|
+
.add(1, 'week')
|
|
88
|
+
.toDate(),
|
|
89
|
+
eventStatuses: [client.factory.eventStatusType.EventScheduled],
|
|
90
|
+
...(typeof EVENT_ID === 'string') ? { id: { $eq: EVENT_ID } } : undefined
|
|
91
|
+
});
|
|
92
|
+
console.log(searchScreeningEventsResult.data.length, 'events found');
|
|
93
|
+
|
|
94
|
+
const availableEvents = <IEvent[]>searchScreeningEventsResult.data;
|
|
95
|
+
if (availableEvents.length === 0) {
|
|
96
|
+
throw new Error('No available events');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
console.log('starting transaction...');
|
|
100
|
+
const transaction = await placeOrderService.start({
|
|
101
|
+
agent: {
|
|
102
|
+
identifier: [
|
|
103
|
+
{ name: 'fromSamples', value: 'true' }
|
|
104
|
+
]
|
|
105
|
+
},
|
|
106
|
+
seller: { id: String(seller.id) },
|
|
107
|
+
object: {
|
|
108
|
+
// passport: { token: passportToken }
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
console.log('transaction started', transaction.id);
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
const amount = 1000;
|
|
115
|
+
const eventIds: string[] = [];
|
|
116
|
+
/**
|
|
117
|
+
* 施設コンテンツの対応決済方法オファーIDリスト
|
|
118
|
+
*/
|
|
119
|
+
const acceptedPaymentMethodOfferIds: string[] = [];
|
|
120
|
+
|
|
121
|
+
// イベント決定
|
|
122
|
+
// tslint:disable-next-line:insecure-random
|
|
123
|
+
const screeningEvent: IEvent = availableEvents[Math.floor(availableEvents.length * Math.random())];
|
|
124
|
+
|
|
125
|
+
// 施設コンテンツ参照
|
|
126
|
+
const eventSeries = (await eventService.searchEventSeries({
|
|
127
|
+
limit: 1,
|
|
128
|
+
page: 1,
|
|
129
|
+
typeOf: client.factory.eventType.ScreeningEventSeries,
|
|
130
|
+
id: { $eq: screeningEvent.superEvent.id }
|
|
131
|
+
})).shift();
|
|
132
|
+
if (eventSeries === undefined) {
|
|
133
|
+
throw new Error('eventSeries not found');
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
console.log('eventSeries.offers?.typeOf ', eventSeries.offers?.typeOf);
|
|
137
|
+
if (eventSeries.offers?.typeOf === client.factory.offerType.AggregateOffer) {
|
|
138
|
+
// 施設コンテンツが対応決済方法管理に依存している場合、対応決済方法オファーを参照
|
|
139
|
+
const acceptedPaymentMethodService = await (await client.loadCloudSearch({
|
|
140
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
141
|
+
auth: await auth()
|
|
142
|
+
})).createAcceptedPaymentMethodInstance({
|
|
143
|
+
project,
|
|
144
|
+
seller: { id: String(seller.id) }
|
|
145
|
+
});
|
|
146
|
+
const acceptedPaymentMethods = await acceptedPaymentMethodService.findAcceptedPaymentMethods({
|
|
147
|
+
limit: 10,
|
|
148
|
+
page: 1,
|
|
149
|
+
itemOfferedId: eventSeries.id
|
|
150
|
+
});
|
|
151
|
+
console.log(acceptedPaymentMethods.length, 'acceptedPaymentMethods found.');
|
|
152
|
+
const now = new Date();
|
|
153
|
+
const validAcceptedPaymentMethodOffer = acceptedPaymentMethods.find((acceptedPaymentMethod) => {
|
|
154
|
+
return acceptedPaymentMethod.acceptedPaymentMethod.id === paymentServiceId // 指定の決済サービスに対して
|
|
155
|
+
&& moment(acceptedPaymentMethod.validFrom)
|
|
156
|
+
.isSameOrBefore(now) // 有効期間中の
|
|
157
|
+
&& moment(acceptedPaymentMethod.validThrough)
|
|
158
|
+
.isSameOrAfter(now); // 有効期間中の
|
|
159
|
+
});
|
|
160
|
+
if (validAcceptedPaymentMethodOffer === undefined) {
|
|
161
|
+
throw new Error('有効な対応決済方法オファーが見つかりません');
|
|
162
|
+
}
|
|
163
|
+
console.log('有効な対応決済方法オファーが見つかりました', validAcceptedPaymentMethodOffer.id, validAcceptedPaymentMethodOffer.identifier);
|
|
164
|
+
acceptedPaymentMethodOfferIds.push(validAcceptedPaymentMethodOffer.id);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
eventIds.push(screeningEvent.id);
|
|
168
|
+
|
|
169
|
+
console.log('authorizing payment...');
|
|
170
|
+
const authorizePayTask = await paymentService.authorizeCreditCardAsync({
|
|
171
|
+
object: {
|
|
172
|
+
amount,
|
|
173
|
+
paymentMethod: paymentMethodType,
|
|
174
|
+
method: '1',
|
|
175
|
+
creditCard,
|
|
176
|
+
issuedThrough: { id: paymentServiceId },
|
|
177
|
+
// ticketToken,
|
|
178
|
+
eventIdsAsOrderedItem: eventIds
|
|
179
|
+
},
|
|
180
|
+
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
181
|
+
instrumentOptions: {
|
|
182
|
+
acceptedPaymentMethodOfferIds // 有効な対応決済方法オファーを明示的に指定する
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
// const creditCardPaymentAuth = await authorizeCreditCardAsyncForcibly()({ paymentService });
|
|
186
|
+
console.log('authorize pay task created.', authorizePayTask.id);
|
|
187
|
+
|
|
188
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
189
|
+
await wait(3000);
|
|
190
|
+
|
|
191
|
+
console.log('canceling transaction...');
|
|
192
|
+
await placeOrderService.cancel({ id: transaction.id });
|
|
193
|
+
console.log('transaction canceled.');
|
|
194
|
+
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.error(error);
|
|
197
|
+
|
|
198
|
+
await wait(3000);
|
|
199
|
+
|
|
200
|
+
console.log('canceling transaction...');
|
|
201
|
+
await placeOrderService.cancel({ id: transaction.id });
|
|
202
|
+
console.log('transaction canceled.');
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
async function wait(waitInMilliseconds: number) {
|
|
207
|
+
return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
main()
|
|
211
|
+
.then(() => {
|
|
212
|
+
console.log('success!');
|
|
213
|
+
})
|
|
214
|
+
.catch(console.error);
|
|
@@ -134,9 +134,7 @@ async function main() {
|
|
|
134
134
|
/**
|
|
135
135
|
* 施設コンテンツの対応決済方法オファーIDリスト
|
|
136
136
|
*/
|
|
137
|
-
const acceptedPaymentMethodOfferIds: string[] = [
|
|
138
|
-
'698eae442b3b10551e54fedf'
|
|
139
|
-
];
|
|
137
|
+
const acceptedPaymentMethodOfferIds: string[] = [];
|
|
140
138
|
|
|
141
139
|
// tslint:disable-next-line:no-increment-decrement
|
|
142
140
|
for (let i = 0; i < numEvents; i++) {
|
|
@@ -158,7 +156,32 @@ async function main() {
|
|
|
158
156
|
console.log('eventSeries.offers?.typeOf ', eventSeries.offers?.typeOf);
|
|
159
157
|
if (eventSeries.offers?.typeOf === client.factory.offerType.AggregateOffer) {
|
|
160
158
|
// 施設コンテンツが対応決済方法管理に依存している場合、対応決済方法オファーを参照
|
|
161
|
-
|
|
159
|
+
const acceptedPaymentMethodService = await (await client.loadCloudSearch({
|
|
160
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
161
|
+
auth: await auth()
|
|
162
|
+
})).createAcceptedPaymentMethodInstance({
|
|
163
|
+
project,
|
|
164
|
+
seller: { id: String(seller.id) }
|
|
165
|
+
});
|
|
166
|
+
const acceptedPaymentMethods = await acceptedPaymentMethodService.findAcceptedPaymentMethods({
|
|
167
|
+
limit: 10,
|
|
168
|
+
page: 1,
|
|
169
|
+
itemOfferedId: eventSeries.id
|
|
170
|
+
});
|
|
171
|
+
console.log(acceptedPaymentMethods.length, 'acceptedPaymentMethods found.');
|
|
172
|
+
const now = new Date();
|
|
173
|
+
const validAcceptedPaymentMethodOffer = acceptedPaymentMethods.find((acceptedPaymentMethod) => {
|
|
174
|
+
return acceptedPaymentMethod.acceptedPaymentMethod.id === paymentServiceId // 指定の決済サービスに対して
|
|
175
|
+
&& moment(acceptedPaymentMethod.validFrom)
|
|
176
|
+
.isSameOrBefore(now) // 有効期間中の
|
|
177
|
+
&& moment(acceptedPaymentMethod.validThrough)
|
|
178
|
+
.isSameOrAfter(now); // 有効期間中の
|
|
179
|
+
});
|
|
180
|
+
if (validAcceptedPaymentMethodOffer === undefined) {
|
|
181
|
+
throw new Error('有効な対応決済方法オファーが見つかりません');
|
|
182
|
+
}
|
|
183
|
+
console.log('有効な対応決済方法オファーが見つかりました', validAcceptedPaymentMethodOffer.id, validAcceptedPaymentMethodOffer.identifier);
|
|
184
|
+
acceptedPaymentMethodOfferIds.push(validAcceptedPaymentMethodOffer.id);
|
|
162
185
|
}
|
|
163
186
|
|
|
164
187
|
const authorizeSeatReservationResult = await authorizeSeatReservationByEvent({
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as factory from '../factory';
|
|
2
|
+
import { Service } from '../service';
|
|
3
|
+
export interface IFindParams {
|
|
4
|
+
/**
|
|
5
|
+
* max: 20
|
|
6
|
+
*/
|
|
7
|
+
limit: number;
|
|
8
|
+
page: number;
|
|
9
|
+
/**
|
|
10
|
+
* 提供リソースID
|
|
11
|
+
*/
|
|
12
|
+
itemOfferedId?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare type IAcceptedPaymentMethodAsFindResult = Pick<factory.acceptedPaymentMethodOffer.IAcceptedPaymentMethodOffer, 'id' | 'identifier' | 'itemOffered' | 'validFrom' | 'validThrough' | 'acceptedPaymentMethod'>;
|
|
15
|
+
/**
|
|
16
|
+
* 対応決済方法サービス
|
|
17
|
+
*/
|
|
18
|
+
export declare class AcceptedPaymentMethodService extends Service {
|
|
19
|
+
/**
|
|
20
|
+
* 対応決済方法検索
|
|
21
|
+
*/
|
|
22
|
+
findAcceptedPaymentMethods(params: IFindParams): Promise<IAcceptedPaymentMethodAsFindResult[]>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.AcceptedPaymentMethodService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../service");
|
|
57
|
+
var BASE_URI = '/acceptedPaymentMethods';
|
|
58
|
+
/**
|
|
59
|
+
* 対応決済方法サービス
|
|
60
|
+
*/
|
|
61
|
+
var AcceptedPaymentMethodService = /** @class */ (function (_super) {
|
|
62
|
+
__extends(AcceptedPaymentMethodService, _super);
|
|
63
|
+
function AcceptedPaymentMethodService() {
|
|
64
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 対応決済方法検索
|
|
68
|
+
*/
|
|
69
|
+
AcceptedPaymentMethodService.prototype.findAcceptedPaymentMethods = function (params) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var _this = this;
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
return [2 /*return*/, this.fetch({
|
|
74
|
+
uri: BASE_URI,
|
|
75
|
+
method: 'GET',
|
|
76
|
+
qs: params,
|
|
77
|
+
expectedStatusCodes: [http_status_1.OK],
|
|
78
|
+
stringifyOptions: { arrayFormat: 'repeat' }
|
|
79
|
+
})
|
|
80
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
81
|
+
return [2 /*return*/, response.json()];
|
|
82
|
+
}); }); })];
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
return AcceptedPaymentMethodService;
|
|
87
|
+
}(service_1.Service));
|
|
88
|
+
exports.AcceptedPaymentMethodService = AcceptedPaymentMethodService;
|
package/lib/abstract/chevre.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IAdditionalOptions, IOptions, IUnset as IUnsetOnService } from './service';
|
|
2
|
+
import type { AcceptedPaymentMethodService } from './chevre/acceptedPaymentMethod';
|
|
2
3
|
import type { CategoryCodeService } from './chevre/categoryCode';
|
|
3
4
|
import type { CreativeWorkService } from './chevre/creativeWork';
|
|
4
5
|
import type { EmailMessageService } from './chevre/emailMessage';
|
|
@@ -16,6 +17,13 @@ import type { SellerService } from './chevre/seller';
|
|
|
16
17
|
import type { TripService } from './chevre/trip';
|
|
17
18
|
export declare namespace service {
|
|
18
19
|
type IUnset = IUnsetOnService;
|
|
20
|
+
/**
|
|
21
|
+
* 対応決済方法サービス
|
|
22
|
+
*/
|
|
23
|
+
type AcceptedPaymentMethod = AcceptedPaymentMethodService;
|
|
24
|
+
namespace AcceptedPaymentMethod {
|
|
25
|
+
let svc: typeof AcceptedPaymentMethodService | undefined;
|
|
26
|
+
}
|
|
19
27
|
/**
|
|
20
28
|
* 区分サービス
|
|
21
29
|
*/
|
|
@@ -130,6 +138,7 @@ export declare namespace service {
|
|
|
130
138
|
export declare class Chevre {
|
|
131
139
|
options: Pick<IOptions, 'auth' | 'endpoint'>;
|
|
132
140
|
constructor(options: Pick<IOptions, 'auth' | 'endpoint'>);
|
|
141
|
+
createAcceptedPaymentMethodInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<AcceptedPaymentMethodService>;
|
|
133
142
|
createCategoryCodeInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CategoryCodeService>;
|
|
134
143
|
createCreativeWorkInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<CreativeWorkService>;
|
|
135
144
|
createEmailMessageInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<EmailMessageService>;
|
package/lib/abstract/chevre.js
CHANGED
|
@@ -50,6 +50,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
50
50
|
exports.Chevre = exports.service = void 0;
|
|
51
51
|
var service;
|
|
52
52
|
(function (service) {
|
|
53
|
+
var AcceptedPaymentMethod;
|
|
54
|
+
(function (AcceptedPaymentMethod) {
|
|
55
|
+
})(AcceptedPaymentMethod = service.AcceptedPaymentMethod || (service.AcceptedPaymentMethod = {}));
|
|
53
56
|
var CategoryCode;
|
|
54
57
|
(function (CategoryCode) {
|
|
55
58
|
})(CategoryCode = service.CategoryCode || (service.CategoryCode = {}));
|
|
@@ -106,6 +109,23 @@ var Chevre = /** @class */ (function () {
|
|
|
106
109
|
function Chevre(options) {
|
|
107
110
|
this.options = options;
|
|
108
111
|
}
|
|
112
|
+
Chevre.prototype.createAcceptedPaymentMethodInstance = function (params) {
|
|
113
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
114
|
+
var _a;
|
|
115
|
+
return __generator(this, function (_b) {
|
|
116
|
+
switch (_b.label) {
|
|
117
|
+
case 0:
|
|
118
|
+
if (!(service.AcceptedPaymentMethod.svc === undefined)) return [3 /*break*/, 2];
|
|
119
|
+
_a = service.AcceptedPaymentMethod;
|
|
120
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevre/acceptedPaymentMethod'); })];
|
|
121
|
+
case 1:
|
|
122
|
+
_a.svc = (_b.sent()).AcceptedPaymentMethodService;
|
|
123
|
+
_b.label = 2;
|
|
124
|
+
case 2: return [2 /*return*/, new service.AcceptedPaymentMethod.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
109
129
|
Chevre.prototype.createCategoryCodeInstance = function (params) {
|
|
110
130
|
return __awaiter(this, void 0, void 0, function () {
|
|
111
131
|
var _a;
|
|
@@ -40,6 +40,7 @@ export declare class PaymentService extends Service {
|
|
|
40
40
|
instrumentOptions: {
|
|
41
41
|
/**
|
|
42
42
|
* 対応決済方法オファーIDリスト
|
|
43
|
+
* 最大20件
|
|
43
44
|
*/
|
|
44
45
|
acceptedPaymentMethodOfferIds: string[];
|
|
45
46
|
};
|
|
@@ -55,6 +56,7 @@ export declare class PaymentService extends Service {
|
|
|
55
56
|
instrumentOptions: {
|
|
56
57
|
/**
|
|
57
58
|
* 対応決済方法オファーIDリスト
|
|
59
|
+
* 最大20件
|
|
58
60
|
*/
|
|
59
61
|
acceptedPaymentMethodOfferIds: string[];
|
|
60
62
|
};
|
|
@@ -82,6 +84,7 @@ export declare class PaymentService extends Service {
|
|
|
82
84
|
instrumentOptions: {
|
|
83
85
|
/**
|
|
84
86
|
* 対応決済方法オファーIDリスト
|
|
87
|
+
* 最大20件
|
|
85
88
|
*/
|
|
86
89
|
acceptedPaymentMethodOfferIds: string[];
|
|
87
90
|
};
|
|
@@ -240,10 +240,7 @@ var EventService = /** @class */ (function (_super) {
|
|
|
240
240
|
case 0: return [4 /*yield*/, response.json()];
|
|
241
241
|
case 1:
|
|
242
242
|
seatOffers = _b.sent();
|
|
243
|
-
return [2 /*return*/, {
|
|
244
|
-
data: seatOffers,
|
|
245
|
-
sectionCode: (_a = seatOffers[0].containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode
|
|
246
|
-
}];
|
|
243
|
+
return [2 /*return*/, __assign({ data: seatOffers }, (seatOffers.length > 0) ? { sectionCode: (_a = seatOffers[0].containedInPlace) === null || _a === void 0 ? void 0 : _a.branchCode } : undefined)];
|
|
247
244
|
}
|
|
248
245
|
});
|
|
249
246
|
}); })];
|
|
@@ -21,6 +21,7 @@ export declare class PaymentService extends Service {
|
|
|
21
21
|
instrumentOptions?: {
|
|
22
22
|
/**
|
|
23
23
|
* 対応決済方法オファーIDリスト
|
|
24
|
+
* 最大20件
|
|
24
25
|
*/
|
|
25
26
|
acceptedPaymentMethodOfferIds?: string[];
|
|
26
27
|
};
|
|
@@ -42,7 +43,11 @@ export declare class PaymentService extends Service {
|
|
|
42
43
|
object: IAuthorizeMovieTicketObject;
|
|
43
44
|
purpose: IPurpose;
|
|
44
45
|
instrumentOptions?: {
|
|
45
|
-
|
|
46
|
+
/**
|
|
47
|
+
* 対応決済方法オファーIDリスト
|
|
48
|
+
* 最大20件
|
|
49
|
+
*/
|
|
50
|
+
acceptedPaymentMethodOfferIds?: string[];
|
|
46
51
|
};
|
|
47
52
|
}, options: {
|
|
48
53
|
/**
|
|
@@ -69,6 +74,7 @@ export declare class PaymentService extends Service {
|
|
|
69
74
|
instrumentOptions?: {
|
|
70
75
|
/**
|
|
71
76
|
* 対応決済方法オファーIDリスト
|
|
77
|
+
* 最大20件
|
|
72
78
|
*/
|
|
73
79
|
acceptedPaymentMethodOfferIds?: string[];
|
|
74
80
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IAcceptedPaymentMethodAsFindResult, IFindParams } from '../../chevre/acceptedPaymentMethod';
|
|
2
|
+
import { Service } from '../../service';
|
|
3
|
+
/**
|
|
4
|
+
* 対応決済方法サービス
|
|
5
|
+
*/
|
|
6
|
+
export declare class AcceptedPaymentMethodService extends Service {
|
|
7
|
+
/**
|
|
8
|
+
* イベントとセクション指定で座席在庫検索
|
|
9
|
+
*/
|
|
10
|
+
findAcceptedPaymentMethods(params: IFindParams): Promise<IAcceptedPaymentMethodAsFindResult[]>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
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.AcceptedPaymentMethodService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../../service");
|
|
57
|
+
var BASE_URI = '/acceptedPaymentMethods';
|
|
58
|
+
/**
|
|
59
|
+
* 対応決済方法サービス
|
|
60
|
+
*/
|
|
61
|
+
var AcceptedPaymentMethodService = /** @class */ (function (_super) {
|
|
62
|
+
__extends(AcceptedPaymentMethodService, _super);
|
|
63
|
+
function AcceptedPaymentMethodService() {
|
|
64
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* イベントとセクション指定で座席在庫検索
|
|
68
|
+
*/
|
|
69
|
+
AcceptedPaymentMethodService.prototype.findAcceptedPaymentMethods = function (params) {
|
|
70
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
+
var limit, page, itemOfferedId;
|
|
72
|
+
var _this = this;
|
|
73
|
+
return __generator(this, function (_a) {
|
|
74
|
+
limit = params.limit, page = params.page, itemOfferedId = params.itemOfferedId;
|
|
75
|
+
return [2 /*return*/, this.fetch({
|
|
76
|
+
uri: BASE_URI,
|
|
77
|
+
method: 'GET',
|
|
78
|
+
qs: { limit: limit, page: page, itemOfferedId: itemOfferedId },
|
|
79
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
80
|
+
})
|
|
81
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
82
|
+
return [2 /*return*/, response.json()];
|
|
83
|
+
}); }); })];
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
return AcceptedPaymentMethodService;
|
|
88
|
+
}(service_1.Service));
|
|
89
|
+
exports.AcceptedPaymentMethodService = AcceptedPaymentMethodService;
|