Current File : /home/inlingua/public_html/crm.vprotectindia.com/app/Http/Controllers/PaymentGatewayController.php |
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\HomeController;
use App\Model\API\CustomerMasterModel;
use App\Model\API\InvoiceMasters;
use App\Model\PaymentGateway;
use App\Model\CustomerPayment;
use Illuminate\Http\Request;
use Barryvdh\DomPDF\Facade as PDF;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Input;
use Softon\Indipay\Facades\Indipay;
use Illuminate\Support\Facades\DB;
class PaymentGatewayController extends Controller
{
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index()
{
return response()->json(PaymentGateway::with('asset_dt')->where('is_synced',0)->get());
}
public function print_customer_invoice($id)
{
$xml = '<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:pub="http://xmlns.oracle.com/oxp/service/PublicReportService">
<soap:Header/>
<soap:Body>
<pub:runReport>
<pub:reportRequest>
<pub:parameterNameValues>
<pub:item>
<pub:name>P_ORG_NAME</pub:name>
<pub:values>
<pub:item>SIS Alarm Monitoring and Response Services Private Limited</pub:item>
</pub:values>
</pub:item>
<pub:item>
<pub:name>P_TRX_NUM</pub:name>
<pub:values>
<pub:item>'.$id.'</pub:item>
</pub:values>
</pub:item>
</pub:parameterNameValues>
<pub:reportAbsolutePath>/Custom/Integration/Reports/SIS Sales Invoice B2B Report.xdo</pub:reportAbsolutePath>
<pub:sizeOfDataChunkDownload>-1</pub:sizeOfDataChunkDownload>
</pub:reportRequest>
</pub:runReport>
</soap:Body>
</soap:Envelope>';
$url = "https://fa-epnz-saasfaprod1.fa.ocs.oraclecloud.com:443/xmlpserver/services/ExternalReportWSSService";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
$headers = array();
array_push($headers, "Content-Type: application/soap+xml");
array_push($headers, "Accept: text/xml");
array_push($headers, "Cache-Control: no-cache");
array_push($headers, "Pragma: no-cache");
array_push($headers, "SOAPAction: http://tempuri.org/Add");
if($xml != null) {
curl_setopt($ch, CURLOPT_POSTFIELDS, "$xml");
array_push($headers, "Content-Length: " . strlen($xml));
}
curl_setopt($ch, CURLOPT_USERPWD, "VprotectFinance:Malik@123456"); /* If required */
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$response = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
$content = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2$3", $response);
//$xml = new SimpleXMLElement($content);
$xml = simplexml_load_string($content);
$body = $xml->xpath('//envBody')[0]; // 'sBody' is from '<s:Body>', the body tag in your xml file.
$json = json_encode((array)$body, JSON_THROW_ON_ERROR);
$data = json_decode($json, true, 512, JSON_THROW_ON_ERROR);
//echo $base64=$data['0'];
$base64=$data['ns2runReportResponse']['ns2runReportReturn']['ns2reportBytes'];
# Decode the Base64 string, making sure that it contains only valid characters
$bin = base64_decode($base64, true);
# Perform a basic validation to make sure that the result is a valid PDF file
# Be aware! The magic number (file signature) is not 100% reliable solution to validate PDF files
# Moreover, if you get Base64 from an untrusted source, you must sanitize the PDF contents
if (strpos($bin, '%PDF') !== 0) {
throw new Exception('Missing the PDF file signature');
}
# Write the PDF contents to a local file
$filename='invoice_pdf/'.$id.'.pdf';
file_put_contents($filename, $bin);
$url=$filename;
//return Redirect::to($url);
return redirect($url);
}
/**
* Show the form for creating a new resource.
*
* @return \Illuminate\Http\Response
*/
public function create($id,$amount)
{
$inv_mst=InvoiceMasters::find($id);
$customer_mst=CustomerMasterModel::find($inv_mst->customer_id);
$tid=time();
$batch_id=(PaymentGateway::max('batch_id')!==null?PaymentGateway::max('batch_id'):"0")+1;
// echo "<pre>";
// print_r($batch_id);
// exit;
$gateway= new PaymentGateway();
$gateway->cust_id=$customer_mst->id;
$gateway->asset_id=1;
$gateway->batch_id=$batch_id;
$gateway->customer_code=$customer_mst->customer_code;
$gateway->inv_id=$inv_mst->id;
$gateway->tally_inv_no=$inv_mst->invoice_number;
$gateway->ledger_name=$customer_mst->fname;
$gateway->account_name=$customer_mst->fname;
$gateway->amount=$amount;
$gateway->date=now();
$gateway->tran_type ='Electronic';
$gateway->pay_type ='inv';
$gateway->save();
$identity =$gateway->id;
$parameters = [
'order_id' => $batch_id,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'delivery_name' => $customer_mst->fname,
'billing_email' => $customer_mst->email,
'delivery_address' => $customer_mst->address,
// 'billing_zip' => $inputs['pincode'],
// 'billing_city' => $inputs['city'],
// 'billing_state' => $inputs['state'],
'delivery_tel' => $customer_mst->phone,
'delivery_country' => 'India',
'redirectUrl' => 'paymentget/payment-status',
'cancelUrl' => 'paymentget/payment-cancel'
];
//print_r($parameters);exit;
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
// $order = Indipay::gateway('CCAvenue')->prepare($parameters);
// return Indipay::process($order);
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
}
/**
* Display the specified resource.
*
* @param \App\PaymentGateway $PaymentGateway
* @return \Illuminate\Http\Response
*/
public function show(PaymentGateway $PaymentGateway)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param \App\PaymentGateway $PaymentGateway
* @return \Illuminate\Http\Response
*/
public function edit(PaymentGateway $PaymentGateway)
{
//
}
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\PaymentGateway $PaymentGateway
* @return \Illuminate\Http\Response
*/
public function update()
{
$resid = json_decode(file_get_contents("php://input"));
// echo "<pre>";
// print_r($resid);
// exit;
// $gateway = PaymentGateway::whereIn('id',$resid);
// $gateway->is_synced = 1;
// $gateway->synced_date = now();
// $gateway->save();
$itemTypes = [1, 2, 3, 4, 5];
PaymentGateway::whereIn('id', $resid)
->update([
'is_synced' => '1',
'synced_date' => now()
]);
return 1;
}
/**
* Remove the specified resource from storage.
*
* @param \App\PaymentGateway $PaymentGateway
* @return \Illuminate\Http\Response
*/
public function destroy(PaymentGateway $PaymentGateway)
{
//
}
public function apipaymentStatus()
{
$response = Indipay::response(request());
$gateway = CustomerPayment::find($response['order_id']);
$gateway->tran_type = $response['payment_mode'];
$gateway->bank_name = $response['card_name'];
$gateway->tran_number = $response['tracking_id'];
$gateway->trans_remarks = $response['status_message'];
$gateway->bank_ref_no = $response['bank_ref_no'];
$gateway->trans_date =$response['trans_date'];
if($response['order_status'] = 'Success')
{
$gateway->payment_status = 1;
$gateway->save();
$userdata=DB::table('outstanding_reports')
->where('id', $gateway->inv_id)
->update(['txn_status' => 1]);
}
else
{
$transaction->payment_status = 2;
$transaction->save();
// return view('welcome', compact('transaction'));
}
//}
return view('api_customer_success_txn',compact('response'));
//return redirect(route('customer/home'));
}
public function customerpaymentStatus()
{
$response = Indipay::response(request());
$gateway = CustomerPayment::find($response['order_id']);
$gateway->tran_type = $response['payment_mode'];
$gateway->bank_name = $response['card_name'];
$gateway->tran_number = $response['tracking_id'];
$gateway->trans_remarks = $response['status_message'];
$gateway->bank_ref_no = $response['bank_ref_no'];
$gateway->trans_date =$response['trans_date'];
if($response['order_status'] = 'Success')
{
$gateway->payment_status = 1;
$gateway->save();
$userdata=DB::table('outstanding_reports')
->where('id', $gateway->orderid)
->update(['txn_status' => '1','tds'=>$gateway->tds,'updated_at'=>$gateway->updated_at]);
}
else
{
$transaction->payment_status = 2;
$transaction->save();
// return view('welcome', compact('transaction'));
}
//}
return view('customer_success_txn',compact('response'));
//return redirect(route('customer/home'));
}
public function paymentStatus()
{
$response = Indipay::response(request());
$gateways = PaymentGateway::where('batch_id',$response['order_id'])->get();
foreach($gateways as $gateway){
//$gateway->tran_type = $response['payment_mode'];
$gateway->bank_name ="HDFC BANK"; //$response['card_name'];
$gateway->tran_number = $response['tracking_id'];
$gateway->trans_remarks = $response['status_message'];
$gateway->bank_ref_no = $response['bank_ref_no'];
$gateway->trans_date =$response['trans_date'];
if($response['order_status'] = 'Success')
{
$gateway->payment_status = 1;
$gateway->save();
//$this->receipt($transaction->transaction_id);
//event(new OrderWasCreated($transaction));
// echo "<pre>";
// print_r($response);
// exit;
// return view('welcome', compact('transaction', 'email'));
//return redirect(routes('home'));
}
else
{
$transaction->payment_status = 2;
$transaction->save();
// return view('welcome', compact('transaction'));
}
}
return redirect(route('home'));
}
public function apipaymentCancel()
{
$response = Indipay::response(request());
$gateway = CustomerPayment::find($response['order_id']);
$gateway->payment_mode = $response['payment_mode'];
$gateway->bank_name ="HDFC BANK"; //$response['card_name'];
$gateway->tran_number = $response['tracking_id'];
$gateway->trans_remarks = $response['status_message'];
$gateway->bank_ref_no = $response['bank_ref_no'];
$gateway->trans_date =$response['trans_date'];
$gateway->payment_status = '3';
$gateway->save();
//echo '<pre>'; print_r($response);
//exit;
//return response()->json(['success' => $response], $this->successStatus);
return view('api_customer_cancle_txn',compact('response'));
}
public function customerpaymentCancel()
{
$response = Indipay::response(request());
$gateway = CustomerPayment::find($response['order_id']);
$gateway->payment_mode = $response['payment_mode'];
$gateway->bank_name ="HDFC BANK"; //$response['card_name'];
$gateway->tran_number = $response['tracking_id'];
$gateway->trans_remarks = $response['status_message'];
$gateway->bank_ref_no = $response['bank_ref_no'];
$gateway->trans_date =$response['trans_date'];
$gateway->payment_status = '3';
$gateway->save();
//echo '<pre>'; print_r($response);
//exit;
return view('customer_cancle_txn',compact('response'));
}
public function paymentCancel()
{
$response = Indipay::response(request());
$gateway = PaymentGateway::find($response['order_id']);
$gateway->payment_mode = $response['payment_mode'];
$gateway->bank_name ="HDFC BANK"; //$response['card_name'];
$gateway->tran_number = $response['tracking_id'];
$gateway->trans_remarks = $response['status_message'];
$gateway->bank_ref_no = $response['bank_ref_no'];
$gateway->trans_date =$response['trans_date'];
$gateway->payment_status = '3';
$gateway->save();
return redirect(route('home'));
}
public function adv_pay()
{
$deshboard_count = new HomeController();
$headData = $deshboard_count->deshboard_count();
return view('user.adv_payment',compact('headData'));
}
public function api_customerfullpayment()
{
$data=request()->all();
//$request=Auth::guard('customers')->user();
$tid=time();
$amount=$data['txtamount'];
$txtpaymentid=$data['txtpaymentid'];
$gateway= new CustomerPayment();
$gateway->asset_id=$data['ACCOUNT_NUMBER'];
$gateway->ledger_name=$data['PARTY_NAME'];
$gateway->account_name=$data['PARTY_NAME'];
$gateway->email=$data['email'];
$gateway->address=$data['SITE_ADDRESS'];
$gateway->amount=$amount;
$gateway->date=now();
$gateway->tran_type ='Electronic';
$gateway->orderid =$txtpaymentid;
$gateway->mobile_no =$data['CUSTOMER_PHONE_NUMBER'];
$gateway->payment_type ='customer_full_payment';
$gateway->save();
$identity =$gateway->id;
$parameters = [
'order_id' => $identity,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'billing_name' => $data['PARTY_NAME'],
'billing_email' => $data['email'],
'billing_address' => $data['SITE_ADDRESS'],
'billing_tel' => $data['CUSTOMER_PHONE_NUMBER'],
//'orderid' => $_POST['orderid'],
'billing_zip' => $data['SITE_PIN_CODE'],
'billing_city' => $data['SITE_CITY'],
'billing_state' => $data['SITE_STATE'],
'delivery_tel' => $data['CUSTOMER_PHONE_NUMBER'],
'billing_country' => 'India',
'redirectUrl' => 'paymentget/api-payment-status',
'cancelUrl' => 'paymentget/api-payment-cancel'
];
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
// $order = Indipay::gateway('CCAvenue')->prepare($parameters);
// return Indipay::process($order);
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
public function customerfullpayment()
{
$userdata=request()->all();
$amount=$userdata['txtamount'];
$txtpaymentid=$userdata['txtpaymentid'];
$request=Auth::guard('customers')->user();
$tid=time();
$gateway= new CustomerPayment();
$gateway->asset_id=$request->ACCOUNT_NUMBER;
$gateway->ledger_name=$request->PARTY_NAME;
$gateway->account_name=$request->PARTY_NAME;
$gateway->email=$request->email;
$gateway->address=$request->SITE_ADDRESS;
$gateway->amount=$amount;
$gateway->date=now();
$gateway->tran_type ='Electronic';
$gateway->tds=$userdata['tds'];
$gateway->orderid =$txtpaymentid;
$gateway->mobile_no =$request->CUSTOMER_PHONE_NUMBER;
$gateway->payment_type ='customer_payment';
$gateway->save();
$identity =$gateway->id;
$parameters = [
'order_id' => $identity,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'billing_name' => $request->PARTY_NAME,
'billing_email' => $request->email,
'billing_address' => $request->SITE_ADDRESS,
'billing_tel' => $request->CUSTOMER_PHONE_NUMBER,
//'orderid' => $_POST['orderid'],
'billing_zip' => $request->SITE_PIN_CODE,
'billing_city' => $request->SITE_CITY,
'billing_state' => $request->SITE_STATE,
'delivery_tel' => $request->CUSTOMER_PHONE_NUMBER,
'billing_country' => 'India',
'redirectUrl' => 'paymentget/customer-payment-status',
'cancelUrl' => 'paymentget/customer-payment-cancel'
];
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
// $order = Indipay::gateway('CCAvenue')->prepare($parameters);
// return Indipay::process($order);
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
public function api_create_customer_payment()
{
$data=request()->all();
//$request=Auth::guard('customers')->user();
$tid=time();
$amount=$data['txtamount'];
$txtpaymentid=$data['txtpaymentid'];
$gateway= new CustomerPayment();
$gateway->asset_id=$data['ACCOUNT_NUMBER'];
$gateway->ledger_name=$data['PARTY_NAME'];
$gateway->account_name=$data['PARTY_NAME'];
$gateway->email=$data['email'];
$gateway->address=$data['SITE_ADDRESS'];
$gateway->amount=$amount;
$gateway->date=now();
$gateway->tran_type ='Electronic';
$gateway->orderid =$txtpaymentid;
$gateway->mobile_no =$data['CUSTOMER_PHONE_NUMBER'];
$gateway->payment_type ='customer_payment';
$gateway->save();
$identity =$gateway->id;
$parameters = [
'order_id' => $identity,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'billing_name' => $data['PARTY_NAME'],
'billing_email' => $data['email'],
'billing_address' => $data['SITE_ADDRESS'],
'billing_tel' => $data['CUSTOMER_PHONE_NUMBER'],
//'orderid' => $_POST['orderid'],
'billing_zip' => $data['SITE_PIN_CODE'],
'billing_city' => $data['SITE_CITY'],
'billing_state' => $data['SITE_STATE'],
'delivery_tel' => $data['CUSTOMER_PHONE_NUMBER'],
'billing_country' => 'India',
'redirectUrl' => 'paymentget/api-payment-status',
'cancelUrl' => 'paymentget/api-payment-cancel'
];
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
public function advpay_create_customer()
{
$data=request()->all();
$request=Auth::guard('customers')->user();
$tid=time();
$amount=$data['txtamount'];
$txtpaymentid=$data['txtpaymentid'];
$gateway= new CustomerPayment();
$gateway->asset_id=$request->ACCOUNT_NUMBER;
$gateway->ledger_name=$request->PARTY_NAME;
$gateway->account_name=$request->PARTY_NAME;
$gateway->email=$request->email;
$gateway->address=$request->SITE_ADDRESS;
$gateway->amount=$amount;
$gateway->date=now();
$gateway->tds=$data['tds'];
$gateway->tran_type ='Electronic';
$gateway->orderid =$txtpaymentid;
$gateway->mobile_no =$request->CUSTOMER_PHONE_NUMBER;
$gateway->payment_type ='customer_payment';
$gateway->save();
$identity =$gateway->id;
$parameters = [
'order_id' => $identity,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'billing_name' => $request->PARTY_NAME,
'billing_email' => $request->email,
'billing_address' => $request->SITE_ADDRESS,
'billing_tel' => $request->CUSTOMER_PHONE_NUMBER,
//'orderid' => $_POST['orderid'],
'billing_zip' => $request->SITE_PIN_CODE,
'billing_city' => $request->SITE_CITY,
'billing_state' => $request->SITE_STATE,
'delivery_tel' => $request->CUSTOMER_PHONE_NUMBER,
'billing_country' => 'India',
'redirectUrl' => 'paymentget/customer-payment-status',
'cancelUrl' => 'paymentget/customer-payment-cancel'
];
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
// $order = Indipay::gateway('CCAvenue')->prepare($parameters);
// return Indipay::process($order);
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
public function advpay_create()
{
$data=request()->all();
$customer_mst=CustomerMasterModel::find(Auth::user()->id);
$tid=time();
$amount=$data['txtamount'];
$batch_id=(PaymentGateway::max('batch_id')!==null?PaymentGateway::max('batch_id'):"0")+1;
$gateway= new PaymentGateway();
$gateway->cust_id=$customer_mst->id;
$gateway->asset_id=1;
$gateway->batch_id=$batch_id;
$gateway->customer_code=$customer_mst->customer_code;
$gateway->inv_id='';
$gateway->tally_inv_no='';
$gateway->ledger_name=$customer_mst->fname;
$gateway->account_name=$customer_mst->fname;
$gateway->amount=$amount;
$gateway->date=now();
$gateway->tran_type ='Electronic';
$gateway->pay_type ='adv';
$gateway->save();
$identity =$gateway->id;
$parameters = [
'order_id' => $batch_id,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'delivery_name' => $customer_mst->fname,
'billing_email' => $customer_mst->email,
'delivery_address' => $customer_mst->address,
// 'billing_zip' => $inputs['pincode'],
// 'billing_city' => $inputs['city'],
// 'billing_state' => $inputs['state'],
'delivery_tel' => $customer_mst->phone,
'delivery_country' => 'India',
'redirectUrl' => 'paymentget/payment-status',
'cancelUrl' => 'paymentget/payment-cancel'
];
//print_r($parameters);exit;
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
// $order = Indipay::gateway('CCAvenue')->prepare($parameters);
// return Indipay::process($order);
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
public function customercheckout()
{
$customer_number=Auth::guard('customers')->user()->ACCOUNT_NUMBER;
$pending_inv= DB::table('outstanding_reports')
->where('customer_number',$customer_number)
->where('txn_status','0')
->get();
$headData = $this->deshboardcount();
//print_r($headData); exit;
return view('customer.checkout',compact('headData','pending_inv'));
}
public function checkout()
{
$home = new HomeController();
$pending_inv=$home->getpendingInvoiceList();
$headData = $home->deshboard_count();
// echo "<pre>";
// print_r($pending_inv);
// exit;
return view('user.checkout',compact('headData','pending_inv'));
}
public function deshboardcount()
{
$paid=0;
$unpaid=0;
$totalamt=0;
$recamt=0;
//$id = Auth::user()->user_name;
//$cust_id=CustomerMasterModel::where('customer_code',$id)->first()->id;
$customer_number=Auth::guard('customers')->user()->ACCOUNT_NUMBER;
$Invoicequery = InvoiceMasters::get(['id']);
//$customer_number='10000096';
$Invoicequery= DB::table('outstanding_reports')
->where('customer_number',$customer_number)
->get();
$total_recamt=DB::table('outstanding_reports')
->where('customer_number',$customer_number)
->where('txn_status','0')
->sum('bal_func_amt');
foreach ($Invoicequery as $row) {
$totalamt = isset(InvoiceMasters::find($row->id)->ledgers()->first()->amount)?InvoiceMasters::find($row->id)->ledgers()->first()->amount:"0";
//$recamt =InvoiceMasters::find($row->id)->receipt()->sum('amount');
if($row->txn_status=='1')
{
$paid++;
}
else{
$unpaid ++;
}
}
return array(
'subscription' =>0,
'invoice'=>$Invoicequery->count(),
'paid'=>$paid,
'unpaid'=>$unpaid,
'balance'=>$total_recamt,
);
}
public function pay_invlst_create()
{
$inputs = Input::all();
$payments = [];
echo"<pre>";
// print_r($inputs);
// exit;
// foreach ($inputs as $input) {
// // if(isset($input['checked']))
// // {
// // print_r($input);exit;
// // }
// print_r($input);
// }
$customer_mst=CustomerMasterModel::find(Auth::user()->id);
$tid=time();
$amount=$inputs['txtamount'];
$batch_id=(PaymentGateway::max('batch_id')!==null?PaymentGateway::max('batch_id'):"0")+1;
//dd($customer_mst->id);
foreach($inputs['rows'] as $input)
{
if(!isset($input['checked'])) continue;
// $payments[] = new PaymentGateway( array(
// 'cust_id'=>$customer_mst->id,
// 'asset_id'=>1,
// 'batch_id'=>$batch_id,
// 'customer_code'=>$customer_mst->customer_code,
// 'inv_id'=>$input['invoice_id'],
// 'tally_inv_no'=>$input['invoice'],
// 'ledger_name'=>$customer_mst->fname,
// 'account_name'=>$customer_mst->fname,
// 'amount'=>$input['balance'],
// 'date'=>now(),
// 'tran_type' =>'Electronic',
// 'pay_type' =>'inv',
// ));
$gateway= new PaymentGateway();
$gateway->cust_id=$customer_mst->id;
$gateway->asset_id=1;
$gateway->batch_id=$batch_id;
$gateway->customer_code=$customer_mst->customer_code;
$gateway->inv_id=$input['invoice_id'];
$gateway->tally_inv_no=$input['invoice'];
$gateway->ledger_name=$customer_mst->fname;
$gateway->account_name=$customer_mst->fname;
$gateway->amount=$input['balance'];
$gateway->date=now();
$gateway->tran_type ='Electronic';
$gateway->pay_type ='inv';
$gateway->save();
}
//PaymentGateway::create($payments);
$parameters = [
'order_id' => $batch_id,
'tid' => $tid,
'amount' => $amount,
'allow_repeated_payments' => 'true',
'delivery_name' => $customer_mst->fname,
'billing_email' => $customer_mst->email,
'delivery_address' => $customer_mst->address,
// 'billing_zip' => $inputs['pincode'],
// 'billing_city' => $inputs['city'],
// 'billing_state' => $inputs['state'],
'delivery_tel' => $customer_mst->phone,
'delivery_country' => 'India',
'redirectUrl' => 'paymentget/payment-status',
'cancelUrl' => 'paymentget/payment-cancel'
];
//print_r($parameters);exit;
// gateway = CCAvenue / PayUMoney / EBS / Citrus / InstaMojo / ZapakPay / Mocker
// $order = Indipay::gateway('CCAvenue')->prepare($parameters);
// return Indipay::process($order);
$order = Indipay::prepare($parameters);
return Indipay::process($order);
}
}