-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathBankdata.php
More file actions
73 lines (66 loc) · 2.05 KB
/
Copy pathBankdata.php
File metadata and controls
73 lines (66 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Copyright (c) Ratepay GmbH
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace RatePAY\Payment\Block\Customer;
class Bankdata extends \Magento\Framework\View\Element\Template
{
/**
* BAMS GetStoredBankAccounts request model
*
* @var \RatePAY\Payment\Model\BamsApi\GetStoredBankAccounts
*/
protected $getStoredBankAccounts;
/**
* Magento customer session object
*
* @var \Magento\Customer\Model\Session
*/
protected $customerSession;
/**
* Constructor
*
* @param \Magento\Framework\View\Element\Template\Context $context
* @param \RatePAY\Payment\Model\BamsApi\GetStoredBankAccounts $getStoredBankAccounts
* @param \Magento\Customer\Model\Session $customerSession
* @param array $data
*/
public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\RatePAY\Payment\Model\BamsApi\GetStoredBankAccounts $getStoredBankAccounts,
\Magento\Customer\Model\Session $customerSession,
array $data = []
) {
parent::__construct($context, $data);
$this->getStoredBankAccounts = $getStoredBankAccounts;
$this->customerSession = $customerSession;
}
/**
* Generate action url
*
* @param string $sHash
* @param string $sAction
* @return string
*/
public function getActionUrl($sHash, $sAction)
{
return $this->getUrl('ratepay/customer/'.$sAction, ['hash' => $sHash]);
}
/**
* Retrieve bank data from Ratepay
*
* @return array|bool
*/
public function getSavedBankData()
{
$iCustomerId = $this->customerSession->getCustomerId();
$aBankAccounts = $this->getStoredBankAccounts->getBankDataForAllIbanProfiles($iCustomerId);
if (empty($aBankAccounts)) {
return false;
}
return $aBankAccounts;
}
}