Просмотр исходного кода

Finish transaction completion dialogs

master
Immanuel Onyeka 3 лет назад
Родитель
Сommit
17ed618e57
7 измененных файлов: 28 добавлений и 14 удалений
  1. +4
    -5
      app/Http/Controllers/BillingController.php
  2. +1
    -1
      app/Http/Controllers/UserController.php
  3. +2
    -3
      resources/js/panel/credits.vue
  4. +2
    -1
      resources/js/panel/panel.vue
  5. +9
    -4
      resources/js/panel/transaction-endpoint.vue
  6. +6
    -0
      resources/views/home.blade.php
  7. +4
    -0
      routes/web.php

+ 4
- 5
app/Http/Controllers/BillingController.php Просмотреть файл

@@ -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';
} }
} }




+ 1
- 1
app/Http/Controllers/UserController.php Просмотреть файл

@@ -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) {


+ 2
- 3
resources/js/panel/credits.vue Просмотреть файл

@@ -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) */
}) })




+ 2
- 1
resources/js/panel/panel.vue Просмотреть файл

@@ -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>




+ 9
- 4
resources/js/panel/transaction-endpoint.vue Просмотреть файл

@@ -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>

+ 6
- 0
resources/views/home.blade.php Просмотреть файл

@@ -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


+ 4
- 0
routes/web.php Просмотреть файл

@@ -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']);

||||||
x
 
000:0
Загрузка…
Отмена
Сохранить