Skip to content

Commit c915f36

Browse files
committed
Merge pull request #213 from magento-firedrakes/MAGETWO-34653
[Firedrakes] Enhanced Number (increment) management
2 parents 09cadae + 6071236 commit c915f36

File tree

163 files changed

+5271
-1665
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+5271
-1665
lines changed

app/code/Magento/Customer/Block/Address/Renderer/DefaultRenderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
*/
66
namespace Magento\Customer\Block\Address\Renderer;
77

8-
use Magento\Customer\Model\Address\AbstractAddress;
8+
use Magento\Customer\Model\Address\AddressModelInterface;
99
use Magento\Customer\Model\Address\Mapper;
1010
use Magento\Customer\Model\Metadata\ElementFactory;
1111
use Magento\Framework\View\Element\AbstractBlock;
@@ -111,7 +111,7 @@ public function getFormat(AbstractAddress $address = null)
111111
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
112112
* @SuppressWarnings(PHPMD.NPathComplexity)
113113
*/
114-
public function render(AbstractAddress $address, $format = null)
114+
public function render(AddressModelInterface $address, $format = null)
115115
{
116116
$address = $address->getDataModel(0, 0);
117117
return $this->renderArray($this->addressMapper->toFlatArray($address), $format);

app/code/Magento/Customer/Block/Address/Renderer/RendererInterface.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
namespace Magento\Customer\Block\Address\Renderer;
77

88
use Magento\Directory\Model\Country\Format;
9+
use Magento\Customer\Model\Address\AddressModelInterface;
910

1011
/**
1112
* Address renderer interface
@@ -32,12 +33,12 @@ public function getType();
3233
/**
3334
* Render address
3435
*
35-
* @param \Magento\Customer\Model\Address\AbstractAddress $address
36+
* @param AddressModelInterface $address
3637
* @param string|null $format
3738
* @return mixed
3839
* @deprecated All new code should use renderArray based on Metadata service
3940
*/
40-
public function render(\Magento\Customer\Model\Address\AbstractAddress $address, $format = null);
41+
public function render(AddressModelInterface $address, $format = null);
4142

4243
/**
4344
* Get a format object for a given address attributes, based on the type set earlier.

app/code/Magento/Customer/Model/Address/AbstractAddress.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* @method bool getShouldIgnoreValidation()
3030
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3131
*/
32-
class AbstractAddress extends AbstractExtensibleModel
32+
class AbstractAddress extends AbstractExtensibleModel implements AddressModelInterface
3333
{
3434
/**
3535
* Possible customer address types
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Customer\Model\Address;
8+
9+
/**
10+
* Interface AddressInterface
11+
*/
12+
interface AddressModelInterface
13+
{
14+
/**
15+
* Get steet line by number
16+
*
17+
* @param int $number
18+
* @return string
19+
*/
20+
public function getStreetLine($number);
21+
22+
/**
23+
* Create fields street1, street2, etc.
24+
*
25+
* To be used in controllers for views data
26+
*
27+
* @return $this
28+
*/
29+
public function explodeStreetAddress();
30+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ class Info extends \Magento\Framework\View\Element\Template
2525
/**
2626
* Retrieve info model
2727
*
28-
* @return \Magento\Payment\Model\Info
28+
* @return \Magento\Payment\Model\InfoInterface
2929
* @throws \Magento\Framework\Exception\LocalizedException
3030
*/
3131
public function getInfo()
3232
{
3333
$info = $this->getData('info');
34-
if (!$info instanceof \Magento\Payment\Model\Info) {
34+
if (!$info instanceof \Magento\Payment\Model\InfoInterface) {
3535
throw new \Magento\Framework\Exception\LocalizedException(
3636
__('We cannot retrieve the payment info model object.')
3737
);

app/code/Magento/Payment/Helper/Data.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\Quote\Model\Quote;
1010
use Magento\Store\Model\Store;
1111
use Magento\Payment\Block\Form;
12-
use Magento\Payment\Model\Info;
12+
use Magento\Payment\Model\InfoInterface;
1313
use Magento\Framework\View\Element\Template;
1414
use Magento\Framework\View\LayoutInterface;
1515
use Magento\Framework\View\LayoutFactory;
@@ -182,11 +182,11 @@ public function getMethodFormBlock(MethodInterface $method, LayoutInterface $lay
182182
/**
183183
* Retrieve payment information block
184184
*
185-
* @param Info $info
185+
* @param InfoInterface $info
186186
* @param \Magento\Framework\View\LayoutInterface $layout
187187
* @return Template
188188
*/
189-
public function getInfoBlock(Info $info, LayoutInterface $layout = null)
189+
public function getInfoBlock(InfoInterface $info, LayoutInterface $layout = null)
190190
{
191191
$layout = $layout ?: $this->_layout;
192192
$blockType = $info->getMethodInstance()->getInfoBlockType();
@@ -198,12 +198,12 @@ public function getInfoBlock(Info $info, LayoutInterface $layout = null)
198198
/**
199199
* Render payment information block
200200
*
201-
* @param Info $info
201+
* @param InfoInterface $info
202202
* @param int $storeId
203203
* @return string
204204
* @throws \Exception
205205
*/
206-
public function getInfoBlockHtml(Info $info, $storeId)
206+
public function getInfoBlockHtml(InfoInterface $info, $storeId)
207207
{
208208
$this->_appEmulation->startEnvironmentEmulation($storeId);
209209

app/code/Magento/Payment/Model/Info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/**
1111
* Payment information model
1212
*/
13-
class Info extends AbstractExtensibleModel
13+
class Info extends AbstractExtensibleModel implements InfoInterface
1414
{
1515
/**
1616
* Additional information container
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?php
2+
/**
3+
* Copyright © 2015 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
7+
namespace Magento\Payment\Model;
8+
9+
/**
10+
* Interface InfoInterface
11+
*/
12+
interface InfoInterface
13+
{
14+
/**
15+
* Encrypt data
16+
*
17+
* @param string $data
18+
* @return string
19+
*/
20+
public function encrypt($data);
21+
22+
/**
23+
* Decrypt data
24+
*
25+
* @param string $data
26+
* @return string
27+
*/
28+
public function decrypt($data);
29+
30+
/**
31+
* Set Additional information about payment into Payment model
32+
*
33+
* @param string $key
34+
* @param string|null $value
35+
* @return mixed
36+
*/
37+
public function setAdditionalInformation($key, $value = null);
38+
39+
/**
40+
* Check whether there is additional information by specified key
41+
*
42+
* @param mixed|null $key
43+
* @return bool
44+
*/
45+
public function hasAdditionalInformation($key = null);
46+
47+
/**
48+
* Unsetter for entire additional_information value or one of its element by key
49+
*
50+
* @param string|null $key
51+
* @return $this
52+
*/
53+
public function unsAdditionalInformation($key = null);
54+
55+
/**
56+
* Getter for entire additional_information value or one of its element by key
57+
*
58+
* @param string|null $key
59+
* @return mixed
60+
*/
61+
public function getAdditionalInformation($key = null);
62+
63+
/**
64+
* Retrieve payment method model object
65+
*
66+
* @return \Magento\Payment\Model\MethodInterface
67+
* @throws \Magento\Framework\Exception\LocalizedException
68+
*/
69+
public function getMethodInstance();
70+
}

app/code/Magento/Payment/Model/Method/AbstractMethod.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,12 +382,12 @@ public function canFetchTransactionInfo()
382382
/**
383383
* Fetch transaction info
384384
*
385-
* @param \Magento\Payment\Model\Info $payment
385+
* @param \Magento\Payment\Model\InfoInterface $payment
386386
* @param string $transactionId
387387
* @return array
388388
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
389389
*/
390-
public function fetchTransactionInfo(\Magento\Payment\Model\Info $payment, $transactionId)
390+
public function fetchTransactionInfo(\Magento\Payment\Model\InfoInterface $payment, $transactionId)
391391
{
392392
return [];
393393
}
@@ -497,7 +497,7 @@ public function getInfoBlockType()
497497
public function getInfoInstance()
498498
{
499499
$instance = $this->getData('info_instance');
500-
if (!$instance instanceof \Magento\Payment\Model\Info) {
500+
if (!$instance instanceof \Magento\Payment\Model\InfoInterface) {
501501
throw new \Magento\Framework\Exception\LocalizedException(__('We cannot retrieve the payment information object instance.'));
502502
}
503503
return $instance;
@@ -673,23 +673,23 @@ public function void(\Magento\Framework\Object $payment)
673673
/**
674674
* Whether this method can accept or deny payment
675675
*
676-
* @param \Magento\Payment\Model\Info $payment
676+
* @param \Magento\Payment\Model\InfoInterface $payment
677677
* @return bool
678678
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
679679
*/
680-
public function canReviewPayment(\Magento\Payment\Model\Info $payment)
680+
public function canReviewPayment(\Magento\Payment\Model\InfoInterface $payment)
681681
{
682682
return $this->_canReviewPayment;
683683
}
684684

685685
/**
686686
* Attempt to accept a payment that us under review
687687
*
688-
* @param \Magento\Payment\Model\Info $payment
688+
* @param \Magento\Payment\Model\InfoInterface $payment
689689
* @return false
690690
* @throws \Magento\Framework\Exception\LocalizedException
691691
*/
692-
public function acceptPayment(\Magento\Payment\Model\Info $payment)
692+
public function acceptPayment(\Magento\Payment\Model\InfoInterface $payment)
693693
{
694694
if (!$this->canReviewPayment($payment)) {
695695
throw new \Magento\Framework\Exception\LocalizedException(__('The payment review action is unavailable.'));
@@ -700,11 +700,11 @@ public function acceptPayment(\Magento\Payment\Model\Info $payment)
700700
/**
701701
* Attempt to deny a payment that us under review
702702
*
703-
* @param \Magento\Payment\Model\Info $payment
703+
* @param \Magento\Payment\Model\InfoInterface $payment
704704
* @return false
705705
* @throws \Magento\Framework\Exception\LocalizedException
706706
*/
707-
public function denyPayment(\Magento\Payment\Model\Info $payment)
707+
public function denyPayment(\Magento\Payment\Model\InfoInterface $payment)
708708
{
709709
if (!$this->canReviewPayment($payment)) {
710710
throw new \Magento\Framework\Exception\LocalizedException(__('The payment review action is unavailable.'));

app/code/Magento/Payment/Test/Unit/Block/Info/CcTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,11 +135,11 @@ public function testGetCcExpDate($ccExpMonth, $ccExpYear)
135135
$paymentInfo
136136
->expects($this->any())
137137
->method('getCcExpMonth')
138-
->will($this->returnValue($ccExpMonth));
138+
->willReturn($ccExpMonth);
139139
$paymentInfo
140140
->expects($this->any())
141141
->method('getCcExpYear')
142-
->will($this->returnValue($ccExpYear));
142+
->willReturn($ccExpYear);
143143
$this->model->setData('info', $paymentInfo);
144144

145145
$this->localeDate

0 commit comments

Comments
 (0)