|
@@ -19,6 +19,7 @@ const PREMINUM_KEY_URL = HOST + '/api/v3-2/Fiat/Kyc/CreatePremiumUser';
|
|
const COUNTRIES_URL = HOST + '/api/v3-2/Fiat/Countries';
|
|
const COUNTRIES_URL = HOST + '/api/v3-2/Fiat/Countries';
|
|
const REFUND_URL = HOST + '/api/v3-2/Fiat/Direct/Refund';
|
|
const REFUND_URL = HOST + '/api/v3-2/Fiat/Direct/Refund';
|
|
const QUERY_REFUND_URL = HOST + '/api/v3-2/Fiat/x/Refund'
|
|
const QUERY_REFUND_URL = HOST + '/api/v3-2/Fiat/x/Refund'
|
|
|
|
+const KYC_QUERY = HOST + '/api/v3-2/Fiat/Kyc/GetCustomer'
|
|
|
|
|
|
// const API_KEY = '08dcd396-a91a-486a-8ca5-02150819d7ae';
|
|
// const API_KEY = '08dcd396-a91a-486a-8ca5-02150819d7ae';
|
|
const API_KEY = '08dd0477-8676-4f68-83c1-215dceeffa2e';
|
|
const API_KEY = '08dd0477-8676-4f68-83c1-215dceeffa2e';
|
|
@@ -335,4 +336,31 @@ export class SunPayService extends BaseService {
|
|
throw new Error(msg);
|
|
throw new Error(msg);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ async queryKyc(outUserId) {
|
|
|
|
+ const timestamp = +moment();
|
|
|
|
+ const nonce = md5(timestamp);
|
|
|
|
+ const data = timestamp + nonce;
|
|
|
|
+ const sign = this.utils.signBySha256(data, API_SERECT).toUpperCase();
|
|
|
|
+ const URL = KYC_QUERY + '?out_user_id=' + outUserId;
|
|
|
|
+ console.log(URL)
|
|
|
|
+ const res = await this.httpService.get(URL, {
|
|
|
|
+ headers: {
|
|
|
|
+ 'SunPay-Key': API_KEY,
|
|
|
|
+ 'SunPay-Timestamp': timestamp,
|
|
|
|
+ 'SunPay-Nonce': nonce,
|
|
|
|
+ 'SunPay-Sign': sign
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ const { is_success, msg } = res.data;
|
|
|
|
+ if (is_success && res.data && res.data.data && res.data.data.customer_id) {
|
|
|
|
+ return {
|
|
|
|
+ customerId: res.data.data.customer_id,
|
|
|
|
+ kycUserId: res.data.data.out_user_id,
|
|
|
|
+ countryCode: res.data.data.country_code
|
|
|
|
+ };
|
|
|
|
+ } else {
|
|
|
|
+ throw new Error(msg);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|