@@ -78,7 +78,7 @@ class BillingController extends Controller | |||||
public function chargeEvent(Request $request) { | public function chargeEvent(Request $request) { | ||||
$event = \Stripe\Event::constructFrom($request->all()); | $event = \Stripe\Event::constructFrom($request->all()); | ||||
$charge = $event->data->object; | $charge = $event->data->object; | ||||
$transaction = Transaction::where('intent_id', $charge->payment_intent); | |||||
$transaction = Transaction::where('intent_id', $charge->payment_intent)->first(); | |||||
$user = $transaction->user; | $user = $transaction->user; | ||||
if ($event->type == 'charge.succeeded') { | if ($event->type == 'charge.succeeded') { | ||||
@@ -65,8 +65,6 @@ function resendLink(event) { | |||||
} else { | } else { | ||||
event.target.parentNode.getElementsByTagName('h3')[0].innerText = | event.target.parentNode.getElementsByTagName('h3')[0].innerText = | ||||
`${response.status} : ${response.statusText}` | `${response.status} : ${response.statusText}` | ||||
response.json().then((data) => { | |||||
event.target.parentNode.getElementsByTagName('h3')[0].innerText = data | |||||
}) | }) | ||||
} | } | ||||
}) | }) | ||||
@@ -107,7 +107,7 @@ function pay() { | |||||
document.getElementById('payment-error').textContent = | document.getElementById('payment-error').textContent = | ||||
result.error.message | result.error.message | ||||
} else if (result.paymentIntent.status === 'succeeded') { | } else if (result.paymentIntent.status === 'succeeded') { | ||||
setTimeout(() => {this.$emit('purchaseComplete')}, 4000) | |||||
this.$emit('purchaseComplete') | |||||
this.complete = true | this.complete = true | ||||
} else { | } else { | ||||
document.getElementById('payment-error').textContent = | document.getElementById('payment-error').textContent = | ||||
@@ -81,7 +81,7 @@ | |||||
</template> | </template> | ||||
<credits @purchase-complete="$emit('updateUser')" :preferred="preferred" :token="token" v-if="page == 'credits'"></credits> | |||||
<credits @purchase-complete="setTimeout(() => {updateUser, 4000)" :preferred="preferred" :token="token" v-if="page == 'credits'"></credits> | |||||
</div> | </div> | ||||
</template> | </template> | ||||
@@ -5,7 +5,6 @@ | |||||
@section('head-metas') | @section('head-metas') | ||||
@parent | @parent | ||||
<link rel="stylesheet" href="{{asset('main.css')}}"> | |||||
@endsection | @endsection | ||||
@section('content') | @section('content') | ||||