Closed nickurt closed 10 years ago
@nickurt can you elaborate please? I cannot understand your question completely.
There is an SlmIdealPayment\Client\StandardClient
class and the service locator provides SlmIdealPayment\Client\Standard\*
services which are pre-configured with the correct bank configuration options and certificates.
If you connect via the Rabobank, you can require SlmIdealPayment\Client\Standard\Rabobank
and all is already set up. Copy the slmidealpayment.local.php.dist
and only set the variables there.
Well, I'm using now SlmIdealPayment\Client\Standard\Rabobank
and going directly to Rabobank, that's correct.
But what I want is, that the visitors can select the bank (ING/Rabo (.e.g)) and then they will be redirected to the bank ...
@nickurt what is the code you've written you are directly redirected to the Rabobank? Usually iDEAL has three steps: you request the available issuers and then the user selects one of them. You request a transaction request, which returns a redirect url you point the client's browser to. Finally when the payment process is completed you've a status request to request the status of the payment.
// ServiceLocator
$sl = $this->getServiceLocator();
$client = $sl->get('SlmIdealPayment\Client\Standard\Rabobank');
// Set up the issuer
$issuer = new Model\Issuer;
$issuer->setId('RABONL2U');
[...]
$this->redirect()->toUrl($response->getAuthenticationUrl());
The SlmIdealPayment\Response\DirectoryResponse
gives me 9 banks ...
Well, seems I understand it now, I have to first to foreach the banks, and then step 2 with the issuerID it will be redirected to the bank?
@nickurt iDEAL is based on three steps:
<select>
, render them as <a>
elements; whatever you like in your design. Mind to cache the issuers list as they don't change very often.Ok, well then we have to update the example or to fix the code ...
The Directory request gives (your example in readme) me ..
SlmIdealPayment\Response\DirectoryResponse::getContries() in [...]
object(SlmIdealPayment\Response\DirectoryResponse)#407 (2) {
["countries":protected]=>
array(1) {
[0]=>
object(SlmIdealPayment\Model\Country)#415 (2) {
["name":protected]=>
string(9) "Nederland"
["issuers":protected]=>
array(9) {
[0]=>
object(SlmIdealPayment\Model\Issuer)#416 (2) {
["id":protected]=>
string(8) "ABNANL2A"
["name":protected]=>
string(8) "ABN Amro"
}
[1]=>
object(SlmIdealPayment\Model\Issuer)#414 (2) {
["id":protected]=>
string(8) "INGBNL2A"
["name":protected]=>
string(3) "ING"
}
[..]
@nickurt that is exactly what you can print with this php code:
foreach ($response->getContries() as $country) {
echo sprintf("Country: %s\n", $country->getName());
foreach ($country->getIssuers() as $issuer) {
echo sprintf("%s: %s\n", $issuer->getId(), $issuer->getName());
}
}
You var_dump() the DirectoryResponse
object, which have the method getCountry()
and that returns an array of Country models with the methods getName()
and getIssuers()
. The issuers method returns an array of Issuer models.
Your example gives me ...
Fatal error: Call to undefined method SlmIdealPayment\Response\DirectoryResponse::getContries()
@nickurt Ah I reckon the mistake; there is a typo in the README which calls getContries()
instead of getCountries()
. If you correct that, all should work fine.
Ah, working, thanks :+1:
It is not possible to have a selection list of banks?, now you are define the bank already in the code ...
Or I have to use
SlmIdealPayment\Client\StandardClient
and notSlmIdealPayment\Client\Standard\Rabobank
?