Parcourir la source

Finish transaction completion dialogs

master
Immanuel Onyeka il y a 3 ans
Parent
révision
17ed618e57
7 fichiers modifiés avec 28 ajouts et 14 suppressions
  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 Voir le fichier

@@ -93,7 +93,7 @@ class BillingController extends Controller
$transaction = Transaction::where('intent_id', $charge->payment_intent)->first();

if ($event->type == 'charge.succeeded') {
$this->creditUser($transaction->id)
$this->creditUser($transaction->id);
} else {
$transaction->status = $charge->status;
$transaction->save();
@@ -174,15 +174,14 @@ class BillingController extends Controller
$arHash[] = $secret;

$signature = strtoupper(hash('sha256', implode(':', $arHash)));
if ($signature == $request->m_sign && $request->m_status == 'success')
{
$this->creditUser((int) $request->m_orderid)
if ($signature == $request->m_sign && $request->m_status == 'success'){
$this->creditUser((int) $request->m_orderid);
return $request->m_orderid.'|success';
} else {
return $request->m_orderid.'|error';
$transaction = Transaction::find($request->orderid);
$transaction->status = 'error';
$transaction->save();
return $request->m_orderid.'|error';
}
}



+ 1
- 1
app/Http/Controllers/UserController.php Voir le fichier

@@ -94,7 +94,7 @@ class UserController extends Controller
//This should limit non pending orders to 50. Should also return a json of all services
public function getOrders(Request $request) {
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) {


+ 2
- 3
resources/js/panel/credits.vue Voir le fichier

@@ -87,9 +87,9 @@ function getSecret() {

function pay() {
if (this.method == 'payeer') {
this.payPayeer();
this.payPayeer()
} 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_cipher_method', 'AES-256-CBC'))
form.submit()
/* console.log(data.description) */
/* console.log(data.signature) */
})



+ 2
- 1
resources/js/panel/panel.vue Voir le fichier

@@ -42,7 +42,8 @@
v-else-if="active === '#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-end>



+ 9
- 4
resources/js/panel/transaction-endpoint.vue Voir le fichier

@@ -1,12 +1,12 @@
<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=""/>
<h3>Purchase complete.</h3>
</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=""/>
<h3>Purchase failed.</h3>
</div>
@@ -17,12 +17,17 @@
<script>
export default {
props: ['token', 'user', 'active'],
emits: ['purchaseComplete'],

//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
//complete to panel for a user state refresh.
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>

+ 6
- 0
resources/views/home.blade.php Voir le fichier

@@ -191,6 +191,12 @@
the TOS that resulted in a ban, then anybody could send those views to
their competitor's account.
</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="content"><p>
We accept Bitcoin, Litecoin, and other cryptocurrencies, as well as USD


+ 4
- 0
routes/web.php Voir le fichier

@@ -126,3 +126,7 @@ Route::post('/hooks/charge',
//Payeer handler function
Route::post('/hooks/payeer-transaction',
[BillingController::class, 'processPayeer']);

//Payment attempt is over
Route::get('/panel/clear-paying',
[UserController::class, 'clearPaying']);

Chargement…
Annuler
Enregistrer