Skip to content

Commit 6bfde04

Browse files
committed
Merge pull request #428 from magento-mpi/MAGETWO-32996
[MPI] Worldpay
2 parents c673db6 + 9722d12 commit 6bfde04

File tree

36 files changed

+815
-72
lines changed

36 files changed

+815
-72
lines changed

app/code/Magento/Authorizenet/Model/Directpost.php

+22
Original file line numberDiff line numberDiff line change
@@ -898,4 +898,26 @@ protected function addStatusCommentOnUpdate(
898898
}
899899
return $this;
900900
}
901+
902+
/**
903+
* Sets method code
904+
*
905+
* @param string $methodCode
906+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
907+
* @return void
908+
*/
909+
public function setMethodCode($methodCode)
910+
{
911+
}
912+
913+
/**
914+
* Sets path pattern
915+
*
916+
* @param string $pathPattern
917+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
918+
* @return void
919+
*/
920+
public function setPathPattern($pathPattern)
921+
{
922+
}
901923
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Payment\Block;
7+
8+
use Magento\Framework\Phrase;
9+
use Magento\Framework\View\Element\Template\Context;
10+
use Magento\Payment\Gateway\ConfigInterface;
11+
12+
class ConfigurableInfo extends \Magento\Payment\Block\Info
13+
{
14+
/**
15+
* @var ConfigInterface
16+
*/
17+
private $config;
18+
19+
/**
20+
* @param Context $context
21+
* @param ConfigInterface $config
22+
* @param array $data
23+
*/
24+
public function __construct(
25+
Context $context,
26+
ConfigInterface $config,
27+
array $data = []
28+
) {
29+
parent::__construct($context, $data);
30+
$this->config = $config;
31+
32+
if (isset($data['pathPattern'])) {
33+
$this->config->setPathPattern($data['pathPattern']);
34+
}
35+
36+
if (isset($data['pathPattern'])) {
37+
$this->config->setMethodCode($data['methodCode']);
38+
}
39+
}
40+
41+
/**
42+
* Prepare PayPal-specific payment information
43+
*
44+
* @param \Magento\Framework\Object|array|null $transport
45+
* @return \Magento\Framework\Object
46+
*/
47+
protected function _prepareSpecificInformation($transport = null)
48+
{
49+
$transport = parent::_prepareSpecificInformation($transport);
50+
$payment = $this->getInfo();
51+
$fieldsToStore = explode(',', (string)$this->config->getValue('paymentInfoKeys'));
52+
if ($this->getIsSecureMode()) {
53+
$fieldsToStore = array_diff(
54+
$fieldsToStore,
55+
explode(',', (string)$this->config->getValue('privateInfoKeys'))
56+
);
57+
}
58+
59+
foreach ($fieldsToStore as $field) {
60+
if ($payment->getAdditionalInformation($field) !== null) {
61+
$this->setDataToTransfer(
62+
$transport,
63+
$field,
64+
$payment->getAdditionalInformation($field)
65+
);
66+
67+
}
68+
}
69+
70+
return $transport;
71+
}
72+
73+
/**
74+
* Sets data to transport
75+
*
76+
* @param \Magento\Framework\Object $transport
77+
* @param string $field
78+
* @param string $value
79+
* @return void
80+
*/
81+
protected function setDataToTransfer(
82+
\Magento\Framework\Object $transport,
83+
$field,
84+
$value
85+
) {
86+
$transport->setData(
87+
(string)$this->getLabel($field),
88+
(string)$this->getValueView(
89+
$field,
90+
$value
91+
)
92+
);
93+
}
94+
95+
/**
96+
* Returns label
97+
*
98+
* @param string $field
99+
* @return string | Phrase
100+
*/
101+
protected function getLabel($field)
102+
{
103+
return $field;
104+
}
105+
106+
/**
107+
* Returns value view
108+
*
109+
* @param string $field
110+
* @param string $value
111+
* @return string | Phrase
112+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
113+
*/
114+
protected function getValueView($field, $value)
115+
{
116+
return $value;
117+
}
118+
}

