Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
NafezlyDotCom committed Aug 8, 2023
1 parent d980923 commit 762bc34
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/Classes/TelrPayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct()
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
{
$this->setPassedVariablesToGlobal($amount,$user_id,$user_first_name,$user_last_name,$user_email,$user_phone,$source);
$required_fields = ['amount'];
$required_fields = ['amount','user_first_name','user_last_name','user_email'];
$this->checkRequiredFields($required_fields, 'BINANCE');

$uniqid = uniqid().rand(1000,9999);
Expand All @@ -58,16 +58,25 @@ public function pay($amount = null, $user_id = null, $user_first_name = null, $u
'ivp_test'=>$this->telr_mode=="live"?false:true,
'return_auth'=> route($this->verify_route_name,['payment'=>"telr"]),
'return_decl'=> route($this->verify_route_name,['payment'=>"telr"]),
'return_can'=> route($this->verify_route_name,['payment'=>"telr"])
'return_can'=> route($this->verify_route_name,['payment'=>"telr"]),
'bill_fname' => $this->user_first_name,
'bill_sname' => $this->user_last_name,
'bill_addr1' => "NA",
'bill_addr2' => "NA",
'bill_city' => "NA",
'bill_region' => "NA",
'bill_zip' => "NA",
'bill_country' => "NA",
'bill_email' => $this->user_email,
];
$response = Http::asForm()->post('https://secure.telr.com/gateway/order.json', $data)->json();


if(isset($response['url']))
if(isset($response['order']['url']))
return [
'payment_id'=>$uniqid,
'html'=>"",
'redirect_url'=>$response['url']
'html'=>$response,
'redirect_url'=>$response['order']['url']
];
return [
'payment_id'=>$uniqid,
Expand All @@ -91,7 +100,7 @@ public function verify(Request $request)
'order_amount' => $response['amount'],
'ivp_test'=>$this->telr_mode=="live"?false:true,
];
$response = Http::post('https://secure.telr.com/gateway/order.json', $data);
$response = Http::asForm()->post('https://secure.telr.com/gateway/order.json', $data);
$telrHashCode = $response['code'];
if ($telrHashCode === $telrCallbackData['code']) {
return [
Expand Down

0 comments on commit 762bc34

Please sign in to comment.