Skip to content

Commit b3fee63

Browse files
author
Mostafa Kamal
committed
sslcommerz
sslcommerz
1 parent dd31edc commit b3fee63

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/Sslcommerz.php

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,15 @@ class Sslcommerz{
1010
private $tnx;
1111
private $airTicket = [];
1212
private $emi = false;
13+
private $sslHost;
1314

1415
public function __construct()
1516
{
17+
if (config('sslcommerz.sandbox_mode') === 'sandbox') {
18+
$this->sslHost = "https://sandbox.sslcommerz.com/";
19+
}else{
20+
$this->sslHost = "https://securepay.sslcommerz.com/";
21+
}
1622

1723
}
1824

@@ -101,21 +107,14 @@ public function getSession()
101107
}
102108

103109
$http = new Client([
104-
'base_uri' => 'https://sandbox.sslcommerz.com/',
110+
'base_uri' => $this->sslHost,
105111
]);
106112

107113
$response = $http->post('gwprocess/v4/api.php',[
108114
'form_params' => $data
109115
]);
110116

111117
$body = json_decode($response->getBody());
112-
113-
$response2 = $http->get('validator/api/merchantTransIDvalidationAPI.php',[
114-
'sessionkey' => 'A217BAE3045C599323850C882DD583F4',
115-
'store_id' => config('sslcommerz.store_id'),
116-
'store_passwd' => config('sslcommerz.store_password'),
117-
]);
118-
$body2 = json_decode($response2->getBody());
119118
// return $body->redirectGatewayURL;
120119
return $body;
121120

@@ -124,7 +123,7 @@ public function getSession()
124123
public function validate($request)
125124
{
126125
$http = new Client([
127-
'base_uri' => 'https://sandbox.sslcommerz.com/',
126+
'base_uri' => $this->sslHost,
128127
]);
129128

130129
$response = $http->get('validator/api/merchantTransIDvalidationAPI.php',[

0 commit comments

Comments
 (0)