@@ -54,7 +54,8 @@ |
||
| 54 | 54 | $api = new Api($rzp_key, $rzp_secret); |
| 55 | 55 | $payment = $api->payment->fetch($input['razorpay_payment_id']); |
| 56 | 56 | |
| 57 | - if (count($input) && !empty($input['razorpay_payment_id'])) { //Verify Razorpay Payment Id and Signature |
|
| 57 | + if (count($input) && !empty($input['razorpay_payment_id'])) { |
|
| 58 | +//Verify Razorpay Payment Id and Signature |
|
| 58 | 59 | |
| 59 | 60 | //Fetch payment information by razorpay_payment_id |
| 60 | 61 | try { |
@@ -121,7 +121,8 @@ |
||
| 121 | 121 | |
| 122 | 122 | public function getRelease($owner, $repository, $order_id, $file) |
| 123 | 123 | { |
| 124 | - if ($owner && $repository) {//If the Product is downloaded from Github |
|
| 124 | + if ($owner && $repository) { |
|
| 125 | +//If the Product is downloaded from Github |
|
| 125 | 126 | $github_controller = new \App\Http\Controllers\Github\GithubController(); |
| 126 | 127 | $relese = $github_controller->listRepositories($owner, $repository, $order_id); |
| 127 | 128 | |
@@ -86,7 +86,8 @@ discard block |
||
| 86 | 86 | $i_gst = $user_state->i_gst; |
| 87 | 87 | $ut_gst = $user_state->ut_gst; |
| 88 | 88 | $state_code = $user_state->state_code; |
| 89 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 89 | + if ($state_code == $origin_state) { |
|
| 90 | +//If user and origin state are same |
|
| 90 | 91 | $taxClassId = TaxClass::where('name', 'Intra State GST') |
| 91 | 92 | ->pluck('id')->toArray(); //Get the class Id of state |
| 92 | 93 | if ($taxClassId) { |
@@ -95,7 +96,8 @@ discard block |
||
| 95 | 96 | } else { |
| 96 | 97 | $taxes = [0]; |
| 97 | 98 | } |
| 98 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 99 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 100 | +//If user is from other state |
|
| 99 | 101 | |
| 100 | 102 | $taxClassId = TaxClass::where('name', 'Inter State GST') |
| 101 | 103 | ->pluck('id')->toArray(); //Get the class Id of state |
@@ -105,7 +107,8 @@ discard block |
||
| 105 | 107 | } else { |
| 106 | 108 | $taxes = [0]; |
| 107 | 109 | } |
| 108 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 110 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 111 | +//if user from Union Territory |
|
| 109 | 112 | $taxClassId = TaxClass::where('name', 'Union Territory GST') |
| 110 | 113 | ->pluck('id')->toArray(); //Get the class Id of state |
| 111 | 114 | if ($taxClassId) { |
@@ -130,14 +133,16 @@ discard block |
||
| 130 | 133 | ->pluck('tax_classes_id')->first(); |
| 131 | 134 | $value = ''; |
| 132 | 135 | $rate = ''; |
| 133 | - if ($taxClassId) { //if state equals the user State |
|
| 136 | + if ($taxClassId) { |
|
| 137 | +//if state equals the user State |
|
| 134 | 138 | |
| 135 | 139 | $taxes = $cartController->getTaxByPriority($taxClassId); |
| 136 | 140 | |
| 137 | 141 | // $taxes = $this->cartController::getTaxByPriority($taxClassId); |
| 138 | 142 | $value = $cartController->getValueForOthers($productid, $taxClassId, $taxes); |
| 139 | 143 | $rate = $value; |
| 140 | - } else {//if Tax is selected for Any State Any Country |
|
| 144 | + } else { |
|
| 145 | +//if Tax is selected for Any State Any Country |
|
| 141 | 146 | $taxClassId = Tax::where('country', '')->where('state', 'Any State')->pluck('tax_classes_id')->first(); |
| 142 | 147 | if ($taxClassId) { |
| 143 | 148 | $taxes = $cartController->getTaxByPriority($taxClassId); |
@@ -475,7 +475,8 @@ discard block |
||
| 475 | 475 | if ($this->tax_option->findOrFail(1)->inclusive == 0) { |
| 476 | 476 | if ($this->tax_option->findOrFail(1)->tax_enable == 1) { |
| 477 | 477 | $taxs = $this->getTaxWhenEnable($productid, $taxs[0], $userid); |
| 478 | - } elseif ($this->tax_option->tax_enable == 0) {//if tax_enable is 0 |
|
| 478 | + } elseif ($this->tax_option->tax_enable == 0) { |
|
| 479 | +//if tax_enable is 0 |
|
| 479 | 480 | |
| 480 | 481 | $taxClassId = Tax::where('country', '')->where('state', 'Any State') |
| 481 | 482 | ->pluck('tax_classes_id')->first(); //In case of India when |
@@ -484,13 +485,15 @@ discard block |
||
| 484 | 485 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 485 | 486 | $taxs = $rate['taxes']; |
| 486 | 487 | $rate = $rate['rate']; |
| 487 | - } elseif ($geoip_country != 'IN') {//In case of other country |
|
| 488 | + } elseif ($geoip_country != 'IN') { |
|
| 489 | +//In case of other country |
|
| 488 | 490 | // when tax is available and tax is not enabled(Applicable |
| 489 | 491 | //when Global Tax class for any country and state is not there) |
| 490 | 492 | |
| 491 | 493 | $taxClassId = Tax::where('state', $geoip_state) |
| 492 | 494 | ->orWhere('country', $geoip_country)->pluck('tax_classes_id')->first(); |
| 493 | - if ($taxClassId) { //if state equals the user State |
|
| 495 | + if ($taxClassId) { |
|
| 496 | +//if state equals the user State |
|
| 494 | 497 | $rate = $this->getTotalRate($taxClassId, $productid, $taxs); |
| 495 | 498 | $taxs = $rate['taxes']; |
| 496 | 499 | $rate = $rate['rate']; |
@@ -533,11 +536,13 @@ discard block |
||
| 533 | 536 | $i_gst = 0; |
| 534 | 537 | $ut_gst = 0; |
| 535 | 538 | $state_code = ''; |
| 536 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 539 | + if ($user_state != '') { |
|
| 540 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 537 | 541 | $tax = $this->getTaxWhenState($user_state, $productid, $origin_state); |
| 538 | 542 | $taxes = $tax['taxes']; |
| 539 | 543 | $value = $tax['value']; |
| 540 | - } else {//If user from other Country |
|
| 544 | + } else { |
|
| 545 | +//If user from other Country |
|
| 541 | 546 | $tax = $this->getTaxWhenOtherCountry($geoip_state, $geoip_country, $productid); |
| 542 | 547 | $taxes = $tax['taxes']; |
| 543 | 548 | $value = $tax['value']; |
@@ -169,11 +169,13 @@ |
||
| 169 | 169 | |
| 170 | 170 | //if product has expiry date ie sunscriptioon is generated |
| 171 | 171 | if ($endDate) { |
| 172 | - if ($getDownloadCondition == 1) {//Perpetual download till expiry selected |
|
| 172 | + if ($getDownloadCondition == 1) { |
|
| 173 | +//Perpetual download till expiry selected |
|
| 173 | 174 | $getDownload = $this->whenDownloadTillExpiry($endDate, $productid, $versions, $clientid, $invoiceid); |
| 174 | 175 | |
| 175 | 176 | return $getDownload; |
| 176 | - } elseif ($getDownloadCondition == 0) {//When download retires after subscription |
|
| 177 | + } elseif ($getDownloadCondition == 0) { |
|
| 178 | +//When download retires after subscription |
|
| 177 | 179 | |
| 178 | 180 | $getDownload = $this->whenDownloadExpiresAfterExpiry($countExpiry, $countVersions, $endDate, $productid, $versions, $clientid, $invoiceid); |
| 179 | 181 | |
@@ -133,7 +133,8 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | try { |
| 135 | 135 | foreach ($invoiceChecked as $key => $value) { |
| 136 | - if ($key != 0) {//If Payment is linked to Invoice |
|
| 136 | + if ($key != 0) { |
|
| 137 | +//If Payment is linked to Invoice |
|
| 137 | 138 | $invoice = Invoice::find($value); |
| 138 | 139 | $invoice_status = 'pending'; |
| 139 | 140 | $payment = Payment::where('invoice_id', $value)->create([ |
@@ -157,7 +158,8 @@ discard block |
||
| 157 | 158 | $invoice->status = $invoice_status; |
| 158 | 159 | $invoice->save(); |
| 159 | 160 | } |
| 160 | - } elseif (count($invoiceChecked) == 1 || $amtToCredit > 0) {//If Payment is not linked to any invoice and is to be credited to User Accunt |
|
| 161 | + } elseif (count($invoiceChecked) == 1 || $amtToCredit > 0) { |
|
| 162 | +//If Payment is not linked to any invoice and is to be credited to User Accunt |
|
| 161 | 163 | $payment = Payment::create([ |
| 162 | 164 | 'invoice_id' => $value, |
| 163 | 165 | 'user_id' => $clientid, |
@@ -224,7 +226,8 @@ discard block |
||
| 224 | 226 | try { |
| 225 | 227 | $sum = 0; |
| 226 | 228 | foreach ($invoiceChecked as $key => $value) { |
| 227 | - if ($key != 0) {//If Payment is linked to Invoice |
|
| 229 | + if ($key != 0) { |
|
| 230 | +//If Payment is linked to Invoice |
|
| 228 | 231 | $invoice = Invoice::find($value); |
| 229 | 232 | Payment::where('user_id', $clientid)->where('invoice_id', 0)->update(['amt_to_credit'=>$amtToCredit]); |
| 230 | 233 | $invoice_status = 'pending'; |
@@ -130,7 +130,8 @@ |
||
| 130 | 130 | $currencyAndSymbol = $cart_controller->currency(); |
| 131 | 131 | $currency = $currencyAndSymbol['currency']; |
| 132 | 132 | $symbol = $currencyAndSymbol['symbol']; |
| 133 | - if ($symbol == '') { //If user has no currency symbol(In case of old customers) |
|
| 133 | + if ($symbol == '') { |
|
| 134 | +//If user has no currency symbol(In case of old customers) |
|
| 134 | 135 | $user = \Auth::user(); |
| 135 | 136 | $symbol = Currency::where('code', $currency)->pluck('symbol')->first(); |
| 136 | 137 | $symbol = $user->update(['currency_symbol'=> $symbol]); |
@@ -179,8 +179,10 @@ discard block |
||
| 179 | 179 | $origin_state = $this->setting->first()->state; //Get the State of origin |
| 180 | 180 | $tax_class_id = TaxProductRelation::where('product_id', $productid)->pluck('tax_class_id')->toArray(); |
| 181 | 181 | |
| 182 | - if ($tax_class_id) {//If the product is allowed for tax (Check in tax_product relation table) |
|
| 183 | - if ($tax_enable == 1) {//If GST is Enabled |
|
| 182 | + if ($tax_class_id) { |
|
| 183 | +//If the product is allowed for tax (Check in tax_product relation table) |
|
| 184 | + if ($tax_enable == 1) { |
|
| 185 | +//If GST is Enabled |
|
| 184 | 186 | |
| 185 | 187 | $state_code = ''; |
| 186 | 188 | $c_gst = ''; |
@@ -191,45 +193,52 @@ discard block |
||
| 191 | 193 | $rate = ''; |
| 192 | 194 | $status = 1; |
| 193 | 195 | |
| 194 | - if ($user_state != '') {//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 196 | + if ($user_state != '') { |
|
| 197 | +//Get the CGST,SGST,IGST,STATE_CODE of the user |
|
| 195 | 198 | $c_gst = $user_state->c_gst; |
| 196 | 199 | $s_gst = $user_state->s_gst; |
| 197 | 200 | $i_gst = $user_state->i_gst; |
| 198 | 201 | $ut_gst = $user_state->ut_gst; |
| 199 | 202 | $state_code = $user_state->state_code; |
| 200 | 203 | |
| 201 | - if ($state_code == $origin_state) {//If user and origin state are same |
|
| 204 | + if ($state_code == $origin_state) { |
|
| 205 | +//If user and origin state are same |
|
| 202 | 206 | $rateForSameState = $this->getTaxWhenIndianSameState($user_state, |
| 203 | 207 | $origin_state, $productid, $c_gst, $s_gst, $state_code, $status); |
| 204 | 208 | |
| 205 | 209 | $taxes = $rateForSameState['taxes']; |
| 206 | 210 | $status = $rateForSameState['status']; |
| 207 | 211 | $value = $rateForSameState['value']; |
| 208 | - } elseif ($state_code != $origin_state && $ut_gst == 'NULL') {//If user is from other state |
|
| 212 | + } elseif ($state_code != $origin_state && $ut_gst == 'NULL') { |
|
| 213 | +//If user is from other state |
|
| 209 | 214 | $rateForOtherState = $this->getTaxWhenIndianOtherState($user_state, |
| 210 | 215 | $origin_state, $productid, $i_gst, $state_code, $status); |
| 211 | 216 | $taxes = $rateForOtherState['taxes']; |
| 212 | 217 | $status = $rateForOtherState['status']; |
| 213 | 218 | $value = $rateForOtherState['value']; |
| 214 | - } elseif ($state_code != $origin_state && $ut_gst != 'NULL') {//if user from Union Territory |
|
| 219 | + } elseif ($state_code != $origin_state && $ut_gst != 'NULL') { |
|
| 220 | +//if user from Union Territory |
|
| 215 | 221 | $rateForUnionTerritory = $this->getTaxWhenUnionTerritory($user_state, |
| 216 | 222 | $origin_state, $productid, $c_gst, $ut_gst, $state_code, $status); |
| 217 | 223 | $taxes = $rateForUnionTerritory['taxes']; |
| 218 | 224 | $status = $rateForUnionTerritory['status']; |
| 219 | 225 | $value = $rateForUnionTerritory['value']; |
| 220 | 226 | } |
| 221 | - } else {//If user from other Country |
|
| 227 | + } else { |
|
| 228 | +//If user from other Country |
|
| 222 | 229 | $taxClassId = Tax::where('state', $geoip_state) |
| 223 | 230 | ->orWhere('country', $geoip_country) |
| 224 | 231 | ->pluck('tax_classes_id')->first(); |
| 225 | - if ($taxClassId) { //if state equals the user State or country equals user country |
|
| 232 | + if ($taxClassId) { |
|
| 233 | +//if state equals the user State or country equals user country |
|
| 226 | 234 | $taxForSpecificCountry = $this->getTaxForSpecificCountry($taxClassId, |
| 227 | 235 | $productid, $status); |
| 228 | 236 | $taxes = $taxForSpecificCountry['taxes']; |
| 229 | 237 | $status = $taxForSpecificCountry['status']; |
| 230 | 238 | $value = $taxForSpecificCountry['value']; |
| 231 | 239 | $rate = $taxForSpecificCountry['value']; |
| 232 | - } else {//if Tax is selected for Any Country Any State |
|
| 240 | + } else { |
|
| 241 | +//if Tax is selected for Any Country Any State |
|
| 233 | 242 | $taxClassId = Tax::where('country', '') |
| 234 | 243 | ->where('state', 'Any State') |
| 235 | 244 | ->pluck('tax_classes_id')->first(); |
@@ -270,7 +279,8 @@ discard block |
||
| 270 | 279 | ]); |
| 271 | 280 | } |
| 272 | 281 | } |
| 273 | - } elseif ($tax_enable == 0) {//If Tax enable is 0 |
|
| 282 | + } elseif ($tax_enable == 0) { |
|
| 283 | +//If Tax enable is 0 |
|
| 274 | 284 | $status = 1; |
| 275 | 285 | if ($this->tax_option->findOrFail(1)->tax_enable == 0) { |
| 276 | 286 | $taxClassId = Tax::where('country', '') |
@@ -295,13 +305,15 @@ discard block |
||
| 295 | 305 | 'value' => $value, |
| 296 | 306 | ]); |
| 297 | 307 | } |
| 298 | - } else {//In case of other country |
|
| 308 | + } else { |
|
| 309 | +//In case of other country |
|
| 299 | 310 | //when tax is available and tax is not enabled |
| 300 | 311 | //(Applicable when Global Tax class for any country and state is not there) |
| 301 | 312 | $taxClassId = Tax::where('state', $geoip_state) |
| 302 | 313 | ->orWhere('country', $geoip_country) |
| 303 | 314 | ->pluck('tax_classes_id')->first(); |
| 304 | - if ($taxClassId) { //if state equals the user State |
|
| 315 | + if ($taxClassId) { |
|
| 316 | +//if state equals the user State |
|
| 305 | 317 | $taxes = $this->getTaxByPriority($taxClassId); |
| 306 | 318 | $value = $this->getValueForOthers($productid, $taxClassId, $taxes); |
| 307 | 319 | if ($value == '') { |
@@ -883,7 +895,8 @@ discard block |
||
| 883 | 895 | try { |
| 884 | 896 | $currency = Setting::find(1)->default_currency; |
| 885 | 897 | $currency_symbol = Setting::find(1)->default_symbol; |
| 886 | - if (!\Auth::user()) {//When user is not logged in |
|
| 898 | + if (!\Auth::user()) { |
|
| 899 | +//When user is not logged in |
|
| 887 | 900 | $location = \GeoIP::getLocation(); |
| 888 | 901 | $country = \App\Http\Controllers\Front\CartController::findCountryByGeoip($location['iso_code']); |
| 889 | 902 | $userCountry = Country::where('country_code_char2', $country)->first(); |
@@ -901,7 +914,8 @@ discard block |
||
| 901 | 914 | $currency = \Auth::user()->currency; |
| 902 | 915 | $currency_symbol = \Auth::user()->currency_symbol; |
| 903 | 916 | } |
| 904 | - if ($userid != '') {//For Admin Panel Clients |
|
| 917 | + if ($userid != '') { |
|
| 918 | +//For Admin Panel Clients |
|
| 905 | 919 | $currencyAndSymbol = $this->getCurrency($userid); |
| 906 | 920 | $currency = $currencyAndSymbol['currency']; |
| 907 | 921 | $currency_symbol = $currencyAndSymbol['symbol']; |