@@ -53,17 +53,17 @@ |
||
| 53 | 53 | case '1': |
| 54 | 54 | $lastFour = '000'.$agents; |
| 55 | 55 | break; |
| 56 | - case '2': |
|
| 56 | + case '2': |
|
| 57 | 57 | |
| 58 | 58 | $lastFour = '00'.$agents; |
| 59 | - break; |
|
| 60 | - case '3': |
|
| 59 | + break; |
|
| 60 | + case '3': |
|
| 61 | 61 | $lastFour = '0'.$agents; |
| 62 | - break; |
|
| 63 | - case '4': |
|
| 62 | + break; |
|
| 63 | + case '4': |
|
| 64 | 64 | $lastFour = $agents; |
| 65 | 65 | |
| 66 | - break; |
|
| 66 | + break; |
|
| 67 | 67 | default: |
| 68 | 68 | $lastFour = '0000'; |
| 69 | 69 | break; |
@@ -350,8 +350,8 @@ |
||
| 350 | 350 | if (strlen($num) > 3) { |
| 351 | 351 | $lastthree = substr($num, strlen($num) - 3, strlen($num)); |
| 352 | 352 | $restunits = substr($num, 0, strlen($num) - 3); // extracts the last three digits |
| 353 | - $restunits = (strlen($restunits) % 2 == 1) ? '0'.$restunits : $restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. |
|
| 354 | - $expunit = str_split($restunits, 2); |
|
| 353 | + $restunits = (strlen($restunits) % 2 == 1) ? '0'.$restunits : $restunits; // explodes the remaining digits in 2's formats, adds a zero in the beginning to maintain the 2's grouping. |
|
| 354 | + $expunit = str_split($restunits, 2); |
|
| 355 | 355 | for ($i = 0; $i < sizeof($expunit); $i++) { |
| 356 | 356 | // creates each of the 2's group and adds a comma to the end |
| 357 | 357 | if ($i == 0) { |
@@ -81,12 +81,12 @@ discard block |
||
| 81 | 81 | $response = ['success' => true]; |
| 82 | 82 | |
| 83 | 83 | // if message given |
| 84 | - if (! empty($message)) { |
|
| 84 | + if (!empty($message)) { |
|
| 85 | 85 | $response['message'] = $message; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | // If data given |
| 89 | - if (! empty($data)) { |
|
| 89 | + if (!empty($data)) { |
|
| 90 | 90 | $response['data'] = $data; |
| 91 | 91 | } |
| 92 | 92 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | { |
| 104 | 104 | // caching for 4 seconds so for consecutive queries, it will be readily available. And even if someone updates their |
| 105 | 105 | // timezone, it will start showing the new timezone after 4 seconds |
| 106 | - $timezone = Cache::remember('timezone_'.Auth::user()->id, 5, function () { |
|
| 106 | + $timezone = Cache::remember('timezone_'.Auth::user()->id, 5, function() { |
|
| 107 | 107 | return Auth::user()->timezone->name; |
| 108 | 108 | }); |
| 109 | 109 | |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | function getDateHtml(string $dateTimeString = null) |
| 119 | 119 | { |
| 120 | 120 | try { |
| 121 | - if (! $dateTimeString) { |
|
| 121 | + if (!$dateTimeString) { |
|
| 122 | 122 | return '--'; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | function getVersionAndLabel($productVersion, $productId, $badge = 'label') |
| 147 | 147 | { |
| 148 | - $latestVersion = \Cache::remember('latest_'.$productId, 10, function () use ($productId) { |
|
| 148 | + $latestVersion = \Cache::remember('latest_'.$productId, 10, function() use ($productId) { |
|
| 149 | 149 | return ProductUpload::where('product_id', $productId)->latest()->value('version'); |
| 150 | 150 | }); |
| 151 | 151 | if ($productVersion) { |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | try { |
| 272 | 272 | $currency = Setting::find(1)->default_currency; |
| 273 | 273 | $currency_symbol = Setting::find(1)->default_symbol; |
| 274 | - if (! \Auth::user()) {//When user is not logged in |
|
| 274 | + if (!\Auth::user()) {//When user is not logged in |
|
| 275 | 275 | $location = getLocation(); |
| 276 | 276 | $country = findCountryByGeoip($location['iso_code']); |
| 277 | 277 | $userCountry = Country::where('country_code_char2', $country)->first(); |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | } else { |
| 365 | 365 | $thecash = $num; |
| 366 | 366 | } |
| 367 | - if (! empty($number[1])) { |
|
| 367 | + if (!empty($number[1])) { |
|
| 368 | 368 | if (strlen($number[1]) == 1) { |
| 369 | 369 | return $thecash.'.'.$number[1].'0'; |
| 370 | 370 | } elseif (strlen($number[1]) == 2) { |
@@ -271,7 +271,8 @@ discard block |
||
| 271 | 271 | try { |
| 272 | 272 | $currency = Setting::find(1)->default_currency; |
| 273 | 273 | $currency_symbol = Setting::find(1)->default_symbol; |
| 274 | - if (! \Auth::user()) {//When user is not logged in |
|
| 274 | + if (! \Auth::user()) { |
|
| 275 | +//When user is not logged in |
|
| 275 | 276 | $location = getLocation(); |
| 276 | 277 | $country = findCountryByGeoip($location['iso_code']); |
| 277 | 278 | $userCountry = Country::where('country_code_char2', $country)->first(); |
@@ -285,7 +286,8 @@ discard block |
||
| 285 | 286 | $currency = \Auth::user()->currency; |
| 286 | 287 | $currency_symbol = \Auth::user()->currency_symbol; |
| 287 | 288 | } |
| 288 | - if ($userid != '') {//For Admin Panel Clients |
|
| 289 | + if ($userid != '') { |
|
| 290 | +//For Admin Panel Clients |
|
| 289 | 291 | $currencyAndSymbol = getCurrency($userid); |
| 290 | 292 | $currency = $currencyAndSymbol['currency']; |
| 291 | 293 | $currency_symbol = $currencyAndSymbol['symbol']; |
@@ -46,14 +46,14 @@ |
||
| 46 | 46 | public function handle(PhpMailController $phpMailController) |
| 47 | 47 | { |
| 48 | 48 | $p = $phpMailController->mailing( |
| 49 | - $this->from, |
|
| 50 | - $this->to, |
|
| 51 | - $this->template_data, |
|
| 52 | - $this->template_name, |
|
| 53 | - $this->replace, |
|
| 54 | - $this->type, |
|
| 55 | - $this->bcc |
|
| 56 | - ); |
|
| 49 | + $this->from, |
|
| 50 | + $this->to, |
|
| 51 | + $this->template_data, |
|
| 52 | + $this->template_name, |
|
| 53 | + $this->replace, |
|
| 54 | + $this->type, |
|
| 55 | + $this->bcc |
|
| 56 | + ); |
|
| 57 | 57 | |
| 58 | 58 | return $p; |
| 59 | 59 | } |
@@ -34,7 +34,7 @@ |
||
| 34 | 34 | $dbPassword = $this->option('password') ? $this->option('password') : env('DB_PASSWORD'); |
| 35 | 35 | $dbName = $this->option('database') ? $this->option('database') : 'billing_testing_db'; |
| 36 | 36 | |
| 37 | - $dbPassword = ! $dbPassword ? '' : $dbPassword; |
|
| 37 | + $dbPassword = !$dbPassword ? '' : $dbPassword; |
|
| 38 | 38 | $this->setupConfig($dbUsername, $dbPassword, '', 'Innodb'); |
| 39 | 39 | |
| 40 | 40 | echo "\nCreating database...\n"; |
@@ -82,7 +82,7 @@ |
||
| 82 | 82 | if (is_file($env)) { |
| 83 | 83 | unlink($env); |
| 84 | 84 | } |
| 85 | - if (! is_file($env)) { |
|
| 85 | + if (!is_file($env)) { |
|
| 86 | 86 | \File::put($env, $contents); |
| 87 | 87 | } |
| 88 | 88 | } |
@@ -23,12 +23,12 @@ |
||
| 23 | 23 | .DIRECTORY_SEPARATOR.'library'.DIRECTORY_SEPARATOR. |
| 24 | 24 | 'HTMLPurifier'.DIRECTORY_SEPARATOR.'DefinitionCache' |
| 25 | 25 | .DIRECTORY_SEPARATOR.'Serializer'); |
| 26 | - if (! File::exists($path)) { |
|
| 26 | + if (!File::exists($path)) { |
|
| 27 | 27 | File::makeDirectory($path, $mode = 0777, true, true); |
| 28 | 28 | } |
| 29 | 29 | $config = \HTMLPurifier_Config::createDefault(); |
| 30 | 30 | $purifier = new \HTMLPurifier($config); |
| 31 | - if (! is_array($value)) { |
|
| 31 | + if (!is_array($value)) { |
|
| 32 | 32 | if ($value != strip_tags($value)) { |
| 33 | 33 | $value = $purifier->purify($value); |
| 34 | 34 | } |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | { |
| 182 | 182 | try { |
| 183 | 183 | $ids = $request->input('select'); |
| 184 | - if (! empty($ids)) { |
|
| 184 | + if (!empty($ids)) { |
|
| 185 | 185 | foreach ($ids as $id) { |
| 186 | 186 | $invoice = $this->invoice->where('id', $id)->first(); |
| 187 | 187 | if ($invoice) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | { |
| 232 | 232 | try { |
| 233 | 233 | $ids = $request->input('select'); |
| 234 | - if (! empty($ids)) { |
|
| 234 | + if (!empty($ids)) { |
|
| 235 | 235 | foreach ($ids as $id) { |
| 236 | 236 | $payment = $this->payment->where('id', $id)->first(); |
| 237 | 237 | if ($payment) { |
@@ -265,7 +265,7 @@ |
||
| 265 | 265 | public function getValueForOthers($productid, $taxClassId, $taxes) |
| 266 | 266 | { |
| 267 | 267 | $value = $taxes->active ? (TaxProductRelation::where('product_id', $productid) |
| 268 | - ->where('tax_class_id', $taxClassId->id)->count() ? Tax::where('tax_classes_id', $taxClassId->id)->first()->rate : 0) : 0; |
|
| 268 | + ->where('tax_class_id', $taxClassId->id)->count() ? Tax::where('tax_classes_id', $taxClassId->id)->first()->rate : 0) : 0; |
|
| 269 | 269 | |
| 270 | 270 | return $value; |
| 271 | 271 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | if ($taxClassId) { |
| 106 | 106 | $taxes = $this->getTaxByPriority($taxClassId); |
| 107 | 107 | $taxes->value = $this->getValueForSameState($productid, $c_gst, $s_gst, $taxes, $taxClassId); |
| 108 | - if (! $taxes->value) { |
|
| 108 | + if (!$taxes->value) { |
|
| 109 | 109 | $taxes = ''; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | if ($taxClassId) { |
| 124 | 124 | $taxes = $this->getTaxByPriority($taxClassId); |
| 125 | 125 | $taxes->value = $this->getValueForOtherState($productid, $i_gst, $taxes, $taxClassId); |
| 126 | - if (! $taxes->value) { |
|
| 126 | + if (!$taxes->value) { |
|
| 127 | 127 | $taxes = ''; |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | if ($taxClassId) { |
| 142 | 142 | $taxes = $this->getTaxByPriority($taxClassId); |
| 143 | 143 | $taxes->value = $this->getValueForUnionTerritory($productid, $c_gst, $ut_gst, $taxes, $taxClassId); |
| 144 | - if (! $taxes->value) { |
|
| 144 | + if (!$taxes->value) { |
|
| 145 | 145 | $taxes = ''; |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | { |
| 209 | 209 | $taxes = $this->getTaxByPriority($taxClassId); |
| 210 | 210 | $taxes->value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 211 | - if (! $taxes->value) { |
|
| 211 | + if (!$taxes->value) { |
|
| 212 | 212 | $taxes = ''; |
| 213 | 213 | } |
| 214 | 214 | |
@@ -30,12 +30,15 @@ discard block |
||
| 30 | 30 | $origin_state = Setting::first()->state; //Get the State of origin |
| 31 | 31 | $origin_country = Setting::first()->country; //Get the State of origin |
| 32 | 32 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 33 | - if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
|
| 34 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 33 | + if ($tax_class_id) { |
|
| 34 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
| 35 | + if ($tax_enable == 1) { |
|
| 36 | +//If GST is Enabled |
|
| 35 | 37 | $tax = $this->getTaxDetails($indian_state, $user_country, $user_state, $origin_state, $origin_country, $productid); |
| 36 | 38 | //All the da a attribute that is sent to the checkout Page if tax_compound=0 |
| 37 | 39 | $taxCondition = $this->getTaxConditions($tax, $taxCaluculationFromAdminPanel); |
| 38 | - } elseif ($tax_enable == 0) { //If Tax enable is 0 and other tax is available |
|
| 40 | + } elseif ($tax_enable == 0) { |
|
| 41 | +//If Tax enable is 0 and other tax is available |
|
| 39 | 42 | $tax = $this->whenOtherTaxAvailableAndTaxNotEnable($productid, $user_state, $user_country); |
| 40 | 43 | $taxCondition = $this->getTaxConditions($tax, $taxCaluculationFromAdminPanel); |
| 41 | 44 | } |
@@ -75,17 +78,21 @@ discard block |
||
| 75 | 78 | |
| 76 | 79 | public function getTaxDetails($indian_state, $user_country, $user_state, $origin_state, $origin_country, $productid, $status = 1) |
| 77 | 80 | { |
| 78 | - if ($origin_country == 'IN' && $indian_state) {//Get the CGST,SGST,IGST,STATE_CODE of the user,if user from INdia |
|
| 81 | + if ($origin_country == 'IN' && $indian_state) { |
|
| 82 | +//Get the CGST,SGST,IGST,STATE_CODE of the user,if user from INdia |
|
| 79 | 83 | $c_gst = $indian_state->c_gst; |
| 80 | 84 | $s_gst = $indian_state->s_gst; |
| 81 | 85 | $i_gst = $indian_state->i_gst; |
| 82 | 86 | $ut_gst = $indian_state->ut_gst; |
| 83 | 87 | $state_code = $indian_state->state_code; |
| 84 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 88 | + if ($state_code == $origin_state) { |
|
| 89 | +//If user and origin state are same |
|
| 85 | 90 | $rateDetails = $this->getTaxWhenIndianSameState($user_state, $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 86 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 91 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 92 | +//If user is from other state |
|
| 87 | 93 | $rateDetails = $this->getTaxWhenIndianOtherState($user_state, $origin_state, $productid, $i_gst, $state_code, $status); |
| 88 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 94 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 95 | +//if user from Union Territory |
|
| 89 | 96 | $rateDetails = $this->getTaxWhenUnionTerritory($user_state, $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 90 | 97 | } |
| 91 | 98 | } else { |
@@ -153,9 +160,11 @@ discard block |
||
| 153 | 160 | { |
| 154 | 161 | $taxes = ''; |
| 155 | 162 | $taxClassId = Tax::where('state', $user_state)->orWhere('state', '')->where('country', $user_country)->select('tax_classes_id as id')->first(); |
| 156 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 163 | + if ($taxClassId) { |
|
| 164 | +//if state equals the user State or country equals user country |
|
| 157 | 165 | $taxes = $this->getTaxForSpecificCountry($taxClassId, $productid, $status); |
| 158 | - } else {//if Tax is selected for Any Country Any State |
|
| 166 | + } else { |
|
| 167 | +//if Tax is selected for Any Country Any State |
|
| 159 | 168 | $taxClassId = Tax::where('country', '') |
| 160 | 169 | ->where('state', '') |
| 161 | 170 | ->select('tax_classes_id as id')->first(); |
@@ -177,13 +186,15 @@ discard block |
||
| 177 | 186 | if ($taxClassId) { |
| 178 | 187 | $taxes = $this->getTaxByPriority($taxClassId); |
| 179 | 188 | $taxes->value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 180 | - } else {//In case of other country |
|
| 189 | + } else { |
|
| 190 | +//In case of other country |
|
| 181 | 191 | //when tax is available and tax is not enabled |
| 182 | 192 | //(Applicable when Global Tax class for any country and state is not there) |
| 183 | 193 | $taxClassId = Tax::where('state', $user_state) |
| 184 | 194 | ->orWhere('country', $user_country) |
| 185 | 195 | ->select('tax_classes_id as id')->first(); |
| 186 | - if ($taxClassId) { //if state equals the user State |
|
| 196 | + if ($taxClassId) { |
|
| 197 | +//if state equals the user State |
|
| 187 | 198 | $taxes = $this->getTaxByPriority($taxClassId); |
| 188 | 199 | $taxes->value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 189 | 200 | } |
@@ -1,6 +1,6 @@ |
||
| 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\Stripe\Controllers\ProcessController(); |
| 5 | 5 | echo $controller->PassToPayment($event->para); |
| 6 | 6 | }); |