特約商店API查詢貸款規則
提供特約商店,直接利用API查詢貸款規則
安全性設計
將傳輸的資料以AES256加密,再透過HTTPS加密傳輸。
一碼貸 資料傳遞格式
我們提供介接方式是透過https連線,只接受POST方式傳送串接資料。
(1)查詢請求:特約商發起查詢請求,經檢查資料無誤時,會直接返回產品規則
我們提供介接方式是透過https連線,只接受POST方式傳送查詢資料。
介接網址
位置 | API介接網址 |
---|---|
測試區 | https://pay.usecase.cc/api/init |
正式區 | https://ka.mypay.tw/api/init |
資料加密方式
AES 256編碼 + base64編碼(附錄二資料加密方式)
加密金鑰
金鑰會透過mail發送,也可從管理後台取得
文字編碼
一律使用UTF-8相容編碼
交易請求
<?php
final class StoreLoanProductRule
{
/**
* 特約商商務代號
* @var string
*/
public $storeUid = "289151880026";
/**
* 特約商金鑰或認證碼
* @var string
*/
public $storeKey = "bwwUmBfWYHfBncvEgyhu6Taf8I6lDsiN";
/**
* 串接交易位置
* @var string
*/
public $url = "https://pay.usecase.cc/api/init";
/**
* 取得串接欄位資料
* @return array
*/
public function getRawData()
{
//主黨資料
$rawData = array();
$rawData['store_uid'] = $this->storeUid;
return $rawData;
}
/**
* 取得服務位置
* @return array
*/
public function getService()
{
return array(
'service_name' => 'ap39',
'cmd' => 'api/quickpayloanproductrule'
);
}
/**
* AES 256 加密
* @param array $fields
* @param string $key
* @return string
*/
public function encrypt($fields, $key)
{
$data = json_encode($fields);
$size = openssl_cipher_iv_length('AES-256-CBC');
$iv = openssl_random_pseudo_bytes($size);
$data = openssl_encrypt($data, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv);
$data = base64_encode($iv . $data);
return $data;
}
/**
* 資料 POST 到主機
* @param array $postData
* @return mixed
*/
public function post($postData = [])
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $this->url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($postData));
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
/**
* 取得送出欄位資料
* @return array
*/
public function getPostData ()
{
$postData = array();
$postData['store_uid'] = $this->storeUid;
$postData['service'] = $this->encrypt($this->getService(), $this->storeKey);
$postData['encry_data'] = $this->encrypt($this->getRawData(), $this->storeKey);
return $postData;
}
/**
* 執行
*/
public function run()
{
$json = $this->post($this->getPostData());
echo $json;
}
}
$f = new StoreLoanProductRule();
$f->run();
?>
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections;
using System.IO;
using System.Linq;
using System.Net;
using System.Security.Cryptography;
using System.Text;
using System.Web;
using System.Dynamic;
/// <summary>
/// 建議使用.net framework4.5以上版本
/// 1.請透過NuGet安裝Newtonsoft.Json,若.net framework小於4.5請安裝Newtonsoft.Json 7.0以下版本
/// 2.若貴司.net framework小於4 可能無法使用dynamic,若是自行組陣列
/// 3.若貴司.net framework小於3.5 可能無法使用AES類別,若是參閱微軟網站使用較舊方式進行加密
/// 4.若貴司.net framework小於3.5 可能沒有Linq可使用,故data只能組字串,Newtonsoft.Json也可能無法使用
/// </summary>
namespace Buy {
/// <summary>
/// 經銷商串接-特約商店申請
/// </summary>
public class StoreLoanProductRule {
/// <summary>
/// 經銷商商務代號
/// </summary>
public string storeUid = "289151880026";
/// <summary>
/// 經銷商金鑰或認證碼
/// </summary>
public string storeKey = "bwwUmBfWYHfBncvEgyhu6Taf8I6lDsiN";
/// <summary>
/// 串接交易位置
/// </summary>
public string url = "https://pay.usecase.cc/api/init";
/// <summary>
/// 執行
/// </summary>
static void Main() {
StoreLoanProductRule simulator = new StoreLoanProductRule();
//僅限走https的Tls 1.2以上版本
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
//發送至遠端
var result = simulator.Post(simulator.GetPostData());
System.Console.WriteLine(result);
}
/// <summary>
/// 取得串接欄位資料
/// </summary>
private DataRequest GetRawData() {
//主要資料
DataRequest rawData = new DataRequest();
rawData.store_uid = this.storeUid;
return rawData;
}
/// <summary>
/// 取得服務位置
/// </summary>
private ServiceRequest GetService() {
ServiceRequest rawData = new ServiceRequest();
rawData.service_name = "ap39";
rawData.cmd = "api/quickpayloanproductrule";
return rawData;
}
/// <summary>
/// 取得送出欄位資料
/// </summary>
private NameValueCollection GetPostData() {
string data_json = JsonConvert.SerializeObject(GetRawData(), Formatting.None);
string svr_json = JsonConvert.SerializeObject(GetService(), Formatting.None);; //依API種類調整
//產生AES向量
var IV = GetBytesIV();
//進行加密
var data_encode = Encrypt(data_json, this.storeKey, IV);
var svr_encode = Encrypt(svr_json, this.storeKey, IV);
//請注意使用的 Http Post 套件是否會自動加上UrlEncode,本Post範例為原始方式,故須加上UrlEncode
//若自行使用的套件會自動補上UrlEncode,則請忽略下面的UrlEncode,避免做了兩次UrlEncode
string data_toUrlEncode = HttpUtility.UrlEncode(data_encode);
string svr_toUrlEncode = HttpUtility.UrlEncode(svr_encode);
NameValueCollection postData = new NameValueCollection();
postData["store_uid"] = this.storeUid;
postData["service"] = svr_toUrlEncode;
postData["encry_data"] = data_toUrlEncode;
return postData;
}
/// <summary>
/// AES 256 加密
/// </summary>
/// <param name="data"></param>
/// <param name="key"></param>
/// <param name="byteIV"></param>
/// <returns></returns>
private string Encrypt(string data, string key, byte[] byteIV) {
var byteKey = System.Text.Encoding.UTF8.GetBytes(key);
var enBytes = AES_Encrypt(data, byteKey, byteIV);
return Convert.ToBase64String(BytesAdd(byteIV, enBytes));
}
/// <summary>
/// AES 256 加密處理
/// </summary>
/// <param name="original"></param>
/// <param name="key"></param>
/// <param name="iv"></param>
/// <returns></returns>
private byte[] AES_Encrypt(string original, byte[] key, byte[] iv) {
try {
var data = Encoding.UTF8.GetBytes(original);
var cipher = Aes.Create().CreateEncryptor(key, iv);
var de = cipher.TransformFinalBlock(data, 0, data.Length);
return de;
} catch {
return null;
}
}
/// <summary>
/// 轉換Bytes
/// </summary>
/// <param name="a"></param>
/// <param name="arryB"></param>
/// <returns></returns>
private byte[] BytesAdd(byte[] a, params byte[][] arryB) {
List < byte > c = new List < byte > ();
c.AddRange(a);
arryB.ToList().ForEach(b => {
c.AddRange(b);
});
return c.ToArray();
}
/// <summary>
/// 產生AES的IV
/// </summary>
/// <returns></returns>
private static byte[] GetBytesIV() {
var aes = System.Security.Cryptography.AesCryptoServiceProvider.Create();
aes.KeySize = 256;
aes.GenerateIV();
return aes.IV;
}
/// <summary>
/// 資料 POST 到主機
/// </summary>
/// <param name="pars"></param>
/// <returns></returns>
private string Post(NameValueCollection pars) {
string result = string.Empty;
string param = string.Empty;
if (pars.Count > 0) {
pars.AllKeys.ToList().ForEach(key => {
param += key + "=" + pars[key] + "&";
});
if (param[param.Length - 1] == '&') {
param = param.Remove(param.Length - 1);
}
}
byte[] bs = Encoding.UTF8.GetBytes(param);
try {
HttpWebRequest req = (HttpWebRequest) HttpWebRequest.Create(this.url);
req.Method = "POST";
req.ContentType = "application/x-www-form-urlencoded";
req.ContentLength = bs.Length;
using(Stream reqStream = req.GetRequestStream()) {
reqStream.Write(bs, 0, bs.Length);
}
using(WebResponse wr = req.GetResponse()) {
Encoding myEncoding = Encoding.GetEncoding("UTF-8");
using(StreamReader myStreamReader = new StreamReader(wr.GetResponseStream(), myEncoding)) {
result = myStreamReader.ReadToEnd();
}
}
req = null;
} catch (WebException ex) {
throw new WebException(ex.Message + "params : " + param, ex, ex.Status, ex.Response);
}
return result;
}
}
/// <summary>
/// 串接內容資料請求欄位
/// </summary>
public class DataRequest {
public string store_uid { get; set; }
}
/// <summary>
/// 串接服務請求欄位
/// </summary>
public class ServiceRequest {
public string service_name { get; set; }
public string cmd { get; set; }
}
}
import com.fasterxml.jackson.databind.ObjectMapper;
import java.net.URLEncoder;
import java.util.*;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import java.io.BufferedReader;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.InputStreamReader;
import java.net.URL;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import static java.nio.charset.StandardCharsets.UTF_8;
import org.spongycastle.crypto.engines.AESEngine;
import org.spongycastle.crypto.modes.CBCBlockCipher;
import org.spongycastle.crypto.paddings.PaddedBufferedBlockCipher;
import org.spongycastle.crypto.params.KeyParameter;
import org.spongycastle.crypto.params.ParametersWithIV;
import java.security.SecureRandom;
import java.text.SimpleDateFormat;
/**
* 經銷商串接-特約商店申請
* 1. jackson-core 下載 https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core
* 2. jackson-databind 下載 https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind
* 3. jackson-annotations 下載 https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-annotations
* 4. Spongy Castle 下載 https://mvnrepository.com/artifact/com.madgag.spongycastle/core
*/
public class StoreLoanProductRule {
/**
* 經銷商商務代號
*/
String storeUid = "289151880026";
/**
* 經銷商金鑰或認證碼
*/
String storeKey = "bwwUmBfWYHfBncvEgyhu6Taf8I6lDsiN";
/**
* 串接交易位置
*/
String url = "https://pay.usecase.cc/api/init";
/**
* 執行
* @param args
*/
public static void main(String[] args) {
StoreLoanProductRule simulator = new StoreLoanProductRule();
String json = simulator.post(simulator.getPostData());
System.out.print(json);
}
@SuppressWarnings(value = { "unchecked", "deprecation" })
/**
* 取得串接欄位資料
* @return 串接原始資料
*/
public Map getRawData() {
//主要資料
Map<Object, Object> rawData = new HashMap<Object, Object>();
rawData.put("store_uid", this.storeUid);
return rawData;
}
/**
* 取得服務位置
* @return 串接服務資料
*/
public Map getService() {
Map<Object, Object> rawData = new HashMap<Object, Object>();
rawData.put("service_name", "ap39");
rawData.put("cmd", "api/quickpayloanproductrule");
return rawData;
}
/**
* AES 256 加密
* @param rawData 原始資料
* @param AesKey AES256金鑰字串
* @return 轉換成Base64資料
*/
public String encrypt(Map rawData, String AesKey) {
try {
ObjectMapper objMapper = new ObjectMapper();
byte[] data = objMapper.writeValueAsString(rawData).getBytes(UTF_8);
byte[] key = AesKey.getBytes(UTF_8);
// 16 bytes is the IV size for AES256
PaddedBufferedBlockCipher cipher = new PaddedBufferedBlockCipher(
new CBCBlockCipher(new AESEngine()));
// Random iv
SecureRandom rng = new SecureRandom();
byte[] ivBytes = new byte[16];
rng.nextBytes(ivBytes);
cipher.init(true, new ParametersWithIV(new KeyParameter(key),
ivBytes));
byte[] outBuf = new byte[cipher.getOutputSize(data.length)];
int processed = cipher
.processBytes(data, 0, data.length, outBuf, 0);
processed += cipher.doFinal(outBuf, processed);
byte[] outBuf2 = new byte[processed + 16]; // Make room for iv
System.arraycopy(ivBytes, 0, outBuf2, 0, 16); // Add iv
System.arraycopy(outBuf, 0, outBuf2, 16, processed);
Base64.Encoder encoder = Base64.getEncoder();
String base64 = encoder.encodeToString(outBuf2);
return base64;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 資料 POST 到主機
* @param qstr 串接資料
* @return 服務回傳JSON資訊
*/
public String post(String qstr) {
String result = "";
try {
// 資料
byte[] qstr_bytes = qstr.getBytes(StandardCharsets.UTF_8);
URL iurl = new URL(this.url);
SSLContext sc = SSLContext.getInstance("TLSv1.2"); // $NON-NLS-1$
sc.init(null, null, new java.security.SecureRandom());
HttpsURLConnection con = (HttpsURLConnection) iurl.openConnection();
con.setSSLSocketFactory(sc.getSocketFactory());
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type",
"application/x-www-form-urlencoded");
con.setRequestProperty("Content-Length",
String.valueOf(qstr_bytes.length));
con.setRequestProperty("Accept-Charset", "UTF-8");
con.setDoOutput(true);
con.setDoInput(true);
con.getOutputStream()
.write(qstr.getBytes(Charset.forName("UTF-8")));
con.getOutputStream().flush();
BufferedReader in = new BufferedReader(new InputStreamReader(
con.getInputStream(), "UTF-8"));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine + "\r\n");
}
try {
result = response.toString();
} finally {
in.close();
}
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return result;
}
/**
* 取得送出欄位資料
* @return POST完整資料
*/
public String getPostData() {
String postData = "";
try {
// Base64需要使用UrlEncode做傳輸
String data_toUrlEncode = URLEncoder.encode(
this.encrypt(this.getRawData(), this.storeKey), "UTF-8");
String svr_toUrlEncode = URLEncoder.encode(
this.encrypt(this.getService(), this.storeKey), "UTF-8");
postData = "store_uid=" + this.storeUid + "&service="
+ svr_toUrlEncode + "&encry_data=" + data_toUrlEncode;
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
return postData;
}
}
const crypto = require('crypto');
const httpRequest = require('https');
/**
* 經銷商串接-特約商店申請
*/
function StoreLoan() {
// 經銷商商務代號
this.storeUid = "289151880026";
// 經銷商金鑰或認證碼
this.storeKey = "bwwUmBfWYHfBncvEgyhu6Taf8I6lDsiN";
// 串接交易位置
this.url = "https://pay.usecase.cc/api/init";
};
/**
* 取得串接欄位資料
*/
StoreLoan.prototype.getRawData = function () {
rawData = {};
rawData.store_uid = this.storeUid;
return rawData;
};
/**
* 取得服務位置
*/
StoreLoan.prototype.getService = function () {
return {
service_name: "ap39",
cmd: "api/quickpayloanproductrule"
};
};
/**
* AES 256 加密
*/
StoreLoan.prototype.encrypt = function (fields, key) {
let eData = JSON.stringify(fields);
const blockSize = 16;
const iv = crypto.randomBytes(blockSize);
const encryptor = crypto.createCipheriv('aes-256-cbc', key, iv);
let tmpCipher = encryptor.update(Buffer.from(eData));
let finalCipher = encryptor.final();
const tempData = Buffer.concat([tmpCipher, finalCipher], tmpCipher.length + finalCipher.length);
let data = Buffer.concat([iv, tempData], iv.length + tempData.length).toString('base64');
return data;
};
/**
* 資料 POST 到主機
*/
StoreLoan.prototype.post = function (postData) {
return new Promise((res, rej) => {
let options = {
method: "POST",
headers: {
"Content-Type": "application/json"
},
rejectUnauthorized: false
};
let send_process = httpRequest.request(this.url, options, (api_res) => {
let res_data = "";
api_res.on('data', (tmp_data) => {
res_data += tmp_data;
});
api_res.on('end', () => {
res(res_data);
});
});
send_process.write(JSON.stringify(postData));
send_process.end();
});
};
/**
* 取得送出欄位資料
*/
StoreLoan.prototype.getPostData = function () {
return {
"store_uid": this.storeUid,
"service": this.encrypt(this.getService(), this.storeKey),
"encry_data": this.encrypt(this.getRawData(), this.storeKey)
};
};
/**
* 執行
*/
StoreLoan.prototype.run = async function () {
json = await this.post(this.getPostData())
console.log(json);
};
StoreLoan = new StoreLoan();
StoreLoan.run();
串接回傳 JSON 結構如下:
{
"code": "B200",
"msg": "執行成功",
"rows_data": [
{
"company": "806597592001",
"product_item": [
{
"product_code": "A1010007",
"bus_type": "AA21",
"explanation": "機車原車抵押",
"promotion_no": [
{
"code": "DM43",
"explanation": "優質"
},
{
"code": "DM64",
"explanation": "優加"
},
{
"code": "DM65",
"explanation": "一般"
}
],
"rule": [
{
"code": "DM43",
"condition": 2,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 8,
"installments": [
12,
15,
18,
20,
24,
30,
36,
48,
50
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
},
{
"code": "DM64",
"condition": 1,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 8,
"installments": [
12,
15,
18,
20,
24,
30,
36
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
},
{
"code": "DM65",
"condition": 0,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 0,
"installments": [
12,
15,
18,
20,
24,
30,
36
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
}
]
},
{
"product_code": "A1010003",
"bus_type": "AA22",
"explanation": "機車借新還舊",
"promotion_no": [
{
"code": "DM44",
"explanation": "優加"
},
{
"code": "DM45",
"explanation": "一般"
}
],
"rule": [
{
"code": "DM44",
"condition": 1,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 8,
"installments": [
12,
15,
18,
20,
24,
30,
36
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [
"indebted"
],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
},
{
"code": "DM45",
"condition": 0,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 0,
"installments": [
12,
15,
18,
20,
24,
30,
36
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [
"indebted"
],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
}
]
},
{
"product_code": "A1010004",
"bus_type": "AA23",
"explanation": "機車它行代償",
"promotion_no": [
{
"code": "DM66",
"explanation": "優加"
},
{
"code": "DM67",
"explanation": "一般"
}
],
"rule": [
{
"code": "DM66",
"condition": 1,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 8,
"installments": [
12,
15,
18,
20,
24,
30,
36
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
},
{
"code": "DM67",
"condition": 0,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 0,
"installments": [
12,
15,
18,
20,
24,
30,
36
],
"necessary_condition": [
"LDR4"
],
"exclude_condition": [],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
}
]
},
{
"product_code": "A1010005",
"bus_type": "CA20",
"explanation": "商品圓融",
"promotion_no": [
{
"code": "DM41",
"explanation": "優質"
},
{
"code": "DM42",
"explanation": "一般"
},
{
"code": "DM16",
"explanation": "輕鬆富"
}
],
"rule": [
{
"code": "DM41",
"condition": 1,
"cost_max": 200000,
"age_min": 20,
"age_max": 65,
"car_age_max": 0,
"installments": [
12,
15,
18,
20,
24,
30,
36,
42
],
"necessary_condition": [],
"exclude_condition": [
"LDR4"
],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
},
{
"code": "DM42",
"condition": 0,
"cost_max": 100000,
"age_min": 20,
"age_max": 65,
"car_age_max": 0,
"installments": [
12,
15,
18,
20,
24
],
"necessary_condition": [],
"exclude_condition": [
"LDR4"
],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
},
{
"code": "DM16",
"condition": 0,
"cost_max": 100000,
"age_min": 20,
"age_max": 40,
"car_age_max": 0,
"installments": [
12,
15,
18,
20,
24
],
"necessary_condition": [],
"exclude_condition": [
"LDR4"
],
"same_condition": [
[
"LDR14",
"LDR19",
"LDR6"
]
]
}
]
}
],
"product_rule_option": [
{
"code": "LDR4",
"explanation": "機車行照"
},
{
"code": "LDR14",
"explanation": "薪資帳戶存摺存面及內頁"
},
{
"code": "LDR19",
"explanation": "勞保投保資料"
},
{
"code": "LDR6",
"explanation": "在職證明"
},
{
"code": "LDR11",
"explanation": "房屋謄本\/土地謄本"
},
{
"code": "LDR8",
"explanation": "信用卡帳單"
},
{
"code": "LDR9",
"explanation": "貸款繳息紀錄"
},
{
"code": "LDR10",
"explanation": "jcic聯徵"
},
{
"code": "indebted",
"explanation": "裕富既有債務人"
}
],
"product_rule_required": [
{
"code": "LDR23",
"explanation": "申請人申請書"
},
{
"code": "LDR1",
"explanation": "申請人身分證正面"
},
{
"code": "LDR2",
"explanation": "申請人身分證反面"
},
{
"code": "LDR3",
"explanation": "申請人身撥款帳戶存摺封面"
}
]
}
]
}
一碼貸規則查詢參數說明
欄位 | 型態 | 說明 |
---|---|---|
store_uid | string(16) | 特約商商務代號 |
service | text | {"service_name": "ap39", "cmd": "api\/quickpayloanproductrule"} JSON格式,AES256加密資料 |
encry_data | text | 『一碼貸規則查詢』欄位參考,JSON格式,AES256加密資料 |
『一碼貸產品規則』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
store_uid | string | 特店編號 | 必填 |
『一碼貸產品規則』回傳欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
code | string | 交易回傳碼(B200或B500或100) | |
msg | string | 回傳訊息 | |
rows_data | array | 回覆內容 | 回傳B200才有資料 每筆『貸款的產品資訊、規則』欄位參考 |
『貸款的產品資訊、規則』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
company | string | 提供服務的公司 | 裕富:806597592001 |
product_item | array | 產品資訊 | 每筆『產品說明』欄位參考 |
product_rule_option | array | 選填條件規則 | 每筆『選填條件規則』欄位參考 |
product_rule_required | array | 必填條件規則 | 每筆『必填條件規則』欄位參考 |
『產品說明』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
product_code | string | 產品貸碼 | |
bus_type | string | 業務類型 | |
explanation | string | 產品說明 | |
promotion_no | array | 產品等級 | 每筆『產品等級』欄位參考 |
rule | array | 產品等級規則 | 每筆『產品等級規則』欄位參考 |
『選填條件規則』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
code | string | 條件代碼 | |
explanation | string | 條件說明 |
『必填條件規則』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
code | string | 條件代碼 | |
explanation | string | 條件說明 |
『產品等級』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
code | string | 專案代碼 | |
explanation | string | 專案說明 |
『產品等級規則』欄位
參數名稱 | 型態 | 說明 | 必須 |
---|---|---|---|
code | string | 專案代碼 | |
condition | string | 需滿足選填規則條件技術 | |
cost_max | string | 最大可貸款金額 | |
age_min | string | 最小申請年齡 | |
age_max | string | 最大申請年齡 | |
car_age_max | string | 車齡最大限制 | |
installments | array | 分期資訊 | |
necessary_condition | array | 必需滿足選填規則的項目 | 出現在此陣列的條件,為必要選擇的條件,但不列入滿足數的計算 |
exclude_condition | array | 不列入計算的選填規則 | 出現在此陣列的條件,不列入滿足數的計算 |
same_condition | array | 同一類型條件 | 出現在同一個陣列的資料為同一類型 例如: [ ["LDR14","LDR19","LDR6"]["LDR24","LDR26"] ], LDR14、LDR19、LDR6為同一條件,所以只能算滿足條件數1 |
附錄一:交易狀態代碼
1.以下回傳的狀態代碼均須處理,避免系統連線錯誤,39Buy LINK回傳時,貴司系統無法判讀
2.由於上游廠商目前暫無停工審件成功的資料,因此暫無提供審件成功回傳
狀態代碼 | 狀態說明 | 詳細說明 |
---|---|---|
100 | 資料錯誤 | 貸款規則收到資料,但是格式或資料錯誤 |
400 | 系統錯誤訊息 | 查詢執行過程中,發生不明錯誤 |
B200 | 執行成功 | 處理成功執行 |
B500 | 執行失敗 | 處理時,資料異常不予以處理 |
附錄二:資料加密方式說明
- 所有的API送出HTTPs請求之欄位中,service 和 encry_data 欄位皆進行 AES256+BASE64 加密處理。
- AES加密,格式為CBC,長度為256bits,金鑰長度32,IV長度16,傳遞內文為加密後組合IV並經過Base64轉換後傳出。
- IV資料建議隨機產生。
PHP加密示意:
AesEncrypt -> base64_ecode($IV . $JSON)
C#加密示意:
AesEncrypt -> (bytes)IV+(bytes)Json -> toBase64
Java加密示意:
AesEncrypt -> (bytes)IV+(bytes)Json -> toBase64
Node.js加密示意:
AesEncrypt -> concat([IV,JSON], [IV_SIZE,JSON_SIZE]) -> toString('base64')