clink-typescript-sdk-test 0.0.3 → 0.0.4
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/dist/client/index.d.ts +8 -1
- package/dist/client/index.js +11 -0
- package/dist/client/model.d.ts +84 -0
- package/package.json +1 -1
package/dist/client/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClinkPayClientConstructorOptions, CreateCheckoutSessionRequest, CreateCheckoutSessionResponse, CustomerPortalSessionRequest, CustomerPortalSessionResponse, GetInvoiceResponse, GetOrderResponse, GetPriceRequest, GetPriceResponse, GetProductResponse, GetSessionResponse, GetSubscriptionResponse, ListResult, PageQuery, PaymentInstrumentRequest, PaymentInstrumentResponse, RefundResponse } from './model';
|
|
1
|
+
import { ClinkPayClientConstructorOptions, CreateCheckoutSessionRequest, CreateCheckoutSessionResponse, CreateOrderAndPayReqData, CreateOrderAndPayRespData, CustomerPortalSessionRequest, CustomerPortalSessionResponse, GetInvoiceResponse, GetOrderResponse, GetPriceRequest, GetPriceResponse, GetProductResponse, GetSessionResponse, GetSubscriptionResponse, ListResult, PageQuery, PaymentInstrumentRequest, PaymentInstrumentResponse, RefundResponse } from './model';
|
|
2
2
|
export declare class ClinkPayClient {
|
|
3
3
|
private apiKey;
|
|
4
4
|
private baseUrl;
|
|
@@ -86,4 +86,11 @@ export declare class ClinkPayClient {
|
|
|
86
86
|
* @returns list of payment instrument response. if not found, return empty list
|
|
87
87
|
*/
|
|
88
88
|
getPaymentInstrumentList(params: PaymentInstrumentRequest): Promise<PaymentInstrumentResponse[]>;
|
|
89
|
+
/**
|
|
90
|
+
* create order and pay
|
|
91
|
+
*
|
|
92
|
+
* @param data CreateOrderAndPayReqData
|
|
93
|
+
* @returns order info response
|
|
94
|
+
*/
|
|
95
|
+
createOrderAndPay(data: CreateOrderAndPayReqData): Promise<CreateOrderAndPayRespData>;
|
|
89
96
|
}
|
package/dist/client/index.js
CHANGED
|
@@ -167,5 +167,16 @@ class ClinkPayClient {
|
|
|
167
167
|
return this.requestClient.Get(`/payment_instrument/list?customerId=${customerId}&type=${type}`);
|
|
168
168
|
});
|
|
169
169
|
}
|
|
170
|
+
/**
|
|
171
|
+
* create order and pay
|
|
172
|
+
*
|
|
173
|
+
* @param data CreateOrderAndPayReqData
|
|
174
|
+
* @returns order info response
|
|
175
|
+
*/
|
|
176
|
+
createOrderAndPay(data) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
return this.requestClient.Post('/order/order_payment', data);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
170
181
|
}
|
|
171
182
|
exports.ClinkPayClient = ClinkPayClient;
|
package/dist/client/model.d.ts
CHANGED
|
@@ -20,6 +20,18 @@ export interface CustomerPortalSessionRequest {
|
|
|
20
20
|
* Redirect URL when customer click on 'Return to Merchant'
|
|
21
21
|
*/
|
|
22
22
|
returnUrl?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 是否显示订阅列表
|
|
25
|
+
*/
|
|
26
|
+
showSubscriptions?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 是否显示付款方式
|
|
29
|
+
*/
|
|
30
|
+
showPaymentMethods?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* 是否显示账单
|
|
33
|
+
*/
|
|
34
|
+
showInvoices?: boolean;
|
|
23
35
|
}
|
|
24
36
|
export interface CustomerPortalSessionResponse {
|
|
25
37
|
/**
|
|
@@ -397,3 +409,75 @@ export interface Card {
|
|
|
397
409
|
issuerBank: string;
|
|
398
410
|
billingAddress: BillingAddress;
|
|
399
411
|
}
|
|
412
|
+
export interface PriceDataList {
|
|
413
|
+
/**
|
|
414
|
+
* name of product
|
|
415
|
+
*/
|
|
416
|
+
name: string;
|
|
417
|
+
/**
|
|
418
|
+
* number of products
|
|
419
|
+
*/
|
|
420
|
+
quantity?: number;
|
|
421
|
+
/**
|
|
422
|
+
* unit amount of product
|
|
423
|
+
*/
|
|
424
|
+
unitAmount: number;
|
|
425
|
+
currency?: string;
|
|
426
|
+
imageUrl?: string;
|
|
427
|
+
}
|
|
428
|
+
export interface CreateOrderAndPayReqData {
|
|
429
|
+
/**
|
|
430
|
+
* Customer ID
|
|
431
|
+
*/
|
|
432
|
+
customerId: string;
|
|
433
|
+
/**
|
|
434
|
+
* paymentInstrumentId
|
|
435
|
+
*/
|
|
436
|
+
paymentInstrumentId: string;
|
|
437
|
+
paymentCurrency: string;
|
|
438
|
+
productId?: string;
|
|
439
|
+
priceId?: string;
|
|
440
|
+
/**
|
|
441
|
+
* Original amount (must be greater than 0)
|
|
442
|
+
*/
|
|
443
|
+
originalAmount?: number;
|
|
444
|
+
originalCurrency?: string;
|
|
445
|
+
priceDataList?: PriceDataList[];
|
|
446
|
+
/**
|
|
447
|
+
* Platform type
|
|
448
|
+
* - WEB PC
|
|
449
|
+
* - WEB Mobile
|
|
450
|
+
*/
|
|
451
|
+
platformType?: 'WEB' | 'WAP';
|
|
452
|
+
/**
|
|
453
|
+
* required when platformType is WAP
|
|
454
|
+
*/
|
|
455
|
+
deviceType?: 'ANDROID' | 'IOS' | string;
|
|
456
|
+
remark?: string;
|
|
457
|
+
}
|
|
458
|
+
export interface PaymentMethod {
|
|
459
|
+
paymentMethodType: string;
|
|
460
|
+
paymentInstrumentId: string;
|
|
461
|
+
}
|
|
462
|
+
export interface Metadata {
|
|
463
|
+
}
|
|
464
|
+
export interface CreateOrderAndPayRespData {
|
|
465
|
+
createTime: number;
|
|
466
|
+
orderId: string;
|
|
467
|
+
sessionId: string;
|
|
468
|
+
merchantReferenceId: string;
|
|
469
|
+
invoiceId: string;
|
|
470
|
+
customerId: string;
|
|
471
|
+
productId: string;
|
|
472
|
+
priceId: string;
|
|
473
|
+
priceDataList: PriceDataList[];
|
|
474
|
+
paymentMethod: PaymentMethod;
|
|
475
|
+
amountSubtotal: number;
|
|
476
|
+
amountTotal: number;
|
|
477
|
+
paymentCurrency: string;
|
|
478
|
+
originalCurrency: string;
|
|
479
|
+
status: string;
|
|
480
|
+
metadata: {
|
|
481
|
+
[key: string]: any;
|
|
482
|
+
};
|
|
483
|
+
}
|