app/code/Magento/Payment/Block/Info/Cc.php

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ protected function _prepareSpecificInformation($transport = null)
101101
if ($this->getInfo()->getCcLast4()) {
102102
$data[(string)__('Credit Card Number')] = sprintf('xxxx-%s', $this->getInfo()->getCcLast4());
103103
}
104+
104105
if (!$this->getIsSecureMode()) {
105106
if ($ccSsIssue = $this->getInfo()->getCcSsIssue()) {
106107
$data[(string)__('Switch/Solo/Maestro Issue Number')] = $ccSsIssue;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Payment\Gateway\Command;
7+
8+
use Magento\Payment\Gateway\Command;
9+
use Magento\Payment\Gateway\CommandInterface;
10+
11+
class NullCommand implements CommandInterface
12+
{
13+
/**
14+
* Null command. Does nothing. Stable.
15+
*
16+
* @param array $commandSubject
17+
*
18+
* @return null|Command\ResultInterface
19+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
20+
*/
21+
public function execute(array $commandSubject)
22+
{
23+
return null;
24+
}
25+
}

app/code/Magento/Payment/Gateway/Config/Config.php

+23-1
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,36 @@ class Config implements ConfigInterface
3535
*/
3636
public function __construct(
3737
ScopeConfigInterface $scopeConfig,
38-
$methodCode,
38+
$methodCode = '',
3939
$pathPattern = self::DEFAULT_PATH_PATTERN
4040
) {
4141
$this->scopeConfig = $scopeConfig;
4242
$this->methodCode = $methodCode;
4343
$this->pathPattern = $pathPattern;
4444
}
4545

46+
/**
47+
* Sets method code
48+
*
49+
* @param string $methodCode
50+
* @return void
51+
*/
52+
public function setMethodCode($methodCode)
53+
{
54+
$this->methodCode = $methodCode;
55+
}
56+
57+
/**
58+
* Sets path pattern
59+
*
60+
* @param string $pathPattern
61+
* @return void
62+
*/
63+
public function setPathPattern($pathPattern)
64+
{
65+
$this->pathPattern = $pathPattern;
66+
}
67+
4668
/**
4769
* Retrieve information from payment configuration
4870
*

app/code/Magento/Payment/Gateway/ConfigInterface.php

+16
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,20 @@ interface ConfigInterface
1616
* @return mixed
1717
*/
1818
public function getValue($field, $storeId = null);
19+
20+
/**
21+
* Sets method code
22+
*
23+
* @param string $methodCode
24+
* @return void
25+
*/
26+
public function setMethodCode($methodCode);
27+
28+
/**
29+
* Sets path pattern
30+
*
31+
* @param string $pathPattern
32+
* @return void
33+
*/
34+
public function setPathPattern($pathPattern);
1935
}

app/code/Magento/Payment/Gateway/Data/AddressAdapterInterface.php

+17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Payment\Gateway\Data;
77

8+
/**
9+
* Interface AddressAdapterInterface
10+
*/
811
interface AddressAdapterInterface
912
{
1013
/**
@@ -90,4 +93,18 @@ public function getCustomerId();
9093
* @return string
9194
*/
9295
public function getEmail();
96+
97+
/**
98+
* Returns name prefix
99+
*
100+
* @return string
101+
*/
102+
public function getPrefix();
103+
104+
/**
105+
* Returns name suffix
106+
*
107+
* @return string
108+
*/
109+
public function getSuffix();
93110
}

app/code/Magento/Payment/Gateway/Data/Order/AddressAdapter.php

+23
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Payment\Gateway\Data\AddressAdapterInterface;
99
use Magento\Sales\Api\Data\OrderAddressInterface;
1010

11+
/**
12+
* Class AddressAdapter
13+
*/
1114
class AddressAdapter implements AddressAdapterInterface
1215
{
1316
/**
@@ -144,4 +147,24 @@ public function getEmail()
144147
{
145148
return $this->address->getEmail();
146149
}
150+
151+
/**
152+
* Returns name prefix
153+
*
154+
* @return string
155+
*/
156+
public function getPrefix()
157+
{
158+
return $this->address->getPrefix();
159+
}
160+
161+
/**
162+
* Returns name suffix
163+
*
164+
* @return string
165+
*/
166+
public function getSuffix()
167+
{
168+
return $this->address->getSuffix();
169+
}
147170
}

app/code/Magento/Payment/Gateway/Data/Order/OrderAdapter.php

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Magento\Payment\Gateway\Data\OrderAdapterInterface;
1010
use Magento\Sales\Api\Data\OrderInterface;
1111

12+
/**
13+
* Class OrderAdapter
14+
*/
1215
class OrderAdapter implements OrderAdapterInterface
1316
{
1417
/**

app/code/Magento/Payment/Gateway/Data/OrderAdapterInterface.php

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Payment\Gateway\Data;
77

8+
/**
9+
* Interface OrderAdapterInterface
10+
*/
811
interface OrderAdapterInterface
912
{
1013
/**

app/code/Magento/Payment/Gateway/Data/Quote/AddressAdapter.php

+23
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
use Magento\Payment\Gateway\Data\AddressAdapterInterface;
99
use Magento\Quote\Api\Data\AddressInterface;
1010

11+
/**
12+
* Class AddressAdapter
13+
*/
1114
class AddressAdapter implements AddressAdapterInterface
1215
{
1316
/**
@@ -144,4 +147,24 @@ public function getEmail()
144147
{
145148
return $this->address->getEmail();
146149
}
150+
151+
/**
152+
* Returns name prefix
153+
*
154+
* @return string
155+
*/
156+
public function getPrefix()
157+
{
158+
return $this->address->getPrefix();
159+
}
160+
161+
/**
162+
* Returns name suffix
163+
*
164+
* @return string
165+
*/
166+
public function getSuffix()
167+
{
168+
return $this->address->getSuffix();
169+
}
147170
}

app/code/Magento/Payment/Gateway/Data/Quote/QuoteAdapter.php

+4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
*/
66
namespace Magento\Payment\Gateway\Data\Quote;
77

8+
use Magento\Framework\Exception\LocalizedException;
89
use Magento\Payment\Gateway\Data\OrderAdapterInterface;
910
use Magento\Quote\Api\Data\CartInterface;
1011
use Magento\Payment\Gateway\Data\AddressAdapterInterface;
1112

13+
/**
14+
* Class QuoteAdapter
15+
*/
1216
class QuoteAdapter implements OrderAdapterInterface
1317
{
1418
/**

0 commit comments

Comments
 (0)