@@ -12,6 +12,16 @@ class Sslcommerz{
1212 private $ emi = false ;
1313 private $ sslHost ;
1414
15+ private $ customerData = [
16+ 'cus_name ' => 'kamal ' ,
17+ 'cus_email ' =>
'[email protected] ' ,
18+ 'cus_phone ' => '01000000000 ' ,
19+ 'cus_add1 ' => 'dhaka ' ,
20+ 'cus_city ' => 'Dhaka ' ,
21+ 'cus_postcode ' => '1210 ' ,
22+ 'cus_country ' => 'Bangladesh ' ,
23+ ];
24+
1525 public function __construct ()
1626 {
1727 if (config ('sslcommerz.sandbox_mode ' ) === 'sandbox ' ) {
@@ -49,18 +59,18 @@ public function emi($month,$selectedMonth)
4959 return $ this ;
5060 }
5161
52- public function customer ($ name ,$ email ,$ add1 ,$ city ,$ post_code ,$ country ,$ phone ){
53- $ data ['cus_name ' ] = $ name ;
54- $ data ['cus_email ' ] = $ email ;
55- $ data ['cus_add1 ' ] = $ add1 ;
56- $ data ['cus_city ' ] = $ city ;
57- $ data ['cus_postcode ' ] = $ postcode ;
58- $ data ['cus_country ' ] = $ country ;
59- $ data ['cus_phone ' ] = $ phone ;
62+ public function customer ($ name = '' , $ email = '' , $ phone = '' , $ add1 = '' , $ city = '' , $ post_code = '' , $ country = '' ){
63+ $ this ->customerData ['cus_name ' ] = $ name == '' ? $ this ->customerData ['cus_name ' ] : $ name ;
64+ $ this ->customerData ['cus_email ' ] = $ email == '' ? $ this ->customerData ['cus_email ' ] : $ email ;
65+ $ this ->customerData ['cus_phone ' ] = $ phone == '' ? $ this ->customerData ['cus_phone ' ] : $ phone ;
66+ $ this ->customerData ['cus_add1 ' ] = $ add1 == '' ? $ this ->customerData ['cus_name ' ] : $ add1 ;
67+ $ this ->customerData ['cus_city ' ] = $ city == '' ? $ this ->customerData ['cus_city ' ] : $ city ;
68+ $ this ->customerData ['cus_postcode ' ] = $ post_code == '' ? $ this ->customerData ['cus_name ' ] : $ post_code ;
69+ $ this ->customerData ['cus_country ' ] = $ country == '' ? $ this ->customerData ['cus_name ' ] : $ country ;
70+ return $ this ;
6071 }
6172
62-
63- public function getSession ()
73+ public function getRedirectUrl ()
6474 {
6575 $ data = [
6676 'store_id ' => config ('sslcommerz.store_id ' ),
@@ -72,27 +82,17 @@ public function getSession()
7282 'fail_url ' => config ('sslcommerz.fail_url ' ),
7383 'cancel_url ' => config ('sslcommerz.cancel_url ' ),
7484 'ipn_url ' => config ('sslcommerz.ipn_url ' ),
75- 'cus_name ' => 'kamal ' ,
76- 'cus_email ' =>
'[email protected] ' ,
77- 'cus_add1 ' => 'dhaka ' ,
78- 'cus_add2 ' =>'dhaka ' ,
79- 'cus_city ' =>'dhaka ' ,
80- 'cus_state ' =>'dhaka ' ,
81- 'cus_postcode ' =>'302 ' ,
82- 'cus_country ' =>'Bangladesh ' ,
83- 'cus_phone ' =>'01711111111 ' ,
84- 'cus_fax ' =>'01711111111 ' ,
85- 'product_name ' => 'kamal ' ,
86- 'product_category ' => 'phone ' ,
85+ 'cus_name ' => $ this ->customerData ['cus_name ' ],
86+ 'cus_email ' => $ this ->customerData ['cus_email ' ],
87+ 'cus_add1 ' => $ this ->customerData ['cus_add1 ' ],
88+ 'cus_city ' => $ this ->customerData ['cus_city ' ],
89+ 'cus_postcode ' => $ this ->customerData ['cus_postcode ' ],
90+ 'cus_country ' => $ this ->customerData ['cus_country ' ],
91+ 'cus_phone ' => $ this ->customerData ['cus_phone ' ],
92+ 'product_name ' => 'ecom ' ,
93+ 'product_category ' => 'ecom ' ,
8794 'product_profile ' => 'general ' ,
8895 'shipping_method ' => 'NO ' ,
89- 'ship_name ' =>'Customer Name ' ,
90- 'ship_add1 ' =>'Dhaka ' ,
91- 'ship_add2 ' =>'Dhaka ' ,
92- 'ship_city ' =>'Dhaka ' ,
93- 'ship_state ' =>'Dhaka ' ,
94- 'ship_postcode ' =>'1000 ' ,
95- 'ship_country ' =>'Bangladesh ' ,
9696 'multi_card_name ' =>'mastercard,visacard,amexcard ' ,
9797 'value_a ' =>'ref001_A ' ,
9898 'value_b ' =>'ref002_B ' ,
@@ -120,7 +120,7 @@ public function getSession()
120120
121121 }
122122
123- public function validate ($ request )
123+ public function verify ($ request )
124124 {
125125 $ http = new Client ([
126126 'base_uri ' => $ this ->sslHost ,
0 commit comments