Comments (6)
You're right! Thank you for your support! Actually there were 2 classes called Payment. And I had added the other one (by PHPStorm autocomplete), instead of Payment facade.
from payment.
as the name loadDefaultConfig
says, this method loads the default config of the package.
if you publish the configs using php artisan vendor:publish
then your configs will be loaded instead of defaults.
your config file should be exists in config/payment.php
path.
from payment.
Yes, I've already used that artisan command and the file does exist at config/payment.php. But anything I configure in config/payment.php is not applied including merchantId.
from payment.
run your project outside of docker and publish vendors, then check if every thing goes correctly or not and let me know about it.
from payment.
Dear friend, I tried running the project outside docker on production environment. The problem still exists. Could you please determine where in your code that published vendor config file is read?
This is the code I'm using for payment:
// create invoice
$invoice->amount(1000)
->detail('detail1', 'your detail1 goes here')
->detail('detailName2', 'your detail2 goes here');
// dd($invoice);
$orderAuditNumber = 10406;
$payment = new Payment();
dd($payment);
return $payment->callbackUrl(route('verify-order-payment', $orderAuditNumber))
->purchase(
$invoice,
function ($driver, $transactionId)
{
// dd('inside callback');
}
)
->pay()
->render();
So, getting those invoice and payment objects shows that my merchantId is empty string and other configs are not applied, too. Also, another issue I saw was when I tried to run static function calls as suggested in github document like:
return Payment::purchase(
(new Invoice)->amount(1000),
function($driver, $transactionId) {
// Store transactionId in database.
// We need the transactionId to verify payment in the future.
}
)->pay()->render();
Purchase function seems to be declared as a non-static function in driver files (like Zarinpal.php).
public function purchase()
But called statically in github document like the above call.
from payment.
you have done a mistake in your codes.
the Payment
constructor accepts configs, so if you wanna to instantiate it, you MUST pass configs to it by yourself.
you have not fellow the docs, you should use Payment
facade instead, then the package will handle configs itself.
change the codes like the below:
// Create new invoice.
$invoice = (new Invoice)->amount(1000);
// Purchase and pay the given invoice.
// You should use return statement to redirect user to the bank page.
return Payment::purchase($invoice, function($driver, $transactionId) {
// Store transactionId in database as we need it to verify payment in the future.
})->pay()->render();
and about non-static function in driver files
, i could say that Payment
class handles calling methods and its not related to Zarinpal
, this is a kind of Proxy
pattern.
from payment.
Related Issues (20)
- فرستادن status code تراکنش در verify idpay HOT 3
- log-out کاربر بعد از برگشت از سایت HOT 5
- Cannot change default gateway dynamically HOT 4
- امکان نتیجه (موفق یا ناموفق) پرداخت قبل از اجرای متد verify وجود دارد؟ HOT 1
- مشکلات درگاه آیدی پی HOT 1
- دریافت اطلاعات در زمان اعتبارسنجی HOT 1
- مشاهده خطای ناشناخته در درگاه سامان بعد از عوض کردن سرور HOT 2
- مشکل با درگاه پاسارگاد HOT 2
- Method Illuminate\Support\Str::replace does not exist. HOT 5
- Check new pull request HOT 2
- درگاه به پرداخت HOT 1
- تغییر توضیحات ارسال به درگاه به پرداخت HOT 1
- نوع ستون transactionId رو در دیتابیس باید چی بزاریم؟ HOT 1
- Class "SoapClient" not found
- درگاه زرین پال - اشتباه ذخیره کردن بعضی از transaction_id ها یا همون authority زرین پال HOT 1
- خطا logout شدن کاربر HOT 1
- تنظیمات درایور دلخواه در کنترولر HOT 1
- خطای درگاه بانک ملی HOT 1
- خطای کال بک درگاه پارسیان HOT 12
- خطای cURL زرین پال
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from payment.