Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
353 stars 102 forks source link

Create Usage Billing error Call to undefined method Illuminate\\Http\\RedirectResponse::getMessage() #156

Closed bilalfolio3 closed 1 year ago

bilalfolio3 commented 1 year ago

For bug reporting only! If you're posting a feature request or discussion, please ignore.

Expected Behavior

When we create a usage using the code below it should redirect and The package will take care of issuing the charge, storing it in the database, and redirection.


`# App/Http/Controllers/Example
# ...
public function index()
{
    // Description and price of usage charge (the only two parameters required)
    $charge = [
        'description' => 'Five e-mails',
        'price'       => 1.00,
        'redirect'    => route('example.success') // Optional, if not supplied redirect goes back to previous page with flash `success`=`true`
    ];

    // Create a signature to prevent tampering
    $signature = Util::createHmac(['data' => $charge, 'buildQuery' => true], Config::get('shopify-app.api_secret'));

    // Create the route
    $usageChargeRoute = route('billing.usage_charge', array_merge($charge, ['signature' => $signature->toNative()]));

    return view('example.index', compact('usageChargeRoute'));
}` 

Current Behavior

It is giving error

"error": "Call to undefined method Illuminate\Http\RedirectResponse::getMessage()",

"trace": [
{
"file": "app/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php)",
"line": 256,
"function": "throwBadMethodCallException",
"class": "Illuminate\\Http\\RedirectResponse",
"type": "::"
}

Failure Information

Package Version: ^17.4 Laravel Version: ^8.83 PHP Version: 8.1.15

Steps to Reproduce

  1. Step 1 https://github.com/Kyon147/laravel-shopify/wiki/Creating-a-Billable-App Follow the steps provided and create an additional usage charge with the provided sample code

Failure Logs

{
"message": "Whoops, looks like something went wrong ",
"trace": {
"error": "Call to undefined method Illuminate\\Http\\RedirectResponse::getMessage()",
"trace": [
{
"file": "app/vendor/laravel/framework/src/Illuminate/Http/RedirectResponse.php)",
"line": 256,
"function": "throwBadMethodCallException",
"class": "Illuminate\\Http\\RedirectResponse",
"type": "::"
}