public function handleWebhook(Request $request)
 {
     //TODO FAIRE UN HASH POUR RECRER TOUTE L'OP SANS AUTH
     $subscription = $this->organization->subscription()->first();
     $billing = Billing::where('uuid', $subscription->last_billing_uuid)->get()->first();
     if ($request->input('status') == 'success') {
         $subscription->is_active = true;
         $subscription->save();
         $billing->status = "SUCCESS";
         //TODO DEFINIR DES CODES DERREURS ?
         $billing->is_billed = true;
         $billing->save();
     } else {
         $billing->status = "ERROR";
         $billing->save();
     }
 }
Example #2
0
 public function check($bank_id, Request $request)
 {
     $amount = $request->input('o_amount');
     $user_id = $request->input('o_uid');
     if ($user_id > 0 && $amount > 0) {
         $bank = Billing::findOrFail($bank_id);
         $amount = $amount * 100;
         return Response::view('admin.billings.payment.check', compact('bank', 'user_id', 'amount'))->header('Content-Type', 'text/xml');
     } else {
         return Response::view('admin.billings.payment.error')->header('Content-Type', 'text/xml');
     }
 }