Test Setup Failed
Branch development (80c362)
by Ashutosh
14:59
created
app/Plugins/Stripe/Controllers/ProcessController.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -31,17 +31,17 @@  discard block
 block discarded – undo
31 31
             $request = $requests['request'];
32 32
             $invoice = $requests['invoice'];
33 33
             $cart = \Cart::getContent();
34
-            if (! $cart->count()) {
34
+            if (!$cart->count()) {
35 35
                 \Cart::clear();
36 36
             } else {
37 37
                 $invoice->grand_total = \Cart::getTotal();
38 38
             }
39 39
             if ($request->input('payment_gateway') == 'Stripe') {
40
-                if (! \Schema::hasTable('stripe')) {
40
+                if (!\Schema::hasTable('stripe')) {
41 41
                     throw new \Exception('Stripe is not configured');
42 42
                 }
43 43
                 $stripe = $this->stripe->where('id', 1)->first();
44
-                if (! $stripe) {
44
+                if (!$stripe) {
45 45
                     throw new \Exception('Stripe Fields not given');
46 46
                 }
47 47
                 \Session::put('invoice', $invoice);
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
             $payment_method = \Session::get('payment_method');
62 62
             $regularPayment = true;
63 63
             $invoice = \Session::get('invoice');
64
-            if (! $total) {
64
+            if (!$total) {
65 65
                 $paid = 0;
66 66
                 // $total = \Session::get('totalToBePaid');
67 67
                 $regularPayment = false;
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
                 $amount = rounding(\Cart::getTotal());
89 89
                 \View::addNamespace('plugins', $path);
90 90
 
91
-                echo view('plugins::middle-page', compact('invoice', 'amount', 'invoice_no', 'payment_method', 'invoice', 'regularPayment', ))->render();
91
+                echo view('plugins::middle-page', compact('invoice', 'amount', 'invoice_no', 'payment_method', 'invoice', 'regularPayment',))->render();
92 92
             }
93 93
         } catch (\Exception $ex) {
94 94
             throw new \Exception($ex->getMessage());
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function payment($payment_method, $status)
115 115
     {
116
-        if (! $payment_method) {
116
+        if (!$payment_method) {
117 117
             $payment_method = '';
118 118
             $status = 'success';
119 119
         }
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -71,7 +71,8 @@
 block discarded – undo
71 71
                 $invoice->processing_fee = $processingFee;
72 72
                 $invoice->grand_total = intval($invoice->grand_total * (1 + $processingFee / 100));
73 73
                 $amount = rounding($invoice->grand_total);
74
-                if (count($invoice->payment()->get())) {//If partial payment is made
74
+                if (count($invoice->payment()->get())) {
75
+//If partial payment is made
75 76
                     $paid = array_sum($invoice->payment()->pluck('amount')->toArray());
76 77
                     $amount = rounding($invoice->grand_total - $paid);
77 78
                 }
Please login to merge, or discard this patch.
app/Plugins/Stripe/Controllers/SettingsController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
     public function Settings()
23 23
     {
24 24
         try {
25
-            if (! Schema::hasTable('stripe')) {
26
-                Schema::create('stripe', function ($table) {
25
+            if (!Schema::hasTable('stripe')) {
26
+                Schema::create('stripe', function($table) {
27 27
                     $table->increments('id');
28 28
                     $table->string('image_url');
29 29
                     $table->string('processing_fee');
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             // //dd($ccavanue);
38 38
             $stripe = $stripe1->where('id', '1')->first();
39 39
 
40
-            if (! $stripe) {
40
+            if (!$stripe) {
41 41
                 \Artisan::call('db:seed', ['--class' => 'database\\seeds\\StripeSupportedCurrencySeeder', '--force' => true]);
42 42
             }
43 43
             $allCurrencies = StripePayment::pluck('currencies', 'id')->toArray();
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
             $invoice = \Session::get('invoice');
128 128
             // $invoiceTotal = \Session::get('totalToBePaid');
129 129
             $amount = rounding(\Cart::getTotal());
130
-            if (! $amount) {//During renewal
130
+            if (!$amount) {//During renewal
131 131
                 $amount = rounding(\Session::get('totalToBePaid'));
132 132
             }
133 133
             $stripeSecretKey = ApiKey::pluck('stripe_secret')->first();
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
                     'cvc'       => $request->get('cvv'),
141 141
                 ],
142 142
             ]);
143
-            if (! isset($token['id'])) {
143
+            if (!isset($token['id'])) {
144 144
                 \Session::put('error', 'The Stripe Token was not generated correctly');
145 145
 
146 146
                 return redirect()->route('stripform');
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -127,7 +127,8 @@
 block discarded – undo
127 127
             $invoice = \Session::get('invoice');
128 128
             // $invoiceTotal = \Session::get('totalToBePaid');
129 129
             $amount = rounding(\Cart::getTotal());
130
-            if (! $amount) {//During renewal
130
+            if (! $amount) {
131
+//During renewal
131 132
                 $amount = rounding(\Session::get('totalToBePaid'));
132 133
             }
133 134
             $stripeSecretKey = ApiKey::pluck('stripe_secret')->first();
Please login to merge, or discard this patch.
app/Plugins/Razorpay/routes.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-Event::listen('App\Events\PaymentGateway', function ($event) {
3
+Event::listen('App\Events\PaymentGateway', function($event) {
4 4
     $controller = new App\Plugins\Razorpay\Controllers\ProcessController();
5 5
     echo $controller->PassToPayment($event->para);
6 6
 });
Please login to merge, or discard this patch.
app/Plugins/Razorpay/views/middle-page.blade.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,11 +20,11 @@  discard block
 block discarded – undo
20 20
 @section('main-class') "main shop" @stop
21 21
 @section('content')
22 22
 <?php
23
- $taxAmt = 0;
23
+    $taxAmt = 0;
24 24
 $cartSubtotalWithoutCondition = 0;
25 25
  
26 26
 use Razorpay\Api\Api;
27
- $merchant_orderid= generateMerchantRandomString();  
27
+    $merchant_orderid= generateMerchantRandomString();  
28 28
 
29 29
 function generateMerchantRandomString($length = 10) {
30 30
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
 }
36 36
 return $randomString;
37 37
 }
38
- $api = new Api($rzp_key, $rzp_secret);
38
+    $api = new Api($rzp_key, $rzp_secret);
39 39
 $displayCurrency = \Auth::user()->currency;
40 40
 $symbol = \Auth::user()->currency;
41 41
 if ($symbol == 'INR'){
@@ -56,15 +56,15 @@  discard block
 block discarded – undo
56 56
 
57 57
 } else {
58 58
  
59
- $url = "http://apilayer.net/api/live?access_key=$apilayer_key";
60
- $exchange = json_decode(file_get_contents($url));
59
+    $url = "http://apilayer.net/api/live?access_key=$apilayer_key";
60
+    $exchange = json_decode(file_get_contents($url));
61 61
 
62
- $exchangeRate = $exchange->quotes->USDINR;
63
- // dd($exchangeRate);
64
- $displayAmount =$exchangeRate * $invoice->grand_total ;
62
+    $exchangeRate = $exchange->quotes->USDINR;
63
+    // dd($exchangeRate);
64
+    $displayAmount =$exchangeRate * $invoice->grand_total ;
65 65
 
66 66
 
67
- $orderData = [
67
+    $orderData = [
68 68
 'receipt'         => 3456,
69 69
 'amount'          =>  round($displayAmount)*100, // 2000 rupees in paise
70 70
 
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     "key"               => $rzp_key,
87 87
     "name"              => 'Faveo Helpdesk',
88 88
     "currency"          => 'INR',
89
-     "prefill"=> [
89
+        "prefill"=> [
90 90
         "contact"=>    \Auth::user()->mobile_code .\Auth::user()->mobile,
91 91
         "email"=>      \Auth::user()->email,
92 92
     ],
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 $json = json_encode($data);
125 125
 
126 126
 
127
- $currency = \Auth::user()->currency;
127
+    $currency = \Auth::user()->currency;
128 128
 
129 129
 
130 130
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 $cartSubtotalWithoutCondition = 0;
25 25
  
26 26
 use Razorpay\Api\Api;
27
- $merchant_orderid= generateMerchantRandomString();  
27
+ $merchant_orderid = generateMerchantRandomString();  
28 28
 
29 29
 function generateMerchantRandomString($length = 10) {
30 30
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
@@ -38,15 +38,15 @@  discard block
 block discarded – undo
38 38
  $api = new Api($rzp_key, $rzp_secret);
39 39
 $displayCurrency = \Auth::user()->currency;
40 40
 $symbol = \Auth::user()->currency;
41
-if ($symbol == 'INR'){
41
+if ($symbol == 'INR') {
42 42
 
43 43
 
44
-$exchangeRate= '';
44
+$exchangeRate = '';
45 45
 
46 46
 
47 47
 $orderData = [
48 48
 'receipt'         => 3456,
49
-'amount'          => round($invoice->grand_total*100), // 2000 rupees in paise
49
+'amount'          => round($invoice->grand_total * 100), // 2000 rupees in paise
50 50
 
51 51
 'currency'        => 'INR',
52 52
 'payment_capture' => 0 // auto capture
@@ -61,12 +61,12 @@  discard block
 block discarded – undo
61 61
 
62 62
  $exchangeRate = $exchange->quotes->USDINR;
63 63
  // dd($exchangeRate);
64
- $displayAmount =$exchangeRate * $invoice->grand_total ;
64
+ $displayAmount = $exchangeRate * $invoice->grand_total;
65 65
 
66 66
 
67 67
  $orderData = [
68 68
 'receipt'         => 3456,
69
-'amount'          =>  round($displayAmount)*100, // 2000 rupees in paise
69
+'amount'          =>  round($displayAmount) * 100, // 2000 rupees in paise
70 70
 
71 71
 'currency'        => 'INR',
72 72
 'payment_capture' => 0 // auto capture
@@ -87,10 +87,10 @@  discard block
 block discarded – undo
87 87
     "name"              => 'Faveo Helpdesk',
88 88
     "currency"          => 'INR',
89 89
      "prefill"=> [
90
-        "contact"=>    \Auth::user()->mobile_code .\Auth::user()->mobile,
90
+        "contact"=>    \Auth::user()->mobile_code.\Auth::user()->mobile,
91 91
         "email"=>      \Auth::user()->email,
92 92
     ],
93
-    "description"       =>  'Order for Invoice No' .-$invoice->number,
93
+    "description"       =>  'Order for Invoice No'.-$invoice->number,
94 94
     "notes"             => [
95 95
     "First Name"         => \Auth::user()->first_name,
96 96
     "Last Name"         =>  \Auth::user()->last_name,
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 if ($displayCurrency !== 'INR')
119 119
 {
120 120
     $data['display_currency']  = 'USD';
121
-    $data['display_amount']    =$invoice->grand_total;
121
+    $data['display_amount']    = $invoice->grand_total;
122 122
     
123 123
 }
124 124
 $json = json_encode($data);
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
                         if (strpos(\Session::get('codevalue'), '%') == true) {
253 253
                                 $discountValue = \Session::get('codevalue');
254 254
                             } else {
255
-                                $discountValue = currencyFormat(\Session::get('codevalue'),$code = $item->attributes->currency);
255
+                                $discountValue = currencyFormat(\Session::get('codevalue'), $code = $item->attributes->currency);
256 256
                             }
257 257
                         ?>
258 258
 
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
                  @if($tax->getName()!= 'null')
270 270
                 <tr class="Taxes">
271 271
                     <?php
272
-                    $bifurcateTax = bifurcateTax($tax->getName(),$tax->getValue(),$item->attributes->currency, \Auth::user()->state, \Cart::getContent()->sum('price'));
272
+                    $bifurcateTax = bifurcateTax($tax->getName(), $tax->getValue(), $item->attributes->currency, \Auth::user()->state, \Cart::getContent()->sum('price'));
273 273
                     ?>
274 274
                    <th>
275 275
                         
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
                 @if($tax->conditions->getName() != 'null')
291 291
                 <tr class="Taxes">
292 292
                     <?php
293
-                    $bifurcateTax = bifurcateTax($tax->conditions->getName(),$tax->conditions->getValue(),$item->attributes->currency, \Auth::user()->state, $tax->price*$tax->quantity);
293
+                    $bifurcateTax = bifurcateTax($tax->conditions->getName(), $tax->conditions->getValue(), $item->attributes->currency, \Auth::user()->state, $tax->price * $tax->quantity);
294 294
                     ?>
295 295
                    <th>
296 296
                         
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
             <tbody>
383 383
                 <tr class="cart-subtotal">
384 384
                     <?php 
385
-                    $subtotals = App\Model\Order\InvoiceItem::where('invoice_id',$invoice->id)->pluck('regular_price')->toArray();
385
+                    $subtotals = App\Model\Order\InvoiceItem::where('invoice_id', $invoice->id)->pluck('regular_price')->toArray();
386 386
                     $subtotal = array_sum($subtotals);
387 387
                     ?>
388 388
                     <th>
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
                                        
420 420
                     <tr>
421 421
                          <?php
422
-                        $bifurcateTax = bifurcateTax($taxDetails[0],$taxDetails[1],\Auth::user()->currency, \Auth::user()->state, $taxAmt);
422
+                        $bifurcateTax = bifurcateTax($taxDetails[0], $taxDetails[1], \Auth::user()->currency, \Auth::user()->state, $taxAmt);
423 423
                         ?>
424 424
                         <th>
425 425
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -26,7 +26,8 @@  discard block
 block discarded – undo
26 26
 use Razorpay\Api\Api;
27 27
  $merchant_orderid= generateMerchantRandomString();  
28 28
 
29
-function generateMerchantRandomString($length = 10) {
29
+function generateMerchantRandomString($length = 10)
30
+{
30 31
 $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
31 32
 $charactersLength = strlen($characters);
32 33
 $randomString = '';
@@ -38,7 +39,7 @@  discard block
 block discarded – undo
38 39
  $api = new Api($rzp_key, $rzp_secret);
39 40
 $displayCurrency = \Auth::user()->currency;
40 41
 $symbol = \Auth::user()->currency;
41
-if ($symbol == 'INR'){
42
+if ($symbol == 'INR') {
42 43
 
43 44
 
44 45
 $exchangeRate= '';
@@ -115,8 +116,7 @@  discard block
 block discarded – undo
115 116
     "order_id"          => $razorpayOrderId,
116 117
 ];
117 118
 
118
-if ($displayCurrency !== 'INR')
119
-{
119
+if ($displayCurrency !== 'INR') {
120 120
     $data['display_currency']  = 'USD';
121 121
     $data['display_amount']    =$invoice->grand_total;
122 122
     
Please login to merge, or discard this patch.
app/Plugins/Razorpay/Controllers/ProcessController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
             $request = $requests['request'];
33 33
             $invoice = $requests['invoice'];
34 34
             $cart = \Cart::getContent();
35
-            if (! $cart->count()) {
35
+            if (!$cart->count()) {
36 36
                 \Cart::clear();
37 37
             } else {
38 38
                 $invoice->grand_total = \Cart::getTotal();
39 39
             }
40 40
             if ($request->input('payment_gateway') == 'Razorpay') {
41
-                if (! \Schema::hasTable('razorpay')) {
41
+                if (!\Schema::hasTable('razorpay')) {
42 42
                     throw new \Exception('Razorpay is not configured');
43 43
                 }
44 44
                 $stripe = $this->razorpay->where('id', 1)->first();
45
-                if (! $stripe) {
45
+                if (!$stripe) {
46 46
                     throw new \Exception('Razorpay Fields not given');
47 47
                 }
48 48
                 \Session::put('invoice', $invoice);
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
             $total = intval(\Cart::getTotal());
66 66
             $invoice = \Session::get('invoice');
67 67
             $regularPayment = true;
68
-            if (! $total) {//When renewal
68
+            if (!$total) {//When renewal
69 69
                 $paid = 0;
70 70
                 // $total = \Session::get('totalToBePaid');
71 71
                 $regularPayment = false;
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 
121 121
     public function payment($payment_method, $status)
122 122
     {
123
-        if (! $payment_method) {
123
+        if (!$payment_method) {
124 124
             $payment_method = '';
125 125
             $status = 'success';
126 126
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -65,7 +65,8 @@  discard block
 block discarded – undo
65 65
             $total = intval(\Cart::getTotal());
66 66
             $invoice = \Session::get('invoice');
67 67
             $regularPayment = true;
68
-            if (! $total) {//When renewal
68
+            if (! $total) {
69
+//When renewal
69 70
                 $paid = 0;
70 71
                 // $total = \Session::get('totalToBePaid');
71 72
                 $regularPayment = false;
@@ -77,7 +78,8 @@  discard block
 block discarded – undo
77 78
                 $invoice->processing_fee = $processingFee;
78 79
                 $invoice->grand_total = intval($invoice->grand_total * (1 + $processingFee / 100));
79 80
                 $totalPaid = $invoice->grand_total;
80
-                if (count($invoice->payment()->get())) {//If partial payment is made
81
+                if (count($invoice->payment()->get())) {
82
+//If partial payment is made
81 83
                     $paid = array_sum($invoice->payment()->pluck('amount')->toArray());
82 84
                     $totalPaid = $invoice->grand_total - $paid;
83 85
                 }
@@ -85,7 +87,8 @@  discard block
 block discarded – undo
85 87
                 \View::addNamespace('plugins', $path);
86 88
 
87 89
                 echo view('plugins::middle-page', compact('total', 'rzp_key', 'rzp_secret', 'apilayer_key', 'invoice', 'regularPayment', 'items', 'product', 'amount', 'paid', 'totalPaid'));
88
-            } else {//When regular payment
90
+            } else {
91
+//When regular payment
89 92
                 $pay = $this->payment($payment_method, $status = 'pending');
90 93
                 $payment_method = $pay['payment'];
91 94
                 $invoice_no = $invoice->number;
Please login to merge, or discard this patch.
app/Plugins/Razorpay/Controllers/SettingsController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,8 +24,8 @@  discard block
 block discarded – undo
24 24
     public function Settings()
25 25
     {
26 26
         try {
27
-            if (! Schema::hasTable('razorpay')) {
28
-                Schema::create('razorpay', function ($table) {
27
+            if (!Schema::hasTable('razorpay')) {
28
+                Schema::create('razorpay', function($table) {
29 29
                     $table->increments('id');
30 30
                     $table->string('image_url');
31 31
                     $table->string('processing_fee');
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
             // //dd($ccavanue);
40 40
             $razorpay = $razorpay1->where('id', '1')->first();
41 41
 
42
-            if (! $razorpay) {
42
+            if (!$razorpay) {
43 43
                 \Artisan::call('db:seed', ['--class' => 'database\\seeds\\RazorpaySupportedCurrencySeeder', '--force' => true]);
44 44
             }
45 45
             $allCurrencies = RazorpayPayment::pluck('currencies', 'id')->toArray();
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
             $invoice = \Session::get('invoice');
151 151
             $invoiceTotal = \Session::get('totalToBePaid');
152 152
             $amount = rounding(\Cart::getTotal());
153
-            if (! $amount) {//During renewal
153
+            if (!$amount) {//During renewal
154 154
                 if (rounding($request->input('amount')) != rounding($invoiceTotal)) {
155 155
                     throw new \Exception('Invalid modification of data');
156 156
                 }
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
                     'cvc'       => $request->get('cvv'),
167 167
                 ],
168 168
             ]);
169
-            if (! isset($token['id'])) {
169
+            if (!isset($token['id'])) {
170 170
                 \Session::put('error', 'The Stripe Token was not generated correctly');
171 171
 
172 172
                 return redirect()->route('stripform');
Please login to merge, or discard this patch.
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -150,7 +150,8 @@
 block discarded – undo
150 150
             $invoice = \Session::get('invoice');
151 151
             $invoiceTotal = \Session::get('totalToBePaid');
152 152
             $amount = rounding(\Cart::getTotal());
153
-            if (! $amount) {//During renewal
153
+            if (! $amount) {
154
+//During renewal
154 155
                 if (rounding($request->input('amount')) != rounding($invoiceTotal)) {
155 156
                     throw new \Exception('Invalid modification of data');
156 157
                 }
Please login to merge, or discard this patch.