Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getDetails return null in event listener #161

Open
MeysamFallah opened this issue Apr 12, 2021 · 5 comments
Open

getDetails return null in event listener #161

MeysamFallah opened this issue Apr 12, 2021 · 5 comments

Comments

@MeysamFallah
Copy link

Hi,
I set the details in pay function, but when the event fired at verify method, the getDetails method from $invoice return null after success payment.

@khanzadimahdi
Copy link
Member

why didn't you fill the issue template?
please put your code in the issue too.

@MeysamFallah
Copy link
Author

this is my code that I set the detail in $invoice. but in the event it returns empty:

$invoice = (new Invoice)->amount((int)$price);
            $invoice->detail(['user_id' => Auth::id(), 'product_id' => $cart->getProduct()->id]);
             $callBack = route('payment.verify');

            return ShetabitPayment::callbackUrl($callBack)->purchase($invoice, function ($driver, $transactionId) use ($price, $cart, $invoice) {
                auth()->user()->payments()->create([
                    'type' => $cart->gettype(),
                    'FinalAmount' => $price,
                    'RefId' => $transactionId
                ]);

                $cart->flush();

            })->pay()->render();
        }
        return back();
    }

and after that in InvoiceVerifiedEvent I can't get the data like this:

$invoiceDetails = $event->invoice->getDetails();

@khanzadimahdi
Copy link
Member

thanks for your report. could you fix it and send a pull request?

@khanzadimahdi
Copy link
Member

Hi again. could you tell me which driver do you use?

@MeysamFallah
Copy link
Author

Hi again. could you tell me which driver do you use?

Hi, I test it in Zarinpal sandbox and Behpardakht.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants