@@ -93,7 +93,7 @@ class BillingController extends Controller | |||||
$transaction = Transaction::where('intent_id', $charge->payment_intent)->first(); | $transaction = Transaction::where('intent_id', $charge->payment_intent)->first(); | ||||
if ($event->type == 'charge.succeeded') { | if ($event->type == 'charge.succeeded') { | ||||
$this->creditUser($transaction->id) | $this->creditUser($transaction->id); | ||||
} else { | } else { | ||||
$transaction->status = $charge->status; | $transaction->status = $charge->status; | ||||
$transaction->save(); | $transaction->save(); | ||||
@@ -174,15 +174,14 @@ class BillingController extends Controller | |||||
$arHash[] = $secret; | $arHash[] = $secret; | ||||
$signature = strtoupper(hash('sha256', implode(':', $arHash))); | $signature = strtoupper(hash('sha256', implode(':', $arHash))); | ||||
if ($signature == $request->m_sign && $request->m_status == 'success') | if ($signature == $request->m_sign && $request->m_status == 'success'){ | ||||
{ | $this->creditUser((int) $request->m_orderid); | ||||
$this->creditUser((int) $request->m_orderid) | |||||
return $request->m_orderid.'|success'; | return $request->m_orderid.'|success'; | ||||
} else { | } else { | ||||
return $request->m_orderid.'|error'; | |||||
$transaction = Transaction::find($request->orderid); | $transaction = Transaction::find($request->orderid); | ||||
$transaction->status = 'error'; | $transaction->status = 'error'; | ||||
$transaction->save(); | $transaction->save(); | ||||
return $request->m_orderid.'|error'; | |||||
} | } | ||||
} | } | ||||
@@ -94,7 +94,7 @@ class UserController extends Controller | |||||
//This should limit non pending orders to 50. Should also return a json of all services | //This should limit non pending orders to 50. Should also return a json of all services | ||||
public function getOrders(Request $request) { | public function getOrders(Request $request) { | ||||
return Auth::user()->orders()->with('service')->withCasts(['updated_at' | return Auth::user()->orders()->with('service')->withCasts(['updated_at' | ||||
=> 'datetime:d-m-Y'])->latest()->get(); | => 'datetime:d-m-Y'])->latest()->limit(100)->get(); | ||||
} | } | ||||
public function changeName(Request $request) { | public function changeName(Request $request) { | ||||
@@ -87,9 +87,9 @@ function getSecret() { | |||||
function pay() { | function pay() { | ||||
if (this.method == 'payeer') { | if (this.method == 'payeer') { | ||||
this.payPayeer(); | this.payPayeer() | ||||
} else if (this.method == 'pm') { | } else if (this.method == 'pm') { | ||||
this.payPm(); | this.payPm() | ||||
} | } | ||||
} | } | ||||
@@ -122,7 +122,6 @@ function payPayeer() { | |||||
form.appendChild(this.makeInput('m_params', data.params)) | form.appendChild(this.makeInput('m_params', data.params)) | ||||
form.appendChild(this.makeInput('m_cipher_method', 'AES-256-CBC')) | form.appendChild(this.makeInput('m_cipher_method', 'AES-256-CBC')) | ||||
form.submit() | form.submit() | ||||
/* console.log(data.description) */ | |||||
/* console.log(data.signature) */ | /* console.log(data.signature) */ | ||||
}) | }) | ||||
@@ -42,7 +42,8 @@ | |||||
v-else-if="active === '#settings'"> | v-else-if="active === '#settings'"> | ||||
</settings> | </settings> | ||||
<transaction-end :token="token" :user="user" :active="active" v-else-if="active == | <transaction-end @purchase-complete="getUser" :token="token" :user="user" | ||||
:active="active" v-else-if="active == | |||||
'#transaction-complete' || active == '#transaction-failed'"> | '#transaction-complete' || active == '#transaction-failed'"> | ||||
</transaction-end> | </transaction-end> | ||||
@@ -1,12 +1,12 @@ | |||||
<template> | <template> | ||||
<div id="main"> | <div v-once id="main"> | ||||
<div v-once v-if="active == '#transaction-complete' && user.paying" class="status-dialog"> | <div v-if="active == '#transaction-complete' && user.paying" class="status-dialog"> | ||||
<img class="icon" src="../../images/checked2.svg" alt=""/> | <img class="icon" src="../../images/checked2.svg" alt=""/> | ||||
<h3>Purchase complete.</h3> | <h3>Purchase complete.</h3> | ||||
</div> | </div> | ||||
<div v-once v-if="active == '#transaction-failed' && user.paying" class="status-dialog"> | <div v-if="active == '#transaction-failed' && user.paying" class="status-dialog"> | ||||
<img class="icon" src="../../images/warning-colored.svg" alt=""/> | <img class="icon" src="../../images/warning-colored.svg" alt=""/> | ||||
<h3>Purchase failed.</h3> | <h3>Purchase failed.</h3> | ||||
</div> | </div> | ||||
@@ -17,12 +17,17 @@ | |||||
<script> | <script> | ||||
export default { | export default { | ||||
props: ['token', 'user', 'active'], | props: ['token', 'user', 'active'], | ||||
emits: ['purchaseComplete'], | |||||
//Should check that user is actualling in the paying state. If so, send get | //Should check that user is actualling in the paying state. If so, send get | ||||
//request to panel/transaction-end. It's then() should emit a payment | //request to panel/transaction-end. It's then() should emit a payment | ||||
//complete to panel for a user state refresh. | //complete to panel for a user state refresh. | ||||
mounted() { | mounted() { | ||||
fetch('/panel/clear-paying', { | |||||
method: 'GET', | |||||
headers: {'Content-Type': 'application/json', | |||||
'Accept': 'application/json', | |||||
'X-XSRF-TOKEN': this.token}}).then(() => this.$emit('purchaseComplete')) | |||||
} | } | ||||
} | } | ||||
</script> | </script> |
@@ -191,6 +191,12 @@ | |||||
the TOS that resulted in a ban, then anybody could send those views to | the TOS that resulted in a ban, then anybody could send those views to | ||||
their competitor's account. | their competitor's account. | ||||
</p></div></div> | </p></div></div> | ||||
<div class="collapsible"><button>Is buying views illegal?</button> | |||||
<div class="content"><p> | |||||
No, and there is no reason why it should be. | |||||
</p></div></div> | |||||
<div class="collapsible"><button>How can I pay?</button> | <div class="collapsible"><button>How can I pay?</button> | ||||
<div class="content"><p> | <div class="content"><p> | ||||
We accept Bitcoin, Litecoin, and other cryptocurrencies, as well as USD | We accept Bitcoin, Litecoin, and other cryptocurrencies, as well as USD | ||||
@@ -126,3 +126,7 @@ Route::post('/hooks/charge', | |||||
//Payeer handler function | //Payeer handler function | ||||
Route::post('/hooks/payeer-transaction', | Route::post('/hooks/payeer-transaction', | ||||
[BillingController::class, 'processPayeer']); | [BillingController::class, 'processPayeer']); | ||||
//Payment attempt is over | |||||
Route::get('/panel/clear-paying', | |||||
[UserController::class, 'clearPaying']); |