Skip to content

Commit 762bc34

Browse files
committed
updates
1 parent d980923 commit 762bc34

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

src/Classes/TelrPayment.php

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct()
4242
public function pay($amount = null, $user_id = null, $user_first_name = null, $user_last_name = null, $user_email = null, $user_phone = null, $source = null): array
4343
{
4444
$this->setPassedVariablesToGlobal($amount,$user_id,$user_first_name,$user_last_name,$user_email,$user_phone,$source);
45-
$required_fields = ['amount'];
45+
$required_fields = ['amount','user_first_name','user_last_name','user_email'];
4646
$this->checkRequiredFields($required_fields, 'BINANCE');
4747

4848
$uniqid = uniqid().rand(1000,9999);
@@ -58,16 +58,25 @@ public function pay($amount = null, $user_id = null, $user_first_name = null, $u
5858
'ivp_test'=>$this->telr_mode=="live"?false:true,
5959
'return_auth'=> route($this->verify_route_name,['payment'=>"telr"]),
6060
'return_decl'=> route($this->verify_route_name,['payment'=>"telr"]),
61-
'return_can'=> route($this->verify_route_name,['payment'=>"telr"])
61+
'return_can'=> route($this->verify_route_name,['payment'=>"telr"]),
62+
'bill_fname' => $this->user_first_name,
63+
'bill_sname' => $this->user_last_name,
64+
'bill_addr1' => "NA",
65+
'bill_addr2' => "NA",
66+
'bill_city' => "NA",
67+
'bill_region' => "NA",
68+
'bill_zip' => "NA",
69+
'bill_country' => "NA",
70+
'bill_email' => $this->user_email,
6271
];
6372
$response = Http::asForm()->post('https://secure.telr.com/gateway/order.json', $data)->json();
6473

6574

66-
if(isset($response['url']))
75+
if(isset($response['order']['url']))
6776
return [
6877
'payment_id'=>$uniqid,
69-
'html'=>"",
70-
'redirect_url'=>$response['url']
78+
'html'=>$response,
79+
'redirect_url'=>$response['order']['url']
7180
];
7281
return [
7382
'payment_id'=>$uniqid,
@@ -91,7 +100,7 @@ public function verify(Request $request)
91100
'order_amount' => $response['amount'],
92101
'ivp_test'=>$this->telr_mode=="live"?false:true,
93102
];
94-
$response = Http::post('https://secure.telr.com/gateway/order.json', $data);
103+
$response = Http::asForm()->post('https://secure.telr.com/gateway/order.json', $data);
95104
$telrHashCode = $response['code'];
96105
if ($telrHashCode === $telrCallbackData['code']) {
97106
return [

0 commit comments

Comments
 (0)