forked from kevinowino869/mitrobill
Duitku ok
This commit is contained in:
@ -18,19 +18,69 @@ class PGDuitku
|
||||
$this->trx = $trx;
|
||||
}
|
||||
|
||||
function getSignature($amount,$datetime)
|
||||
{
|
||||
global $_c;
|
||||
return hash('sha256', $_c['duitku_merchant_id'] . $amount . $datetime . $_c['duitku_merchant_key']);
|
||||
}
|
||||
|
||||
|
||||
function createTransaction($channel)
|
||||
{
|
||||
global $_c;
|
||||
$json = [
|
||||
'paymentMethod' => $channel,
|
||||
'paymentAmount' => $this->trx['price'],
|
||||
'merchantCode' => $_c['duitku_merchant_id'],
|
||||
'merchantOrderId' => $this->trx['id'],
|
||||
'productDetails' => $this->trx['plan_name'],
|
||||
'merchantUserInfo' => $this->user['fullname'],
|
||||
'customerVaName' => $this->user['fullname'],
|
||||
'email' => (empty($this->user['email'])) ? $this->user['username'] . '@' . $_SERVER['HTTP_HOST'] : $this->user['email'],
|
||||
'phoneNumber' => $this->user['phonenumber'],
|
||||
'itemDetails' => [
|
||||
[
|
||||
'name' => $this->trx['plan_name'],
|
||||
'price' => $this->trx['price'],
|
||||
'quantity' => 1
|
||||
]
|
||||
],
|
||||
'returnUrl' => U . 'order/view/' . $this->trx['id'] . '/check',
|
||||
'signature' => md5($_c['duitku_merchant_id'] . $this->trx['id'] . $this->trx['price'] . $_c['duitku_merchant_key'])
|
||||
];
|
||||
return json_decode(Http::postJsonData($this->getServer() . 'v2/inquiry', $json), true);
|
||||
/*
|
||||
{
|
||||
"merchantCode": "DXXXX",
|
||||
"reference": "DXXXXCX80TZJ85Q70QCI",
|
||||
"paymentUrl": "https://sandbox.duitku.com/topup/topupdirectv2.aspx?ref=BCA7WZ7EIDXXXXWEC",
|
||||
"vaNumber": "7007014001444348",
|
||||
"qrString": "",
|
||||
"amount": "40000",
|
||||
"statusCode": "00",
|
||||
"statusMessage": "SUCCESS"
|
||||
}
|
||||
00 - Success
|
||||
01 - Pending
|
||||
02 - Canceled
|
||||
*/
|
||||
}
|
||||
|
||||
function getStatus($trxID)
|
||||
function getStatus()
|
||||
{
|
||||
global $_c;
|
||||
$json = [
|
||||
'merchantCode' => $_c['duitku_merchant_id'],
|
||||
'merchantOrderId' => $this->trx['id'],
|
||||
'signature' => md5($_c['duitku_merchant_id'] . $this->trx['id'] . $_c['duitku_merchant_key'])
|
||||
];
|
||||
return json_decode(Http::postJsonData($this->getServer() . 'transactionStatus', $json), true);
|
||||
/*
|
||||
{
|
||||
"merchantOrderId": "abcde12345",
|
||||
"reference": "DXXXXCX80TZJ85Q70QCI",
|
||||
"amount": "100000",
|
||||
"statusCode": "00",
|
||||
"statusMessage": "SUCCESS"
|
||||
}
|
||||
00 - Success
|
||||
01 - Pending
|
||||
02 - Canceled
|
||||
*/
|
||||
}
|
||||
|
||||
private function getServer()
|
||||
|
Reference in New Issue
Block a user