Error in new custom payment gateway
-
I made a custom payment gateway integration for paytm. Its working fine but after making a payment from gateway i am having one checkroute. This checkroute code is correct because it once work fine and its code is correct.
Error which i am getting listed below. Its checking the default paypal payment gateway even though i have disabled it.
[2021-08-22 00:42:46] local.ERROR: Call to a member function getName() on null (View: D:\web\htdocs\takemyaudition\theatre\packages\Webkul\Paypal\src\Resources\views\checkout\onepage\paypal-smart-button.blade.php) {"view":{"view":"D:\\web\\htdocs\\takemyaudition\\theatre\\packages\\Webkul\\Paypal\\src/resources/views/checkout/onepage/paypal-smart-button.blade.php","data":{"showRecentlyViewed":"<pre class=sf-dump id=sf-dump-1458880616 data-indent-pad=\" \"><span class=sf-dump-const>true</span> </pre><script>Sfdump(\"sf-dump-1458880616\", {\"maxDepth\":3,\"maxStringLength\":160})</script> ","velocityHelper":"<pre class=sf-dump id=sf-dump-908003705 data-indent-pad=\" \"><span class=sf-dump-note>Webkul\\Velocity\\Helpers\\Helper</span> {<a class=sf-dump-ref>#2877</a><samp data-depth=1 class=sf-dump-expanded> #<span class=sf-dump-protected title=\"Protected property\">productModel</span>: <span class=sf-dump-note title=\"Webkul\\Product\\Models\\Product \"><span class=\"sf-dump-ellipsis sf-dump-ellipsis-note\">Webkul\\Product\\Models</span><span class=\"sf-dump-ellipsis sf-dump-ellipsis-note\">\\</span>Product</span> {<a class=sf-dump-ref>#2976</a><samp data-depth=2 class=sf-dump-compact> #<span class=sf-dump-protected title=\"Protected property\">fillable</span>: <span class=sf-dump-note>array:4</span> [<samp data-depth=3 class=sf-dump-compact> <span class=sf-dump-index>0</span> => \"<span class=sf-dump-str title=\"4 characters\">type</span>\" <span class=sf-dump-index>1</span> => \"<span class=sf-dump-str title=\"19 characters\">attribute_family_id</span>\" <span class=sf-dump-index>2</span> => \"<span class=sf-dump-str title=\"3 characters\">sku</span>\" <span class=sf-dump-index>3</span> => \"<span class=sf-dump-str title=\"9 characters\">parent_id</span>\" </samp>] #<span class=sf-dump-protected title=\"Protected property\">casts</span>: <span class=sf-dump-note>array:1</span> [<samp data-depth=3 class=sf-dump-compact> \"<span class=sf-dump-key>additional</span>\" => \"<span class=sf-dump-str title=\"5 characters\">array</span>\" </samp>] #<span class=sf-dump-protected title=\"Protected property\">typeInstance</span>: <span class=sf-dump-const>null</span> #<span class=sf-dump-protected title=\"Protected property\">connection</span>: <span class=sf-dump-const>null</span> #<span class=sf-dump-protected title=\"Protected property\">table</span>: <span class=sf-dump-const>null</span> #<span class=sf-dump-protected title=\"Protected property\">primaryKey</span>: \"<span class=sf-dump-str title=\"2 characters\">id</span>\" #<span class=sf-dump-protected title=\"Protected property\">keyType</span>: \"<span class=sf-dump-str title=\"3 characters\">int</span>\" +<span class=sf-dump-public title=\"Public property\">incrementing</span>: <span class=sf-dump-const>true</span> #<span class=sf-dump-protected title=\"Protected property\">with</span>: []
Here is my package list code route
<?php Route::group([ // 'prefix' => 'paytm', 'middleware' => ['web', 'theme', 'locale', 'currency'] ], function () { Route::get('redirect','Webkul\Paytm\Http\Controllers\PaytmController@redirect')->name('shop.paytm.index'); // below is the call back Route::get('paytmcheck','Webkul\Paytm\Http\Controllers\PaytmController@checkstatus')->name('shop.paytm.callback'); });
Controller code
<?php namespace Webkul\Paytm\Http\Controllers; use Webkul\Checkout\Facades\Cart; use Webkul\Sales\Repositories\OrderRepository; use Illuminate\Support\Facades\Config; class PaytmController extends Controller { /** * OrderRepository $orderRepository * * @var \Webkul\Sales\Repositories\OrderRepository */ protected $orderRepository; /** * Create a new controller instance. * * @param \Webkul\Attribute\Repositories\OrderRepository $orderRepository * @param \Webkul\Paypal\Helpers\Ipn $ipnHelper * @return void */ public function __construct(OrderRepository $orderRepository) { $this->orderRepository = $orderRepository; } /** * Redirects to the paytm server. * * @return \Illuminate\View\View */ public function redirect() { $cart = Cart::getCart(); $billingAddress = $cart->billing_address; require_once("encdec_paytm.php"); $paytmParams = array( "MID" => core()->getConfigData('sales.paymentmethods.paytm.merchant_id'), "WEBSITE" => core()->getConfigData('sales.paymentmethods.paytm.website'), "INDUSTRY_TYPE_ID" => "Retail", "CHANNEL_ID" => "WEB", "ORDER_ID" => $cart->id.'jamesss', "CUST_ID" => $billingAddress->id, "MOBILE_NO" => $billingAddress->phone, "EMAIL" => $billingAddress->email, "TXN_AMOUNT" => "10", "CALLBACK_URL" => Config::get('app.url')."paytmcheck", ); $checksum = getChecksumFromArray($paytmParams, core()->getConfigData('sales.paymentmethods.paytm.merchant_key')); $url = "https://securegw-stage.paytm.in/order/process"; // echo($cart->id); // echo(core()->getConfigData('sales.paymentmethods.paytm.merchant_id')); return view('paytm::paytm-redirect')->with(compact('checksum', 'paytmParams', 'url')); } /*** * * Call back url */ public function checkstatus() { require_once("encdec_paytm.php"); $cart = Cart::getCart(); $paytmParams = array(); $paytmParams["MID"] = core()->getConfigData('sales.paymentmethods.paytm.merchant_id'); $paytmParams["ORDERID"] = $cart->id; $checksum = getChecksumFromArray($paytmParams, core()->getConfigData('sales.paymentmethods.paytm.merchant_key')); $paytmParams["CHECKSUMHASH"] = $checksum; $post_data = json_encode($paytmParams, JSON_UNESCAPED_SLASHES); $url = "https://securegw-stage.paytm.in/order/status"; /* for Production */ // $url = "https://securegw.paytm.in/order/status"; $ch = curl_init($url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json')); $response = json_decode(curl_exec($ch), true); if ($response['STATUS'] == "TXN_SUCCESS") { $order = $this->orderRepository->create(Cart::prepareDataForOrder()); Cart::deActivateCart(); session()->flash('order', $order); return redirect()->route('shop.checkout.success'); } else { session()->flash('error', 'Paytm payment either cancelled or transaction failure.'); return redirect()->route('shop.checkout.cart.index'); } } }
Route and controller does not have any relation with the paypal gateway but i am thinking its some where taking the paypal. Issue is only with call back url.
-
this issue is resolved. And if any body want to use paytm gateway with bagisto download from here https://github.com/wontone18/paytm-payment-gateway-bagisto-laravel