app/Http/Helpers/BuyTickets.php
/**
     * Charge the Credit Card And if everything Goes Well Create Tickets
     */
Charge the Credit Card And if everything Goes Well Create Tickets
Charge the Credit Card And if everything Goes Well Create Tickets
private function charge()
    {
        $price = $this->raffle->ticket_cost * $this->request->checkout_quantity;
        $charge = new Billing($price, $this->request->stripeToken);
        $charge->charge();
        if ($charge->has_error) {
            $this->has_error = true;
            $this->message = $charge->error_message;
            return false;
        }
        $this->payment = new Payments();
        $this->payment->billing_id = $charge->getChargeID();
        $this->payment->raffle_id = $this->raffle->id;
        $this->payment->charge_amount = $price;
        $this->payment->fee =$charge->calculateFee();
        $this->payment->tickets_buy = $this->request->checkout_quantity;
        return true;
    }
private function charge ( ) { $ price = $ this -> raffle -> ticket_cost * $ this -> request -> checkout_quantity ; $ charge = new Billing ( $ price , $ this -> request -> stripeToken ) ; $ charge -> charge ( ) ; if ( $ charge -> has_error ) { $ this -> has_error = true ; $ this -> message = $ charge -> error_message ; return false ; } $ this -> payment = new Payments ( ) ; $ this -> payment -> billing_id = $ charge -> getChargeID ( ) ; $ this -> payment -> raffle_id = $ this -> raffle -> id ; $ this -> payment -> charge_amount = $ price ; $ this -> payment -> fee = $ charge -> calculateFee ( ) ; $ this -> payment -> tickets_buy = $ this -> request -> checkout_quantity ; return true ; }
Charge the Credit Card And if everything Goes Well Create Tickets
Charge the Credit Card And if everything Goes Well Create Tickets