conedevelopment / bazar

Bazar is an e-commerce package for Laravel applications.
https://root.conedevelopment.com
MIT License
421 stars 56 forks source link

Checkout got failed #192

Closed bobitza closed 2 years ago

bobitza commented 2 years ago

Description:

I got failed status, when call checkout, this is the output of checkout function

{

    "discount":121.85000000000001,
    "currency":"lei",
    "status":"failed",
    "user_id":3,
    "updated_at":"2022-02-23T12:03:27.000000Z",
    "created_at":"2022-02-23T12:03:25.000000Z",
    "id":20,
    "tax":0,
    "total":2335.15,
    "net_total":2335.15,
    "status_name":"Failed",
    "formatted_tax":"0.00 LEI",
    "formatted_total":"2,335.15 LEI",
    "formatted_discount":"121.85 LEI",
    "formatted_net_total":"2,335.15 LEI",
    "user":{
        "id":3,
        "name":"X Bogdan",
        "email":"xxx@yahoo.com",
        "email_verified_at":"2022-02-07T12:03:33.000000Z",
        "created_at":"2022-02-08T13:37:11.000000Z",
        "updated_at":"2022-02-08T13:37:11.000000Z",
        "deleted_at":null,
        "type":0,
        "role":"manager",
        "facebook_id":null,
        "avatar":"http:\/\/iqshop.baa\/vendor\/bazar\/img\/avatar-placeholder.svg"
    },
    "address":{
        "city":"Cluj",
        "state":"Cluj",
        "phone":"0754222222",
        "email":"xxx@yahoo.com",
        "alias":"#34",
        "custom":{
            "message":"test mesaj"
        },
        "country":"RO",
        "default":false,
        "company":null,
        "address":"Padurii 16B",
        "postcode":"407039",
        "last_name":"Bogdan",
        "first_name":"X",
        "address_secondary":null,
        "addressable_id":20,
        "addressable_type":"Bazar\\Models\\Order",
        "updated_at":"2022-02-23T12:03:25.000000Z",
        "created_at":"2022-02-23T12:03:25.000000Z",
        "id":41,
        "name":"X Bogdan",
        "country_name":"Romania"
    },
    "shipping":{
        "tax":0,
        "cost":20,
        "shippable_id":20,
        "shippable_type":"Bazar\\Models\\Order",
        "driver":"cargus",
        "updated_at":"2022-02-23T12:03:25.000000Z",
        "created_at":"2022-02-23T12:03:25.000000Z",
        "id":48,
        "driver_name":"Cargus",
        "formatted_total":"20.00 LEI",
        "address":{
            "city":"Cluj",
            "state":"Cluj",
            "phone":"075000000",
            "email":"xxx@yahoo.com",
            "alias":"#33",
            "custom":{
                "message":"test mesaj"
            },
            "country":"RO",
            "default":false,
            "company":null,
            "address":"Strada x",
            "postcode":"407039",
            "last_name":"Bogdan",
            "first_name":"X",
            "address_secondary":null,
            "addressable_id":48,
            "addressable_type":"Bazar\\Models\\Shipping",
            "updated_at":"2022-02-23T12:03:25.000000Z",
            "created_at":"2022-02-23T12:03:25.000000Z",
            "id":42,
            "name":"X Bogdan",
            "country_name":"Romania"
        }
    },
    "items":[
        {
            "id":"0d393b09-e73d-41bc-a1dd-e0a8d34106d1",
            "itemable_type":"Bazar\\Models\\Order",
            "itemable_id":20,
            "buyable_type":null,
            "buyable_id":null,
            "name":"O'Conner, Krajcik and Prohaska",
            "price":69,
            "tax":0,
            "quantity":2,
            "properties":{
                "Size":"",
                "price":69,
                "prodId":3
            },
            "created_at":"2022-02-23T12:03:25.000000Z",
            "updated_at":"2022-02-23T12:03:25.000000Z",
            "total":138,
            "net_total":138
        },
        {
            "id":"2b3455ef-d123-4d9c-83fc-57e4bf6cc0b3",
            "itemable_type":"Bazar\\Models\\Order",
            "itemable_id":20,
            "buyable_type":null,
            "buyable_id":null,
            "name":" - Blana vulpe naturala alba xs",
            "price":2299,
            "tax":0,
            "quantity":1,
            "properties":{
                "Size":"XS",
                "price":3000,
                "prodId":1
            },
            "created_at":"2022-02-23T12:03:25.000000Z",
            "updated_at":"2022-02-23T12:03:25.000000Z",
            "total":2299,
            "net_total":2299
        }
    ],
    "transactions":[
        {
            "completed_at":"2022-02-23T12:03:25.000000Z",
            "type":"payment",
            "driver":"cash",
            "amount":2335.15,
            "order_id":20,
            "updated_at":"2022-02-23T12:03:25.000000Z",
            "created_at":"2022-02-23T12:03:25.000000Z",
            "id":22,
            "url":null,
            "driver_name":"Cash"
        }
    ]

}

Steps To Reproduce:

//--
        $data = [];
        $data['billing'] = [
            'first_name'    => (string) $request->input('fname'),
            'last_name'     => (string) $request->input('lname'),
            'address'       => (string) $request->input('address'),
            'email'         => (string) $request->input('email'),
            'phone'         => (string) $request->input('phone'),
            'country'       => (string) 'RO',
            'city'          => (string) $request->input('city'),
            'state'         => (string) $request->input('region'),
            'postcode'      => (string) $request->input('postalcode'),
            'custom'        => [
                'message'       => (string)$request->input('message')
            ]
        ];
        $data['shipping'] = $data['billing'];
        if($request->input('checkDiffContact')) {
            $data['shipping']['first_name'] = (string) $request->input('ov_fname');
            $data['shipping']['last_name']  = (string) $request->input('ov_lname');
            $data['shipping']['phone']      = (string) $request->input('ov_phone');
        }
        // dd($data);
        //--
        Cart::updateBilling($data['billing']);
        Cart::updateShipping($data['shipping'], $shippingCart->getAttribute('driver'));
        $order = Cart::checkout('cash');
        \Log::warning($order);
bobitza commented 2 years ago