@cinerino/sdk 5.18.0-alpha.13 → 5.18.0-alpha.15
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/playground/public/lib/bundle.js +68 -21
- package/example/src/chevre/searchMessages.ts +34 -0
- package/example/src/transaction/processPlaceOrderCOAEventByCreditCard.ts +279 -0
- package/lib/abstract/chevreAdmin/comment.d.ts +1 -1
- package/lib/abstract/chevreAdmin/message.d.ts +60 -0
- package/lib/abstract/chevreAdmin/message.js +83 -0
- package/lib/abstract/chevreAdmin.d.ts +9 -0
- package/lib/abstract/chevreAdmin.js +20 -0
- package/lib/abstract/chevreTxn/transaction/placeOrder/factory.d.ts +3 -5
- package/lib/abstract/cinerino/admin/event.d.ts +5 -1
- package/lib/abstract/cinerino/service/transaction/placeOrder4sskts.d.ts +3 -20
- package/lib/bundle.js +396 -291
- package/package.json +2 -2
|
@@ -16423,17 +16423,6 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
16423
16423
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
16424
16424
|
};
|
|
16425
16425
|
})();
|
|
16426
|
-
var __assign = (this && this.__assign) || function () {
|
|
16427
|
-
__assign = Object.assign || function(t) {
|
|
16428
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
16429
|
-
s = arguments[i];
|
|
16430
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
16431
|
-
t[p] = s[p];
|
|
16432
|
-
}
|
|
16433
|
-
return t;
|
|
16434
|
-
};
|
|
16435
|
-
return __assign.apply(this, arguments);
|
|
16436
|
-
};
|
|
16437
16426
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
16438
16427
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16439
16428
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -16522,21 +16511,50 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
16522
16511
|
/**
|
|
16523
16512
|
* クレジットカード決済承認
|
|
16524
16513
|
*/
|
|
16525
|
-
PaymentService.prototype.authorizeCreditCard = function (params
|
|
16514
|
+
PaymentService.prototype.authorizeCreditCard = function (params) {
|
|
16526
16515
|
return __awaiter(this, void 0, void 0, function () {
|
|
16516
|
+
var object, purpose;
|
|
16527
16517
|
var _this = this;
|
|
16528
16518
|
return __generator(this, function (_a) {
|
|
16519
|
+
object = params.object, purpose = params.purpose;
|
|
16529
16520
|
return [2 /*return*/, this.fetch({
|
|
16530
16521
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/authorize",
|
|
16531
16522
|
method: 'POST',
|
|
16532
|
-
expectedStatusCodes: [http_status_1.
|
|
16523
|
+
expectedStatusCodes: [http_status_1.CREATED],
|
|
16533
16524
|
// retry 429(2024-04-01~)
|
|
16534
16525
|
// retry 409(2024-04-01~)
|
|
16535
16526
|
// retry 504(2024-04-03~)
|
|
16536
16527
|
retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.GATEWAY_TIMEOUT, http_status_1.TOO_MANY_REQUESTS],
|
|
16537
|
-
body:
|
|
16538
|
-
qs:
|
|
16539
|
-
|
|
16528
|
+
body: { object: object, purpose: purpose },
|
|
16529
|
+
qs: {
|
|
16530
|
+
purpose: { id: params.purpose.id } // 追加(2024-04-03~)
|
|
16531
|
+
}
|
|
16532
|
+
})
|
|
16533
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
16534
|
+
return [2 /*return*/, response.json()];
|
|
16535
|
+
}); }); })];
|
|
16536
|
+
});
|
|
16537
|
+
});
|
|
16538
|
+
};
|
|
16539
|
+
/**
|
|
16540
|
+
* クレジットカード決済承認(非同期)
|
|
16541
|
+
*/
|
|
16542
|
+
PaymentService.prototype.authorizeCreditCardAsync = function (params) {
|
|
16543
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16544
|
+
var object, purpose;
|
|
16545
|
+
var _this = this;
|
|
16546
|
+
return __generator(this, function (_a) {
|
|
16547
|
+
object = params.object, purpose = params.purpose;
|
|
16548
|
+
return [2 /*return*/, this.fetch({
|
|
16549
|
+
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.CreditCard + "/authorize",
|
|
16550
|
+
method: 'POST',
|
|
16551
|
+
expectedStatusCodes: [http_status_1.ACCEPTED],
|
|
16552
|
+
retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.TOO_MANY_REQUESTS],
|
|
16553
|
+
body: { object: object, purpose: purpose },
|
|
16554
|
+
qs: {
|
|
16555
|
+
async: true,
|
|
16556
|
+
purpose: { id: params.purpose.id } // 追加(2024-04-03~)
|
|
16557
|
+
}
|
|
16540
16558
|
})
|
|
16541
16559
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
16542
16560
|
return [2 /*return*/, response.json()];
|
|
@@ -16547,20 +16565,49 @@ var PaymentService = /** @class */ (function (_super) {
|
|
|
16547
16565
|
/**
|
|
16548
16566
|
* MovieTicket決済承認
|
|
16549
16567
|
*/
|
|
16550
|
-
PaymentService.prototype.authorizeMovieTicket = function (params
|
|
16568
|
+
PaymentService.prototype.authorizeMovieTicket = function (params) {
|
|
16551
16569
|
return __awaiter(this, void 0, void 0, function () {
|
|
16570
|
+
var object, purpose;
|
|
16552
16571
|
var _this = this;
|
|
16553
16572
|
return __generator(this, function (_a) {
|
|
16573
|
+
object = params.object, purpose = params.purpose;
|
|
16554
16574
|
return [2 /*return*/, this.fetch({
|
|
16555
16575
|
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/authorize",
|
|
16556
16576
|
method: 'POST',
|
|
16557
|
-
expectedStatusCodes: [http_status_1.
|
|
16577
|
+
expectedStatusCodes: [http_status_1.CREATED],
|
|
16558
16578
|
// retry 429(2024-04-01~)
|
|
16559
16579
|
// retry 409(2024-04-01~)
|
|
16560
16580
|
retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.TOO_MANY_REQUESTS],
|
|
16561
|
-
body:
|
|
16562
|
-
qs:
|
|
16563
|
-
|
|
16581
|
+
body: { object: object, purpose: purpose },
|
|
16582
|
+
qs: {
|
|
16583
|
+
purpose: { id: params.purpose.id } // 追加(2024-04-03~)
|
|
16584
|
+
}
|
|
16585
|
+
})
|
|
16586
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
16587
|
+
return [2 /*return*/, response.json()];
|
|
16588
|
+
}); }); })];
|
|
16589
|
+
});
|
|
16590
|
+
});
|
|
16591
|
+
};
|
|
16592
|
+
/**
|
|
16593
|
+
* MovieTicket決済承認(非同期)
|
|
16594
|
+
*/
|
|
16595
|
+
PaymentService.prototype.authorizeMovieTicketAsync = function (params) {
|
|
16596
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
16597
|
+
var object, purpose;
|
|
16598
|
+
var _this = this;
|
|
16599
|
+
return __generator(this, function (_a) {
|
|
16600
|
+
object = params.object, purpose = params.purpose;
|
|
16601
|
+
return [2 /*return*/, this.fetch({
|
|
16602
|
+
uri: "/payment/" + factory.service.paymentService.PaymentServiceType.MovieTicket + "/authorize",
|
|
16603
|
+
method: 'POST',
|
|
16604
|
+
expectedStatusCodes: [http_status_1.ACCEPTED],
|
|
16605
|
+
retryableStatusCodes: [http_status_1.CONFLICT, http_status_1.TOO_MANY_REQUESTS],
|
|
16606
|
+
body: { object: object, purpose: purpose },
|
|
16607
|
+
qs: {
|
|
16608
|
+
async: true,
|
|
16609
|
+
purpose: { id: params.purpose.id }
|
|
16610
|
+
}
|
|
16564
16611
|
})
|
|
16565
16612
|
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
16566
16613
|
return [2 /*return*/, response.json()];
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// tslint:disable:no-console
|
|
2
|
+
import { loadChevreAdmin } from '../../../lib/index';
|
|
3
|
+
import * as auth from '../auth/authAsAdmin';
|
|
4
|
+
|
|
5
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
6
|
+
|
|
7
|
+
async function main() {
|
|
8
|
+
const authClient = await auth.login();
|
|
9
|
+
await authClient.refreshAccessToken();
|
|
10
|
+
const loginTicket = authClient.verifyIdToken({});
|
|
11
|
+
console.log('username is', loginTicket.getUsername());
|
|
12
|
+
|
|
13
|
+
const messageService = await (await loadChevreAdmin({
|
|
14
|
+
endpoint: <string>process.env.CHEVRE_ENDPOINT,
|
|
15
|
+
auth: authClient
|
|
16
|
+
})).createMessageInstance({
|
|
17
|
+
project,
|
|
18
|
+
seller: { id: '' }
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
const messages = await messageService.search({
|
|
22
|
+
mainEntity: { orderNumber: { $eq: 'CIN3-0703394-7833190' } },
|
|
23
|
+
inclusion: [],
|
|
24
|
+
exclusion: ['text']
|
|
25
|
+
});
|
|
26
|
+
console.log(messages);
|
|
27
|
+
console.log(messages.length, 'messages found');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
main()
|
|
31
|
+
.then(() => {
|
|
32
|
+
console.log('success!');
|
|
33
|
+
})
|
|
34
|
+
.catch(console.error);
|
|
@@ -0,0 +1,279 @@
|
|
|
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
|
+
// import * as auth from '../authAsAdmin';
|
|
6
|
+
|
|
7
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
8
|
+
|
|
9
|
+
const profile = {
|
|
10
|
+
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
11
|
+
givenName: 'Taro',
|
|
12
|
+
familyName: 'SDK',
|
|
13
|
+
name: 'Taro ☆ SDK',
|
|
14
|
+
telephone: '+819012345678'
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// 取引に使用するクレジットカードを決定する
|
|
18
|
+
const creditCard = {
|
|
19
|
+
cardNo: '4111111111111111',
|
|
20
|
+
expire: '2412',
|
|
21
|
+
holderName: 'AA BB'
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// tslint:disable-next-line:max-func-body-length
|
|
25
|
+
async function main() {
|
|
26
|
+
const eventService = new (await client.loadService()).Event({
|
|
27
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
28
|
+
auth: await auth(),
|
|
29
|
+
project,
|
|
30
|
+
seller: { id: '' }
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const sellerService = new (await client.loadService()).Seller({
|
|
34
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
35
|
+
auth: await auth(),
|
|
36
|
+
project
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const placeOrderService = new (await client.loadService()).txn.PlaceOrder({
|
|
40
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
41
|
+
auth: await auth(),
|
|
42
|
+
project,
|
|
43
|
+
seller: { id: '' }
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const paymentService = await (await client.loadPay({
|
|
47
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
48
|
+
auth: await auth()
|
|
49
|
+
})).createPaymentInstance({
|
|
50
|
+
project,
|
|
51
|
+
seller: { id: '' }
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
// 販売劇場検索
|
|
55
|
+
const searchSellersResult = await sellerService.search({ branchCode: { $eq: '120' } });
|
|
56
|
+
// tslint:disable-next-line:insecure-random
|
|
57
|
+
const seller = searchSellersResult.data[Math.floor(searchSellersResult.data.length * Math.random())];
|
|
58
|
+
if (seller === undefined) {
|
|
59
|
+
throw new Error('No seller');
|
|
60
|
+
}
|
|
61
|
+
console.log('ordering from seller...', (<client.factory.multilingualString>seller.name).ja);
|
|
62
|
+
|
|
63
|
+
// イベント検索
|
|
64
|
+
const searchScreeningEventsResult = await eventService.search<client.factory.eventType.ScreeningEvent>({
|
|
65
|
+
typeOf: client.factory.eventType.ScreeningEvent,
|
|
66
|
+
inSessionFrom: moment()
|
|
67
|
+
.toDate(),
|
|
68
|
+
inSessionThrough: moment()
|
|
69
|
+
.add(2, 'days')
|
|
70
|
+
.toDate(),
|
|
71
|
+
superEvent: {
|
|
72
|
+
locationBranchCodes: [seller.branchCode],
|
|
73
|
+
workPerformedIdentifiers: ['16221']
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
console.log(searchScreeningEventsResult.data.length, 'events found');
|
|
77
|
+
|
|
78
|
+
const availableEvents = searchScreeningEventsResult.data;
|
|
79
|
+
if (availableEvents.length === 0) {
|
|
80
|
+
throw new Error('No available events');
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// WAITER許可証
|
|
84
|
+
// const passportToken = await request.post(
|
|
85
|
+
// `${process.env.WAITER_ENDPOINT}/passports`,
|
|
86
|
+
// {
|
|
87
|
+
// body: {
|
|
88
|
+
// scope: `Transaction:PlaceOrder:${seller.id}`
|
|
89
|
+
// },
|
|
90
|
+
// json: true
|
|
91
|
+
// }
|
|
92
|
+
// ).then((body) => body.token).catch((err) => {
|
|
93
|
+
// throw new Error(err.message);
|
|
94
|
+
// });
|
|
95
|
+
// console.log('passportToken published', passportToken);
|
|
96
|
+
|
|
97
|
+
console.log('starting transaction...');
|
|
98
|
+
const transaction = await placeOrderService.start({
|
|
99
|
+
agent: {},
|
|
100
|
+
seller: {
|
|
101
|
+
id: String(seller.id)
|
|
102
|
+
},
|
|
103
|
+
object: {
|
|
104
|
+
// passport: { token: passportToken }
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
console.log('transaction started', transaction.id);
|
|
108
|
+
|
|
109
|
+
// 購入者情報入力時間
|
|
110
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
111
|
+
await wait(5000);
|
|
112
|
+
|
|
113
|
+
console.log('setting customer profile...');
|
|
114
|
+
await placeOrderService.setProfile({
|
|
115
|
+
id: transaction.id,
|
|
116
|
+
agent: profile
|
|
117
|
+
});
|
|
118
|
+
console.log('customer profile set');
|
|
119
|
+
|
|
120
|
+
let amount = 0;
|
|
121
|
+
|
|
122
|
+
// イベント決定
|
|
123
|
+
// tslint:disable-next-line:insecure-random
|
|
124
|
+
const screeningEvent = availableEvents.find(({ coaInfo }) => coaInfo?.timeBegin === '0920');
|
|
125
|
+
if (screeningEvent === undefined) {
|
|
126
|
+
throw new Error('0920 screeningEvent not found');
|
|
127
|
+
}
|
|
128
|
+
console.log('screeningEvent fixed', screeningEvent.id, screeningEvent.startDate, screeningEvent.name);
|
|
129
|
+
|
|
130
|
+
const authorizeSeatReservationResult = await authorizeSeatReservationByEvent({
|
|
131
|
+
event: screeningEvent,
|
|
132
|
+
transaction: transaction
|
|
133
|
+
});
|
|
134
|
+
amount += Number(authorizeSeatReservationResult.price);
|
|
135
|
+
|
|
136
|
+
// 決済承認
|
|
137
|
+
console.log('authorizing credit card payment...');
|
|
138
|
+
const creditCardPaymentAuth = await paymentService.authorizeCreditCard({
|
|
139
|
+
object: {
|
|
140
|
+
amount: amount,
|
|
141
|
+
paymentMethod: 'CreditCard',
|
|
142
|
+
method: '1',
|
|
143
|
+
creditCard: creditCard,
|
|
144
|
+
issuedThrough: { id: '5f9a6986cc98a1eb13a90285' }
|
|
145
|
+
},
|
|
146
|
+
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
147
|
+
});
|
|
148
|
+
console.log('credit card payment authorized', creditCardPaymentAuth.id);
|
|
149
|
+
|
|
150
|
+
// 購入情報確認時間
|
|
151
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
152
|
+
await wait(5000);
|
|
153
|
+
|
|
154
|
+
// 取引を中止する場合はコチラ↓
|
|
155
|
+
// console.log('取引を中止します...');
|
|
156
|
+
// await placeOrderService.cancel({ transactionId: transaction.id });
|
|
157
|
+
// console.log('取引を中止しました。');
|
|
158
|
+
|
|
159
|
+
console.log('confirming transaction...');
|
|
160
|
+
const email = {
|
|
161
|
+
sender: {
|
|
162
|
+
name: `♥ ${(<client.factory.multilingualString>seller.name).ja} ♥`
|
|
163
|
+
// email?: string;
|
|
164
|
+
},
|
|
165
|
+
// toRecipient: {
|
|
166
|
+
// name: 'Another recipient',
|
|
167
|
+
// email: ''
|
|
168
|
+
// },
|
|
169
|
+
about: `♥♥♥ ${profile.name}さんへご注文商品が届いております ♥♥♥`,
|
|
170
|
+
template: `
|
|
171
|
+
| Order from samples
|
|
172
|
+
|
|
|
173
|
+
| [注文番号]
|
|
174
|
+
| #{order.orderNumber}
|
|
175
|
+
|
|
|
176
|
+
| [合計]
|
|
177
|
+
| ¥#{order.price}
|
|
178
|
+
`
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
let confirmResult = await placeOrderService.confirmWithMiminalResponse({
|
|
182
|
+
id: transaction.id,
|
|
183
|
+
potentialActions: {
|
|
184
|
+
order: {
|
|
185
|
+
potentialActions: {
|
|
186
|
+
sendOrder: {
|
|
187
|
+
potentialActions: {
|
|
188
|
+
sendEmailMessage: [
|
|
189
|
+
{
|
|
190
|
+
object: email
|
|
191
|
+
}
|
|
192
|
+
]
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
sendEmailMessage: true,
|
|
199
|
+
email: email
|
|
200
|
+
});
|
|
201
|
+
console.log('transaction confirmed', confirmResult.order.orderNumber);
|
|
202
|
+
|
|
203
|
+
// 何度確定をコールしても冪等
|
|
204
|
+
console.log('confirming transaction...');
|
|
205
|
+
confirmResult = await placeOrderService.confirmWithMiminalResponse({
|
|
206
|
+
id: transaction.id,
|
|
207
|
+
sendEmailMessage: true
|
|
208
|
+
});
|
|
209
|
+
console.log('transaction confirmed', confirmResult.order.orderNumber);
|
|
210
|
+
// 何度確定をコールしても冪等
|
|
211
|
+
console.log('confirming transaction...');
|
|
212
|
+
confirmResult = await placeOrderService.confirmWithMiminalResponse({
|
|
213
|
+
id: transaction.id,
|
|
214
|
+
sendEmailMessage: true
|
|
215
|
+
});
|
|
216
|
+
console.log('transaction confirmed', confirmResult.order.orderNumber);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
// tslint:disable-next-line:max-func-body-length
|
|
220
|
+
async function authorizeSeatReservationByEvent(params: {
|
|
221
|
+
event: client.factory.event.screeningEvent.IEvent;
|
|
222
|
+
transaction: Pick<client.factory.transaction.placeOrder.ITransaction, 'id'>;
|
|
223
|
+
}): Promise<{ price?: number }> {
|
|
224
|
+
const placeOrderService = new (await client.loadService()).txn.PlaceOrder4sskts({
|
|
225
|
+
endpoint: <string>process.env.API_ENDPOINT,
|
|
226
|
+
auth: await auth(),
|
|
227
|
+
project,
|
|
228
|
+
seller: { id: '' }
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
const screeningEvent = params.event;
|
|
232
|
+
const transaction = params.transaction;
|
|
233
|
+
|
|
234
|
+
await wait(5000);
|
|
235
|
+
console.log('authorizing seat reservation...');
|
|
236
|
+
const seatReservationAuth = await placeOrderService.createSeatReservationAuthorization({
|
|
237
|
+
object: {
|
|
238
|
+
event: {
|
|
239
|
+
id: screeningEvent.id
|
|
240
|
+
},
|
|
241
|
+
acceptedOffer: [
|
|
242
|
+
{
|
|
243
|
+
seatSection: ' ',
|
|
244
|
+
seatNumber: 'b-34',
|
|
245
|
+
ticketInfo: {
|
|
246
|
+
ticketCode: '10',
|
|
247
|
+
mvtkAppPrice: 0,
|
|
248
|
+
ticketCount: 1,
|
|
249
|
+
addGlasses: 0,
|
|
250
|
+
kbnEisyahousiki: '00',
|
|
251
|
+
mvtkNum: '',
|
|
252
|
+
mvtkKbnDenshiken: '00',
|
|
253
|
+
mvtkKbnMaeuriken: '00',
|
|
254
|
+
mvtkKbnKensyu: '00',
|
|
255
|
+
mvtkSalesPrice: 0,
|
|
256
|
+
kbnMgtk: ''
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
]
|
|
260
|
+
},
|
|
261
|
+
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
262
|
+
});
|
|
263
|
+
console.log('seat reservation authorized', seatReservationAuth.result.responseBody.tmpReserveNum, seatReservationAuth);
|
|
264
|
+
|
|
265
|
+
const amount = seatReservationAuth.result.price;
|
|
266
|
+
console.log('金額は', amount);
|
|
267
|
+
|
|
268
|
+
return { price: amount };
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
async function wait(waitInMilliseconds: number) {
|
|
272
|
+
return new Promise((resolve) => setTimeout(resolve, waitInMilliseconds));
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
main()
|
|
276
|
+
.then(() => {
|
|
277
|
+
console.log('success!');
|
|
278
|
+
})
|
|
279
|
+
.catch(console.error);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
3
|
export interface ISendEmailMessage {
|
|
4
|
-
object: Pick<factory.action.transfer.send.message.email.
|
|
4
|
+
object: Pick<factory.action.transfer.send.message.email.IObjectAsEmailMessage, 'about' | 'text'> & {
|
|
5
5
|
sender?: {
|
|
6
6
|
name?: string;
|
|
7
7
|
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import * as factory from '../factory';
|
|
2
|
+
import { Service } from '../service';
|
|
3
|
+
declare type IEmailMessage = factory.creativeWork.message.email.ICreativeWork & {
|
|
4
|
+
datePublished: Date;
|
|
5
|
+
mainEntity: Pick<factory.order.ISimpleOrder, 'orderNumber' | 'typeOf'>;
|
|
6
|
+
project: {
|
|
7
|
+
id: string;
|
|
8
|
+
typeOf: factory.organizationType.Project;
|
|
9
|
+
};
|
|
10
|
+
provider: {
|
|
11
|
+
/**
|
|
12
|
+
* 販売者ID
|
|
13
|
+
*/
|
|
14
|
+
id: string;
|
|
15
|
+
typeOf: factory.organizationType.Corporation;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
interface ISearchConditions {
|
|
19
|
+
limit?: number;
|
|
20
|
+
page?: number;
|
|
21
|
+
sort?: {
|
|
22
|
+
datePublished?: factory.sortType;
|
|
23
|
+
};
|
|
24
|
+
project?: {
|
|
25
|
+
id?: {
|
|
26
|
+
$eq?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
provider?: {
|
|
30
|
+
id?: {
|
|
31
|
+
$eq?: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
mainEntity?: {
|
|
35
|
+
orderNumber?: {
|
|
36
|
+
$eq?: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
identifier?: {
|
|
40
|
+
$eq?: string;
|
|
41
|
+
};
|
|
42
|
+
about?: {
|
|
43
|
+
identifier?: {
|
|
44
|
+
$eq?: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
declare type IKeyOfProjection = keyof IEmailMessage | '_id';
|
|
49
|
+
/**
|
|
50
|
+
* メッセージサービス
|
|
51
|
+
*/
|
|
52
|
+
export declare class MessageService extends Service {
|
|
53
|
+
search(params: Omit<ISearchConditions, 'project'> & {
|
|
54
|
+
inclusion: IKeyOfProjection[];
|
|
55
|
+
exclusion: IKeyOfProjection[];
|
|
56
|
+
}): Promise<(IEmailMessage & {
|
|
57
|
+
id: string;
|
|
58
|
+
})[]>;
|
|
59
|
+
}
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,83 @@
|
|
|
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.MessageService = void 0;
|
|
55
|
+
var http_status_1 = require("http-status");
|
|
56
|
+
var service_1 = require("../service");
|
|
57
|
+
/**
|
|
58
|
+
* メッセージサービス
|
|
59
|
+
*/
|
|
60
|
+
var MessageService = /** @class */ (function (_super) {
|
|
61
|
+
__extends(MessageService, _super);
|
|
62
|
+
function MessageService() {
|
|
63
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
64
|
+
}
|
|
65
|
+
MessageService.prototype.search = function (params) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
67
|
+
var _this = this;
|
|
68
|
+
return __generator(this, function (_a) {
|
|
69
|
+
return [2 /*return*/, this.fetch({
|
|
70
|
+
uri: '/messages',
|
|
71
|
+
method: 'GET',
|
|
72
|
+
qs: params,
|
|
73
|
+
expectedStatusCodes: [http_status_1.OK]
|
|
74
|
+
})
|
|
75
|
+
.then(function (response) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
76
|
+
return [2 /*return*/, response.json()];
|
|
77
|
+
}); }); })];
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
return MessageService;
|
|
82
|
+
}(service_1.Service));
|
|
83
|
+
exports.MessageService = MessageService;
|
|
@@ -26,6 +26,7 @@ import type { EventService } from './chevreAdmin/event';
|
|
|
26
26
|
import type { IAMService } from './chevreAdmin/iam';
|
|
27
27
|
import type { MeService } from './chevreAdmin/me';
|
|
28
28
|
import type { MerchantReturnPolicyService } from './chevreAdmin/merchantReturnPolicy';
|
|
29
|
+
import type { MessageService } from './chevreAdmin/message';
|
|
29
30
|
import type { NoteService } from './chevreAdmin/note';
|
|
30
31
|
import type { OfferService } from './chevreAdmin/offer';
|
|
31
32
|
import type { OfferCatalogService } from './chevreAdmin/offerCatalog';
|
|
@@ -197,6 +198,13 @@ export declare namespace service {
|
|
|
197
198
|
namespace MerchantReturnPolicy {
|
|
198
199
|
let svc: typeof MerchantReturnPolicyService | undefined;
|
|
199
200
|
}
|
|
201
|
+
/**
|
|
202
|
+
* メッセージサービス
|
|
203
|
+
*/
|
|
204
|
+
type Message = MessageService;
|
|
205
|
+
namespace Message {
|
|
206
|
+
let svc: typeof MessageService | undefined;
|
|
207
|
+
}
|
|
200
208
|
/**
|
|
201
209
|
* メモサービス
|
|
202
210
|
*/
|
|
@@ -487,6 +495,7 @@ export declare class ChevreAdmin {
|
|
|
487
495
|
createIAMInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<IAMService>;
|
|
488
496
|
createMeInstance(): Promise<MeService>;
|
|
489
497
|
createMerchantReturnPolicyInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<MerchantReturnPolicyService>;
|
|
498
|
+
createMessageInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<MessageService>;
|
|
490
499
|
createNoteInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<NoteService>;
|
|
491
500
|
createOrderInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OrderService>;
|
|
492
501
|
createOwnershipInfoInstance(params: Pick<IOptions, 'project'> & Pick<IAdditionalOptions, 'seller'>): Promise<OwnershipInfoService>;
|
|
@@ -110,6 +110,9 @@ var service;
|
|
|
110
110
|
var MerchantReturnPolicy;
|
|
111
111
|
(function (MerchantReturnPolicy) {
|
|
112
112
|
})(MerchantReturnPolicy = service.MerchantReturnPolicy || (service.MerchantReturnPolicy = {}));
|
|
113
|
+
var Message;
|
|
114
|
+
(function (Message) {
|
|
115
|
+
})(Message = service.Message || (service.Message = {}));
|
|
113
116
|
var Note;
|
|
114
117
|
(function (Note) {
|
|
115
118
|
})(Note = service.Note || (service.Note = {}));
|
|
@@ -582,6 +585,23 @@ var ChevreAdmin = /** @class */ (function () {
|
|
|
582
585
|
});
|
|
583
586
|
});
|
|
584
587
|
};
|
|
588
|
+
ChevreAdmin.prototype.createMessageInstance = function (params) {
|
|
589
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
590
|
+
var _a;
|
|
591
|
+
return __generator(this, function (_b) {
|
|
592
|
+
switch (_b.label) {
|
|
593
|
+
case 0:
|
|
594
|
+
if (!(service.Message.svc === undefined)) return [3 /*break*/, 2];
|
|
595
|
+
_a = service.Message;
|
|
596
|
+
return [4 /*yield*/, Promise.resolve().then(function () { return require('./chevreAdmin/message'); })];
|
|
597
|
+
case 1:
|
|
598
|
+
_a.svc = (_b.sent()).MessageService;
|
|
599
|
+
_b.label = 2;
|
|
600
|
+
case 2: return [2 /*return*/, new service.Message.svc(__assign(__assign(__assign({}, this.options), params), { retryableStatusCodes: [] }))];
|
|
601
|
+
}
|
|
602
|
+
});
|
|
603
|
+
});
|
|
604
|
+
};
|
|
585
605
|
ChevreAdmin.prototype.createNoteInstance = function (params) {
|
|
586
606
|
return __awaiter(this, void 0, void 0, function () {
|
|
587
607
|
var _a;
|