/
home
/
pay
/
server
/
app
/
Http
/
Controllers
/
pay
/
File Upload :
llllll
Current File: /home/pay/server/app/Http/Controllers/pay/paypingController.php
<?php namespace App\Http\Controllers\pay; use App\Http\Controllers\Controller; use App\Models\Customer; use App\Models\User; use App\Models\Withdraw; use Illuminate\Http\Request; use Illuminate\Support\Facades\Http; use Rooyesh\Wallet\interfaces\TransactionInterface; use Rooyesh\Wallet\interfaces\WalletInterface; class paypingController extends Controller { public function startTransation(Request $request) { $user = auth()->user(); // riyal to tomman $finalPriseP = $request->value; if ($user->id ==4){ $finalPriseP =10000; } $tomman = $finalPriseP; $riyal = (int)($finalPriseP / 10); $riyal .= 0; $finalPriseP = (int)($finalPriseP / 10); $Withdraw = Withdraw::create([ 'customer_id' => auth('customer')->id(), "cash" => $riyal, 'sts' => 1, ]); $url = 'https://zify.ir/api/order/v2/create'; $payload = [ "payer" => [ "first_name" => $user->fname . " " . $user->lname, "last_name" => "(".$this->Config('name_fa').")", "phone" => $user->mobile, "email" => "", "state" => $user->city, "city" => $user->province, "address_1" => $user->id, "address_2" => $user->shop_name ], "products" => [ [ "code" => "1", "sellQuantity" => 1, "title" => "IRR", "amount" => $finalPriseP, "unlimited" => true, "quantity" => $finalPriseP, "description" => "charge_account" ] ], "returnUrl" => "https://".$this->Config('server_url')."/customer/charge_account_verify", "clientRefId" => "$Withdraw->id", "shipping_total" => 0, "off_total" => 0, "tax_total" => 0 ]; $TOKEN="cf09ee0187335f173c786e7660d778d2dd71ab582d282999f751427f5923d525"; if ($this->Config('name_en')=="pay_henzagold"){ $TOKEN="591c9189b97360086b94369a9f4152f364a02d986fa761703749648545df63f6"; } $response = Http::withToken($TOKEN) ->post($url, $payload); if ($response->successful()) { $responseData = $response->json(); $orderCode = $responseData['data']['order'] ?? null; if ($orderCode) { $Withdraw->tracked_number = $orderCode; $Withdraw->save(); return "https://zify.ir/order/accept/{$orderCode}"; } else { return response()->json([ 'message' => 'Order created successfully but order code is missing', 'data' => $responseData ]); } } else { $response = $response->json(); return response()->json([$response][0], 422); } } public function TCharchee() { } public function verifyTransation() { $Withdraw = Withdraw::with('customer')->where('id', $_GET['clientrefid'])->first(); $app_url = $this->Config('app_url'); $User = Customer::where('id', $Withdraw->customer_id)->first(); $url = 'https://zify.ir/api/order/v2/verify'; $payload = [ "order" => "$Withdraw->tracked_number", ]; $verifyResponse = Http::withToken("cf09ee0187335f173c786e7660d778d2dd71ab582d282999f751427f5923d525") ->post($url, $payload); $decodedResponse = json_decode($verifyResponse, true); $verifyMessage = $decodedResponse['message']; // return $decodedResponse['data']; if (isset($decodedResponse['data']['refid']) || $verifyMessage == []) { if ($Withdraw->cash == $decodedResponse['data']['amount'] * 10) { $Withdraw->zify_code = $Withdraw->tracked_number;//ok $Withdraw->tracked_number = $decodedResponse['data']['refid'];//ok $Withdraw->sts = 2;//ok $Withdraw->save(); $wallet_interface_fund = new WalletInterface($User->id, $User->type); $transaction = new TransactionInterface($wallet_interface_fund, $_inp = [ "cash" => $decodedResponse['data']['amount'] * 10, 'expire_at' => now(), 'withdraw_id' => $_GET['clientrefid'], 'active' => true ], 3, false, true); $User = Customer::where('id', $Withdraw->customer_id)->first(); $url = 'https://limangold.ir/kernel/admin/fin'; $payload = [ "amount" => $decodedResponse['data']['amount'] * 10, "customer_id" => "23", "date_at" => \Carbon\Carbon::today()->format('Y/m/d'), "receive_account_number" => "000", "receive_bank" => "پیپینگ", "receive_name" => "لیمان گلد", "send_account_number" => "000", "send_bank" => " زیفای کد $Withdraw->zify_code", "send_name" => $User->name, "track_number" => $decodedResponse['data']['refid'], "type" => 1, ]; $verifyResponse = Http::withToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvbGltYW5nb2xkLmlyXC9rZXJuZWxcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNzI3NTMwNjA0LCJleHAiOjE3MzAxMjI2MDQsIm5iZiI6MTcyNzUzMDYwNCwianRpIjoiYXBINmlPZXlGTE9oTUhRdyIsInN1YiI6MiwicHJ2IjoiMjNiZDVjODk0OWY2MDBhZGIzOWU3MDFjNDAwODcyZGI3YTU5NzZmNyJ9.IrO6icD-EXjgZ3mYyeEAP4aqG7q35yJTCU_hQhEDGwk") ->post($url, $payload); //----------sms // User information $userMobile = $Withdraw->customer->mobile; // User's mobile number $userName = $Withdraw->customer->name; // User's name $chargedAmount = $Withdraw->cash; // Charged amount // Company name $companyName = $this->Config('name_fa'); // Company name from configuration // Constructing the SMS message $message = "کاربر $userName با شماره موبایل $userMobile حساب خود را به مقدار " . number_format($chargedAmount) . " ریال شارژ کرد. با تشکر، $companyName"; // Getting admin mobile numbers and sending the SMS User::where('active', 1)->get()->each(function($admin) use ($message) { $this->Send($admin->mobile, $message); }); return view('showTransactionReport', compact('Withdraw','app_url')); return redirect('https://app.gholaktala.ir/transactions'); } return "مبلغ پرداختی دستکاری شده !"; } else { $Withdraw->tracked_number; $Withdraw->sts = 3;//no $Withdraw->save(); return view('showTransactionReport', compact('Withdraw','app_url')); } } }
Copyright ©2k19 -
Hexid
|
Tex7ure