Comments (12)
I've never got it, so not able to fix it, Could you investigate it further and fix,
BTW why not use 1.0?
from payumlaravelpackage.
Facing the same issue. Laravel 5.1
From composer.json
"payum/payum-laravel-package": "^1.0",
"payum/payum": "^1.0"
My PaymentController:
namespace App\Http\Controllers;
use Payum\LaravelPackage\Controller\PayumController;
class PaymentController extends PayumController {
public function payum()
{
$storage = $this->getPayum()->getStorage('Payum\Core\Model\Payment');
dd($this->getPayum());
$details = $storage->create();
$details['PAYMENTREQUEST_0_CURRENCYCODE'] = 'EUR';
$details['PAYMENTREQUEST_0_AMT'] = 1.23;
$storage->update($details);
$captureToken = $this->getPayum()->getTokenFactory()->createCaptureToken('paypal_ec', $details, 'payment_done');
return \Redirect::to($captureToken->getTargetUrl());
}
}
from payumlaravelpackage.
Hm, I am not sure but I suspect you haven't registered the payum service? Could you confirm you did it?
Btw, Do you use laravel 5?
from payumlaravelpackage.
Yes, you're right, it was the reason. In Get it started there is no info about registering service. So I registered Payum\LaravelPackage\PayumServiceProvider and now getting "Token storage must be configured" error.
And yes, I use 5.1 Laravel
from payumlaravelpackage.
Indeed the doc miss this part, gonna fix it. To solve token storage must be configure you have to add a token storage to the payum builder, most like you want to choose eloquent storage.
<?php
// bootstrap/start.php
use Payum\LaravelPackage\Storage\EloquentStorage;
use Payum\LaravelPackage\Model\Token;
App::resolving('payum.builder', function(\Payum\Core\PayumBuilder $payumBuilder) {
$payumBuilder
->setTokenStorage(new EloquentStorage(Token::class))
;
});
from payumlaravelpackage.
ok, but bootstrap/start.php is for Laravel 4. Where to put this config in L5.1?
from payumlaravelpackage.
Put in any other place which is similar to start.php and where you can do similar things. I am not laravel developer. I dont know
from payumlaravelpackage.
This what you have to do to fix the reflection bug: https://github.com/makasim/PayumLaravelBundleSandbox/blob/payum-examples2/app/config/app.php#L124
from payumlaravelpackage.
The doc is updated: https://github.com/Payum/PayumLaravelPackage/blob/master/docs/get-it-started.md
from payumlaravelpackage.
Have succeeded with package setup. Here what you need to do if you use L5.1
-
Piece of code that resolves PayumBuilder should go from bootstrap/start.php to some ServiceProvider, for example PayumServiceProvider:
namespace App\Providers; use Illuminate\Support\ServiceProvider; use Payum\LaravelPackage\Storage\EloquentStorage; use Payum\LaravelPackage\Model\Token; //use Payum\LaravelPackage\Model\Payment; use \App\Payment; class PayumServiceProvider extends ServiceProvider { public function register() { \App::resolving('payum.builder', function(\Payum\Core\PayumBuilder $payumBuilder) { $payumBuilder ->setTokenStorage(new EloquentStorage(Token::class)) ->addStorage(Payment::class, new EloquentStorage(Payment::class)) ->addGateway('paypal_ec', [ 'factory' => 'paypal_express_checkout', 'username' => config('payum.username'), 'password' => config('payum.password'), 'signature' => config('payum.signature'), 'sandbox' => config('payum.sandbox') ]) ; }); } }
-
Here you can use Payment model from the package and API call should be successfull but it will give an error if using Payment done controller code from example: https://github.com/Payum/PayumLaravelPackage/blob/master/docs/payment_done_controller.md. Because it doesn't implement Iterator interface and iterator_to_array will crash. So we need to extend base model, implement IteratorAggregate and add method from the Interface:
namespace App; use Illuminate\Database\Eloquent\Model; use IteratorAggregate; use ArrayIterator; class Payment extends \Payum\LaravelPackage\Model\Payment implements IteratorAggregate { public function getIterator() { return new ArrayIterator($this->getDetails()); } }
Good luck!
from payumlaravelpackage.
@ribagek Thank you for sharing. I'll adjust the docs with what you write here, do you want to do it maybe?
Though I am not sure about the second part. The done action is the action where you put your own logic, iterator_to_array is used just to show you that you have access to all payment details. Feel free to remove it completely and put there whatever you need. Do not implement IteratorAggregate interface until you need it in your business logic
from payumlaravelpackage.
totaly agree about 2nd. Thanks, I will add this to docs
from payumlaravelpackage.
Related Issues (20)
- Any plans to support Moneris?
- Composer install fails laravel 5.1 HOT 4
- Does this package support laravel 5.2? HOT 3
- Getting 0 as hash for the targetUrl HOT 7
- Class payum does not exist HOT 1
- Why Using Core version 1.0.0 HOT 2
- Request Cancel{model: ArrayObject} is not supported HOT 2
- GetHumanStatus{model: ArrayObject} is not supported HOT 6
- Trait 'Payum\Core\GatewayAwareTrait' not found HOT 13
- Is this Compatible with latest laravel? 5.2 or 5.3? HOT 4
- Request GetHumanStatus{model: ArrayObject} is not supported. HOT 1
- Payum/PayumLaravelPackage paypal express checkout capture route not working
- Is this a active branch and compatible with latest laravel? 5.7 or 5.8?
- Missing decimal point in amount when using EloquentStorage and OmnipayBridge
- Request Refund{model: ArrayObject} is not supported. Make sure the gateway supports the requests and there is an action which supports this request (The method returns true). There may be a bug, so look for a related issue on the issue tracker. HOT 1
- Subscription defined by a start and end date.
- Notify Controller doUnsafeAction doesn't resolve gateway name parameter
- Configuration from a database?
- Not installing, Laravel Container issue HOT 2
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 payumlaravelpackage.