@cinerino/sdk 7.0.0-alpha.0 → 7.0.0-alpha.10
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 +938 -379
- package/example/src/chevre/transaction/processPlaceOrderCOA.ts +397 -0
- package/lib/abstract/chevrePay/payment/factory.d.ts +20 -6
- package/lib/abstract/chevrePay/payment.d.ts +107 -4
- package/lib/abstract/chevrePay/payment.js +137 -3
- package/lib/abstract/chevrePay.d.ts +3 -3
- package/lib/abstract/chevrePay.js +6 -1
- package/lib/abstract/chevreTxc/offer.d.ts +104 -0
- package/lib/abstract/chevreTxc/offer.js +190 -0
- package/lib/abstract/chevreTxc.d.ts +20 -0
- package/lib/abstract/chevreTxc.js +83 -0
- package/lib/abstract/cloud/pay/payment.d.ts +30 -3
- package/lib/abstract/cloud/pay/payment.js +102 -36
- package/lib/abstract/cloud/pay.js +7 -0
- package/lib/abstract/index.d.ts +3 -1
- package/lib/abstract/index.js +24 -1
- package/lib/auth/oAuth2client.js +1 -0
- package/lib/bundle.js +946 -387
- package/lib/index.d.ts +2 -2
- package/lib/index.js +2 -1
- package/package.json +2 -2
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// tslint:disable:no-console no-implicit-dependencies no-magic-numbers
|
|
2
|
+
import * as moment from 'moment';
|
|
3
|
+
import * as client from '../../../../lib/index';
|
|
4
|
+
|
|
5
|
+
const project = { id: String(process.env.PROJECT_ID) };
|
|
6
|
+
const creditCard = {
|
|
7
|
+
cardNo: '4111111111111111',
|
|
8
|
+
expire: '2612',
|
|
9
|
+
holderName: 'AA BB'
|
|
10
|
+
};
|
|
11
|
+
const profile = {
|
|
12
|
+
email: <string>process.env.TEST_PROFILE_EMAIL,
|
|
13
|
+
givenName: 'Taro',
|
|
14
|
+
familyName: 'SDK',
|
|
15
|
+
name: 'Taro ☆ SDK',
|
|
16
|
+
telephone: '+819012345678'
|
|
17
|
+
};
|
|
18
|
+
const ASYNC_ACTION_GIVEUP_SEC = 10;
|
|
19
|
+
const ASYNC_ACTION_CHECK_INTERVAL_MS = 1000;
|
|
20
|
+
const SELLER_ID = '5d0abf30ac3fb200198ebb2c';
|
|
21
|
+
const EVENT_ID = '120162210202405271202250';
|
|
22
|
+
|
|
23
|
+
function authorizeOfferAsync(params: {
|
|
24
|
+
/**
|
|
25
|
+
* 承認アクションID
|
|
26
|
+
*/
|
|
27
|
+
originalAuthorizeAction?: string;
|
|
28
|
+
purpose: { id: string };
|
|
29
|
+
}) {
|
|
30
|
+
// tslint:disable-next-line:max-func-body-length
|
|
31
|
+
return async (repos: {
|
|
32
|
+
offerService: client.chevreTxc.service.Offer;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
/**
|
|
35
|
+
* 承認アクションID
|
|
36
|
+
*/
|
|
37
|
+
id: string;
|
|
38
|
+
result: {
|
|
39
|
+
price?: Number;
|
|
40
|
+
responseBody: { tmpReserveNum: string };
|
|
41
|
+
};
|
|
42
|
+
}> => {
|
|
43
|
+
console.log('creating accept task..,');
|
|
44
|
+
const acceptTask = await repos.offerService.acceptOffer(
|
|
45
|
+
{
|
|
46
|
+
object: {
|
|
47
|
+
event: { id: EVENT_ID },
|
|
48
|
+
acceptedOffer: [{
|
|
49
|
+
seatSection: ' ',
|
|
50
|
+
seatNumber: 'b-8',
|
|
51
|
+
ticketInfo: {
|
|
52
|
+
ticketCode: '171',
|
|
53
|
+
mvtkAppPrice: 0,
|
|
54
|
+
ticketCount: 1,
|
|
55
|
+
addGlasses: 0,
|
|
56
|
+
kbnEisyahousiki: '00',
|
|
57
|
+
mvtkNum: '',
|
|
58
|
+
mvtkKbnDenshiken: '00',
|
|
59
|
+
mvtkKbnMaeuriken: '00',
|
|
60
|
+
mvtkKbnKensyu: '00',
|
|
61
|
+
mvtkSalesPrice: 0,
|
|
62
|
+
kbnMgtk: ''
|
|
63
|
+
}
|
|
64
|
+
}],
|
|
65
|
+
appliesToSurfrock: {
|
|
66
|
+
identifier: '',
|
|
67
|
+
serviceOutput: { typeOf: '' }
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
purpose: { id: params.purpose.id, typeOf: client.factory.transactionType.PlaceOrder },
|
|
71
|
+
...(typeof params.originalAuthorizeAction === 'string')
|
|
72
|
+
? { potentialActions: { id: params.originalAuthorizeAction } }
|
|
73
|
+
: undefined
|
|
74
|
+
}
|
|
75
|
+
);
|
|
76
|
+
console.log('acceptTask created,', acceptTask);
|
|
77
|
+
|
|
78
|
+
const giveUpPayment = moment()
|
|
79
|
+
.add(ASYNC_ACTION_GIVEUP_SEC, 'seconds');
|
|
80
|
+
let result: { id: string } | undefined;
|
|
81
|
+
let error: any;
|
|
82
|
+
|
|
83
|
+
// n秒おきに状態確認
|
|
84
|
+
while (result === undefined && error === undefined) {
|
|
85
|
+
// n秒待機
|
|
86
|
+
await wait(ASYNC_ACTION_CHECK_INTERVAL_MS);
|
|
87
|
+
|
|
88
|
+
// タスク作成から一定時間経過すればあきらめる
|
|
89
|
+
if (moment()
|
|
90
|
+
.isAfter(giveUpPayment)) {
|
|
91
|
+
error = new Error('action gaven up');
|
|
92
|
+
break;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const acceptAction = await repos.offerService.findAcceptAction({
|
|
96
|
+
sameAs: { id: acceptTask.id },
|
|
97
|
+
purpose: { id: params.purpose.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
98
|
+
});
|
|
99
|
+
console.log('acceptAction:,', acceptAction);
|
|
100
|
+
|
|
101
|
+
if (typeof acceptAction.id === 'string') {
|
|
102
|
+
if (acceptAction.actionStatus === client.factory.actionStatusType.CompletedActionStatus) {
|
|
103
|
+
// ステータス完了であれば決済承認アクションIDを保管
|
|
104
|
+
result = { id: acceptAction.id };
|
|
105
|
+
break;
|
|
106
|
+
} else {
|
|
107
|
+
// 待機続行
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// エラーが存在すれば、これ以上待機する価値はなし
|
|
112
|
+
if (acceptAction.error !== undefined) {
|
|
113
|
+
error = acceptAction.error;
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
if (typeof result?.id === 'string') {
|
|
119
|
+
console.log('offer accepted.', result);
|
|
120
|
+
|
|
121
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
122
|
+
await wait(3000);
|
|
123
|
+
console.log('authorizing by acceptAction...', result.id);
|
|
124
|
+
|
|
125
|
+
return repos.offerService.authorizeEventServiceByCOA({
|
|
126
|
+
acceptAction: { id: result.id },
|
|
127
|
+
purpose: { id: params.purpose.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
throw error;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function voidAuthorizeOfferAsync(params: {
|
|
136
|
+
/**
|
|
137
|
+
* 承認アクションID
|
|
138
|
+
*/
|
|
139
|
+
originalAuthorizeAction: string;
|
|
140
|
+
purpose: { id: string };
|
|
141
|
+
}) {
|
|
142
|
+
return async (repos: {
|
|
143
|
+
offerService: client.chevreTxc.service.Offer;
|
|
144
|
+
}): Promise<void> => {
|
|
145
|
+
console.log('creating accept task..,');
|
|
146
|
+
const voidTask = await repos.offerService.voidAuthorizationByCOA(
|
|
147
|
+
{
|
|
148
|
+
id: params.originalAuthorizeAction,
|
|
149
|
+
purpose: { id: params.purpose.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
150
|
+
}
|
|
151
|
+
);
|
|
152
|
+
console.log('voidTask created,', voidTask);
|
|
153
|
+
|
|
154
|
+
const giveUpPayment = moment()
|
|
155
|
+
.add(ASYNC_ACTION_GIVEUP_SEC, 'seconds');
|
|
156
|
+
let result: { status: client.factory.taskStatus } | undefined;
|
|
157
|
+
let error: any;
|
|
158
|
+
|
|
159
|
+
// n秒おきに状態確認
|
|
160
|
+
while (result === undefined && error === undefined) {
|
|
161
|
+
// n秒待機
|
|
162
|
+
await wait(ASYNC_ACTION_CHECK_INTERVAL_MS);
|
|
163
|
+
|
|
164
|
+
// タスク作成から一定時間経過すればあきらめる
|
|
165
|
+
if (moment()
|
|
166
|
+
.isAfter(giveUpPayment)) {
|
|
167
|
+
error = new Error('action gaven up');
|
|
168
|
+
break;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
const voidTaskWithStatus = await repos.offerService.findVoidTask({
|
|
172
|
+
actionId: params.originalAuthorizeAction,
|
|
173
|
+
taskId: voidTask.id,
|
|
174
|
+
purpose: { id: params.purpose.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
175
|
+
});
|
|
176
|
+
console.log('voidTaskWithStatus:,', voidTaskWithStatus);
|
|
177
|
+
|
|
178
|
+
if (voidTaskWithStatus.status === client.factory.taskStatus.Executed) {
|
|
179
|
+
// ステータス完了であれば決済承認アクションIDを保管
|
|
180
|
+
result = voidTaskWithStatus;
|
|
181
|
+
break;
|
|
182
|
+
} else {
|
|
183
|
+
// 待機続行
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
if (typeof result?.status === 'string') {
|
|
188
|
+
console.log('voidTask executed.', result);
|
|
189
|
+
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
throw error;
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function authorizeCreditCardAsync(params: {
|
|
198
|
+
object: {
|
|
199
|
+
amount: number;
|
|
200
|
+
paymentMethod: string;
|
|
201
|
+
method: string;
|
|
202
|
+
creditCard: typeof creditCard;
|
|
203
|
+
issuedThrough: { id: string };
|
|
204
|
+
};
|
|
205
|
+
purpose: { id: string; typeOf: client.factory.transactionType.PlaceOrder };
|
|
206
|
+
}) {
|
|
207
|
+
return async (repos: {
|
|
208
|
+
paymentService: client.chevrePay.service.Payment;
|
|
209
|
+
}): Promise<{
|
|
210
|
+
/**
|
|
211
|
+
* 承認アクションID
|
|
212
|
+
*/
|
|
213
|
+
id: string;
|
|
214
|
+
}> => {
|
|
215
|
+
// 決済承認タスク作成
|
|
216
|
+
const authorizeTask = await repos.paymentService.authorizeCreditCard(params, { async: true });
|
|
217
|
+
const giveUpPayment = moment()
|
|
218
|
+
.add(ASYNC_ACTION_GIVEUP_SEC, 'seconds');
|
|
219
|
+
let result: { id: string } | undefined;
|
|
220
|
+
let error: any;
|
|
221
|
+
|
|
222
|
+
// n秒おきに状態確認
|
|
223
|
+
while (result === undefined && error === undefined) {
|
|
224
|
+
// n秒待機
|
|
225
|
+
await wait(ASYNC_ACTION_CHECK_INTERVAL_MS);
|
|
226
|
+
|
|
227
|
+
// タスク作成から一定時間経過すればあきらめる
|
|
228
|
+
if (moment()
|
|
229
|
+
.isAfter(giveUpPayment)) {
|
|
230
|
+
error = new Error('action gaven up');
|
|
231
|
+
break;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
const authorizeAction = await repos.paymentService.findAuthorizeAction({
|
|
235
|
+
sameAs: { id: authorizeTask.id },
|
|
236
|
+
object: {
|
|
237
|
+
typeOf: client.factory.service.paymentService.PaymentServiceType.CreditCard
|
|
238
|
+
},
|
|
239
|
+
purpose: params.purpose
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
if (typeof authorizeAction.id === 'string') {
|
|
243
|
+
if (authorizeAction.actionStatus === client.factory.actionStatusType.CompletedActionStatus) {
|
|
244
|
+
// ステータス完了であれば決済承認アクションIDを保管
|
|
245
|
+
result = { id: authorizeAction.id };
|
|
246
|
+
break;
|
|
247
|
+
} else {
|
|
248
|
+
// 待機続行
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// エラーが存在すれば、これ以上待機する価値はなし
|
|
253
|
+
if (authorizeAction.error !== undefined) {
|
|
254
|
+
error = authorizeAction.error;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
if (typeof result?.id === 'string') {
|
|
260
|
+
return result;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
throw error;
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// tslint:disable-next-line:max-func-body-length
|
|
268
|
+
async function main() {
|
|
269
|
+
const authClient = await client.auth.ClientCredentials.createInstance({
|
|
270
|
+
domain: <string>process.env.CHEVRE_AUTHORIZE_SERVER_DOMAIN,
|
|
271
|
+
clientId: <string>process.env.CHEVRE_CLIENT_ID,
|
|
272
|
+
clientSecret: <string>process.env.CHEVRE_CLIENT_SECRET,
|
|
273
|
+
scopes: [],
|
|
274
|
+
state: ''
|
|
275
|
+
});
|
|
276
|
+
const placeOrderService = await (await client.loadChevreTxn({
|
|
277
|
+
endpoint: `${<string>process.env.CHEVRE_ENDPOINT}/txn`,
|
|
278
|
+
auth: authClient
|
|
279
|
+
})).createPlaceOrderTransactionInstance({
|
|
280
|
+
project,
|
|
281
|
+
seller: { id: '' }
|
|
282
|
+
});
|
|
283
|
+
const offerService = await (await client.loadChevreTxc({
|
|
284
|
+
endpoint: `${<string>process.env.CHEVRE_ENDPOINT}/txc`,
|
|
285
|
+
auth: authClient
|
|
286
|
+
})).createOfferInstance({
|
|
287
|
+
project,
|
|
288
|
+
seller: { id: '' }
|
|
289
|
+
});
|
|
290
|
+
const paymentService = await (await client.loadChevrePay({
|
|
291
|
+
endpoint: `${<string>process.env.CHEVRE_ENDPOINT}/pay`,
|
|
292
|
+
auth: authClient
|
|
293
|
+
})).createPaymentInstance({
|
|
294
|
+
project,
|
|
295
|
+
seller: { id: '' }
|
|
296
|
+
});
|
|
297
|
+
|
|
298
|
+
console.log('starting transaction...');
|
|
299
|
+
const transaction = await placeOrderService.start({
|
|
300
|
+
agent: {},
|
|
301
|
+
seller: { id: SELLER_ID },
|
|
302
|
+
object: {
|
|
303
|
+
// passport: { token: passportToken }
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
console.log('transaction started', transaction.id);
|
|
307
|
+
|
|
308
|
+
try {
|
|
309
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
310
|
+
await wait(3000);
|
|
311
|
+
let authorizeOfferAction = await authorizeOfferAsync({ purpose: { id: transaction.id } })({ offerService });
|
|
312
|
+
console.log('offer authorized', authorizeOfferAction.id);
|
|
313
|
+
|
|
314
|
+
// 変更
|
|
315
|
+
await wait(3000);
|
|
316
|
+
authorizeOfferAction = await authorizeOfferAsync({
|
|
317
|
+
purpose: { id: transaction.id },
|
|
318
|
+
originalAuthorizeAction: authorizeOfferAction.id
|
|
319
|
+
})({ offerService });
|
|
320
|
+
console.log('offer authorized', authorizeOfferAction.id);
|
|
321
|
+
|
|
322
|
+
// オファー承認取消
|
|
323
|
+
await wait(3000);
|
|
324
|
+
await voidAuthorizeOfferAsync({
|
|
325
|
+
purpose: { id: transaction.id },
|
|
326
|
+
originalAuthorizeAction: authorizeOfferAction.id
|
|
327
|
+
})({ offerService });
|
|
328
|
+
console.log('authorization voided', authorizeOfferAction.id);
|
|
329
|
+
|
|
330
|
+
// オファー再承認
|
|
331
|
+
await wait(3000);
|
|
332
|
+
authorizeOfferAction = await authorizeOfferAsync({ purpose: { id: transaction.id } })({ offerService });
|
|
333
|
+
console.log('offer authorized', authorizeOfferAction.id);
|
|
334
|
+
|
|
335
|
+
// 決済承認
|
|
336
|
+
await wait(3000);
|
|
337
|
+
console.log('authorizing credit card payment...');
|
|
338
|
+
const authorizePayment = await authorizeCreditCardAsync({
|
|
339
|
+
object: {
|
|
340
|
+
amount: Number(authorizeOfferAction.result.price),
|
|
341
|
+
paymentMethod: 'CreditCard',
|
|
342
|
+
method: '1',
|
|
343
|
+
creditCard,
|
|
344
|
+
issuedThrough: { id: '5f9a6986cc98a1eb13a90285' }
|
|
345
|
+
},
|
|
346
|
+
purpose: { id: transaction.id, typeOf: client.factory.transactionType.PlaceOrder }
|
|
347
|
+
})({ paymentService });
|
|
348
|
+
console.log('credit card payment authorized', authorizePayment.id);
|
|
349
|
+
|
|
350
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
351
|
+
await wait(3000);
|
|
352
|
+
const settingProfile: client.factory.person.IProfile = {
|
|
353
|
+
givenName: profile.givenName,
|
|
354
|
+
familyName: profile.familyName,
|
|
355
|
+
telephone: profile.telephone,
|
|
356
|
+
email: profile.email
|
|
357
|
+
};
|
|
358
|
+
console.log('setting customer profile...');
|
|
359
|
+
await placeOrderService.setProfile({ id: transaction.id, agent: settingProfile });
|
|
360
|
+
console.log('customer profile set');
|
|
361
|
+
|
|
362
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
363
|
+
await wait(3000);
|
|
364
|
+
await placeOrderService.updateObject({
|
|
365
|
+
id: transaction.id,
|
|
366
|
+
object: { name: 'order from samples' }
|
|
367
|
+
});
|
|
368
|
+
|
|
369
|
+
console.log('confirming transaction...');
|
|
370
|
+
const confirmResult = await placeOrderService.confirm({
|
|
371
|
+
id: transaction.id,
|
|
372
|
+
sendEmailMessage: true,
|
|
373
|
+
expectsMinimalResponse: true
|
|
374
|
+
});
|
|
375
|
+
console.log('transaction confirmed', confirmResult);
|
|
376
|
+
} catch (error) {
|
|
377
|
+
console.error(error);
|
|
378
|
+
|
|
379
|
+
// tslint:disable-next-line:no-magic-numbers
|
|
380
|
+
await wait(3000);
|
|
381
|
+
await placeOrderService.cancel({ id: transaction.id });
|
|
382
|
+
console.log('transaction canceled');
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
async function wait(waitInMilliseconds: number) {
|
|
387
|
+
return new Promise((resolve) => {
|
|
388
|
+
console.log('waiting...', waitInMilliseconds);
|
|
389
|
+
setTimeout(resolve, waitInMilliseconds);
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
main()
|
|
394
|
+
.then(() => {
|
|
395
|
+
console.log('success!');
|
|
396
|
+
})
|
|
397
|
+
.catch(console.error);
|
|
@@ -14,6 +14,23 @@ export interface IAuthorizeResult {
|
|
|
14
14
|
export interface ICheckMovieTicketResult {
|
|
15
15
|
purchaseNumberAuthResult: factory.action.check.paymentMethod.movieTicket.IPurchaseNumberAuthResult;
|
|
16
16
|
}
|
|
17
|
+
export interface IMinimizedCheckMovieTicketResult {
|
|
18
|
+
purchaseNumberAuthResult: Omit<ICheckMovieTicketResult['purchaseNumberAuthResult'], 'knyknrNoInfoOut'> & {
|
|
19
|
+
knyknrNoInfoOut: Omit<factory.action.check.paymentMethod.movieTicket.IPurchaseNumberInfo, 'ykknInfo' | 'mkknInfo'>[] | null;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export declare type IMovieTicketYkknInfo = factory.action.check.paymentMethod.movieTicket.IYkknInfo & {
|
|
23
|
+
/**
|
|
24
|
+
* 購入管理番号
|
|
25
|
+
*/
|
|
26
|
+
knyknrNo: string;
|
|
27
|
+
};
|
|
28
|
+
export declare type IMovieTicketMkknInfo = factory.action.check.paymentMethod.movieTicket.IMkknInfo & {
|
|
29
|
+
/**
|
|
30
|
+
* 購入管理番号
|
|
31
|
+
*/
|
|
32
|
+
knyknrNo: string;
|
|
33
|
+
};
|
|
17
34
|
export declare type IAuthorizeAnyPaymentObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'name' | 'additionalProperty'>;
|
|
18
35
|
export declare type IAuthorizeCreditCardObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'issuedThrough' | 'paymentMethod' | 'creditCard' | 'method' | 'paymentMethodId' | 'name' | 'additionalProperty'>;
|
|
19
36
|
export declare type IAuthorizeMovieTicketObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'issuedThrough' | 'paymentMethod' | 'movieTickets' | 'name' | 'additionalProperty'>;
|
|
@@ -21,17 +38,14 @@ export declare type IAuthorizePaymentCardObject = Pick<factory.action.authorize.
|
|
|
21
38
|
description?: string;
|
|
22
39
|
};
|
|
23
40
|
export declare type IPublishPaymentUrlObject = Pick<factory.action.authorize.paymentMethod.any.IObjectWithoutDetail, 'amount' | 'creditCard' | 'issuedThrough' | 'paymentMethod' | 'method'>;
|
|
24
|
-
export
|
|
25
|
-
paymentMethodId: string;
|
|
26
|
-
paymentUrl: string;
|
|
27
|
-
}
|
|
41
|
+
export declare type IPublishPaymentUrlResult = Pick<factory.action.accept.pay.IResult, 'paymentMethodId' | 'paymentUrl'>;
|
|
28
42
|
export interface IFindAuthorizeActionResult {
|
|
29
43
|
/**
|
|
30
|
-
*
|
|
44
|
+
* 承認アクションID
|
|
31
45
|
*/
|
|
32
46
|
id?: string;
|
|
33
47
|
/**
|
|
34
|
-
*
|
|
48
|
+
* アクションステータス
|
|
35
49
|
*/
|
|
36
50
|
actionStatus: factory.actionStatusType;
|
|
37
51
|
/**
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import * as factory from '../factory';
|
|
2
2
|
import { Service } from '../service';
|
|
3
|
-
import { IAuthorizeAnyPaymentObject, IAuthorizeCreditCardObject, IAuthorizeMovieTicketObject, IAuthorizePaymentCardObject, IAuthorizeResult, ICheckMovieTicketResult, IFindAuthorizeActionResult, IPublishPaymentUrlObject, IPublishPaymentUrlResult, IPurpose } from './payment/factory';
|
|
3
|
+
import { IAuthorizeAnyPaymentObject, IAuthorizeCreditCardObject, IAuthorizeMovieTicketObject, IAuthorizePaymentCardObject, IAuthorizeResult, ICheckMovieTicketResult, IFindAuthorizeActionResult, IMinimizedCheckMovieTicketResult, IMovieTicketMkknInfo, IMovieTicketYkknInfo, IPublishPaymentUrlObject, IPublishPaymentUrlResult, IPurpose } from './payment/factory';
|
|
4
4
|
/**
|
|
5
5
|
* 決済サービス
|
|
6
6
|
*/
|
|
7
7
|
export declare class PaymentService extends Service {
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
9
|
+
* 決済カード認証
|
|
10
10
|
*/
|
|
11
11
|
checkMovieTicket(params: Pick<factory.action.check.paymentMethod.movieTicket.IAttributes, 'object'> & {
|
|
12
12
|
purpose: factory.action.check.paymentMethod.movieTicket.IPurpose;
|
|
13
13
|
}): Promise<{
|
|
14
14
|
result: Pick<ICheckMovieTicketResult, 'purchaseNumberAuthResult'>;
|
|
15
15
|
}>;
|
|
16
|
+
/**
|
|
17
|
+
* 決済カード認証(非同期)
|
|
18
|
+
*/
|
|
19
|
+
checkMovieTicketAsync(params: Pick<factory.action.check.paymentMethod.movieTicket.IAttributes, 'object'> & {
|
|
20
|
+
purpose: factory.action.check.paymentMethod.movieTicket.IPurpose;
|
|
21
|
+
}): Promise<{
|
|
22
|
+
/**
|
|
23
|
+
* task ID
|
|
24
|
+
*/
|
|
25
|
+
id: string;
|
|
26
|
+
}>;
|
|
16
27
|
/**
|
|
17
28
|
* 対面決済承認
|
|
18
29
|
*/
|
|
@@ -30,7 +41,7 @@ export declare class PaymentService extends Service {
|
|
|
30
41
|
async?: boolean;
|
|
31
42
|
}): Promise<IAuthorizeResult>;
|
|
32
43
|
/**
|
|
33
|
-
*
|
|
44
|
+
* 決済カード決済承認
|
|
34
45
|
*/
|
|
35
46
|
authorizeMovieTicket(params: {
|
|
36
47
|
object: IAuthorizeMovieTicketObject;
|
|
@@ -47,11 +58,24 @@ export declare class PaymentService extends Service {
|
|
|
47
58
|
}): Promise<IAuthorizeResult>;
|
|
48
59
|
/**
|
|
49
60
|
* 決済ロケーション発行
|
|
61
|
+
* @deprecated Use publishCreditCardPaymentUrlAsync
|
|
50
62
|
*/
|
|
51
63
|
publishCreditCardPaymentUrl(params: {
|
|
52
64
|
object: IPublishPaymentUrlObject;
|
|
53
65
|
purpose: IPurpose;
|
|
54
66
|
}): Promise<IPublishPaymentUrlResult>;
|
|
67
|
+
/**
|
|
68
|
+
* 決済ロケーション発行(非同期)
|
|
69
|
+
*/
|
|
70
|
+
publishCreditCardPaymentUrlAsync(params: {
|
|
71
|
+
object: IPublishPaymentUrlObject;
|
|
72
|
+
purpose: IPurpose;
|
|
73
|
+
}): Promise<{
|
|
74
|
+
/**
|
|
75
|
+
* task ID
|
|
76
|
+
*/
|
|
77
|
+
id: string;
|
|
78
|
+
}>;
|
|
55
79
|
/**
|
|
56
80
|
* 対面決済承認取消
|
|
57
81
|
*/
|
|
@@ -79,7 +103,7 @@ export declare class PaymentService extends Service {
|
|
|
79
103
|
purpose: IPurpose;
|
|
80
104
|
}): Promise<void>;
|
|
81
105
|
/**
|
|
82
|
-
*
|
|
106
|
+
* 決済承認アクション検索
|
|
83
107
|
*/
|
|
84
108
|
findAuthorizeAction(params: {
|
|
85
109
|
sameAs: {
|
|
@@ -93,4 +117,83 @@ export declare class PaymentService extends Service {
|
|
|
93
117
|
};
|
|
94
118
|
purpose: IPurpose;
|
|
95
119
|
}): Promise<IFindAuthorizeActionResult>;
|
|
120
|
+
/**
|
|
121
|
+
* 決済カード認証アクション検索
|
|
122
|
+
*/
|
|
123
|
+
findCheckMovieTicketAction(params: {
|
|
124
|
+
sameAs: {
|
|
125
|
+
id: string;
|
|
126
|
+
};
|
|
127
|
+
purpose: IPurpose;
|
|
128
|
+
minimize: boolean;
|
|
129
|
+
}): Promise<{
|
|
130
|
+
/**
|
|
131
|
+
* 認証アクションID
|
|
132
|
+
*/
|
|
133
|
+
id?: string;
|
|
134
|
+
/**
|
|
135
|
+
* アクションステータス
|
|
136
|
+
*/
|
|
137
|
+
actionStatus: factory.actionStatusType;
|
|
138
|
+
/**
|
|
139
|
+
* エラー
|
|
140
|
+
*/
|
|
141
|
+
error?: {
|
|
142
|
+
name?: string;
|
|
143
|
+
message?: string;
|
|
144
|
+
};
|
|
145
|
+
result?: IMinimizedCheckMovieTicketResult;
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* 決済カード認証アクションから有効券を検索する
|
|
149
|
+
*/
|
|
150
|
+
searchYkknInfoByCheckMovieTicketAction(params: {
|
|
151
|
+
/**
|
|
152
|
+
* max: 20
|
|
153
|
+
*/
|
|
154
|
+
limit: number;
|
|
155
|
+
page: number;
|
|
156
|
+
/**
|
|
157
|
+
* 認証アクションID
|
|
158
|
+
*/
|
|
159
|
+
id: string;
|
|
160
|
+
purpose: IPurpose;
|
|
161
|
+
}): Promise<IMovieTicketYkknInfo[]>;
|
|
162
|
+
/**
|
|
163
|
+
* 決済カード認証アクションから無効券を検索する
|
|
164
|
+
*/
|
|
165
|
+
searchMkknInfoByCheckMovieTicketAction(params: {
|
|
166
|
+
/**
|
|
167
|
+
* max: 20
|
|
168
|
+
*/
|
|
169
|
+
limit: number;
|
|
170
|
+
page: number;
|
|
171
|
+
/**
|
|
172
|
+
* 認証アクションID
|
|
173
|
+
*/
|
|
174
|
+
id: string;
|
|
175
|
+
purpose: IPurpose;
|
|
176
|
+
}): Promise<IMovieTicketMkknInfo[]>;
|
|
177
|
+
/**
|
|
178
|
+
* 決済採用アクション検索
|
|
179
|
+
*/
|
|
180
|
+
findAcceptPayAction(params: {
|
|
181
|
+
sameAs: {
|
|
182
|
+
id: string;
|
|
183
|
+
};
|
|
184
|
+
purpose: IPurpose;
|
|
185
|
+
}): Promise<{
|
|
186
|
+
/**
|
|
187
|
+
* アクションステータス
|
|
188
|
+
*/
|
|
189
|
+
actionStatus: factory.actionStatusType;
|
|
190
|
+
/**
|
|
191
|
+
* エラー
|
|
192
|
+
*/
|
|
193
|
+
error?: {
|
|
194
|
+
name?: string;
|
|
195
|
+
message?: string;
|
|
196
|
+
};
|
|
197
|
+
result?: IPublishPaymentUrlResult;
|
|
198
|
+
}>;
|
|
96
199
|
}
|