Skip to content

Commit 8a77ab9

Browse files
committed
🐛 bug fixes
1 parent 2aabeea commit 8a77ab9

File tree

76 files changed

+679
-134
lines changed

Some content is hidden

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

76 files changed

+679
-134
lines changed

Api/BaseRequestDataProviderInterface.php

100644100755
File mode changed.

Api/BilletCreditCardRequestDataProviderInterface.php

+19
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,24 @@ public function getSecurityCode();
6969
* @return string
7070
*/
7171
public function getIsOneDollarAuthEnabled();
72+
73+
/**
74+
* @return string
75+
*/
76+
public function getCustomerAddressStreet($shipping);
77+
78+
/**
79+
* @return string
80+
*/
81+
public function getCustomerAddressNumber($shipping);
7282

83+
/**
84+
* @return string
85+
*/
86+
public function getCustomerAddressComplement($shipping);
87+
88+
/**
89+
* @return string
90+
*/
91+
public function getCustomerAddressDistrict($shipping);
7392
}

Api/BilletRequestDataProviderInterface.php

100644100755
+20
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,24 @@ public function getInstructions();
2828
* @return string
2929
*/
3030
public function getDaysToAddInBoletoExpirationDate();
31+
32+
/**
33+
* @return string
34+
*/
35+
public function getCustomerAddressStreet($shipping);
36+
37+
/**
38+
* @return string
39+
*/
40+
public function getCustomerAddressNumber($shipping);
41+
42+
/**
43+
* @return string
44+
*/
45+
public function getCustomerAddressComplement($shipping);
46+
47+
/**
48+
* @return string
49+
*/
50+
public function getCustomerAddressDistrict($shipping);
3151
}

Api/CreditCardRequestDataProviderInterface.php

100644100755
+20
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,24 @@ public function getSecurityCode();
6464
* @return string
6565
*/
6666
public function getIsOneDollarAuthEnabled();
67+
68+
/**
69+
* @return string
70+
*/
71+
public function getCustomerAddressStreet($shipping);
72+
73+
/**
74+
* @return string
75+
*/
76+
public function getCustomerAddressNumber($shipping);
77+
78+
/**
79+
* @return string
80+
*/
81+
public function getCustomerAddressComplement($shipping);
82+
83+
/**
84+
* @return string
85+
*/
86+
public function getCustomerAddressDistrict($shipping);
6787
}

Api/Data/InstallmentInterface.php

100644100755
File mode changed.

Api/InstallmentsManagementInterface.php

100644100755
File mode changed.

Api/TwoCreditCardRequestDataProviderInterface.php

+20
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,24 @@ public function getSecurityCode();
6464
* @return string
6565
*/
6666
public function getIsOneDollarAuthEnabled();
67+
68+
/**
69+
* @return string
70+
*/
71+
public function getCustomerAddressStreet($shipping);
72+
73+
/**
74+
* @return string
75+
*/
76+
public function getCustomerAddressNumber($shipping);
77+
78+
/**
79+
* @return string
80+
*/
81+
public function getCustomerAddressComplement($shipping);
82+
83+
/**
84+
* @return string
85+
*/
86+
public function getCustomerAddressDistrict($shipping);
6787
}

Block/Adminhtml/System/Config/Fieldset/Group.php

100644100755
File mode changed.

Block/Adminhtml/System/Config/Fieldset/Payment.php

100644100755
File mode changed.

Gateway/Transaction/Base/Command/AbstractApiCommand.php

100644100755
File mode changed.

Gateway/Transaction/Base/Command/InitializeCommand.php

100644100755
File mode changed.

Gateway/Transaction/Base/Config/AbstractConfig.php

100644100755
File mode changed.

Gateway/Transaction/Base/Config/Config.php

100644100755
+29-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,35 @@ public function getBaseUrl()
5858
return $this->getConfig(static::PATH_PRODUCTION_URL);
5959
}
6060

61-
public function getPaymentAction(){
61+
/**
62+
* @return string
63+
*/
64+
public function getCustomerStreetAttribute()
65+
{
66+
return $this->getConfig(static::PATH_CUSTOMER_STREET);
67+
}
68+
69+
/**
70+
* @return string
71+
*/
72+
public function getCustomerAddressNumber()
73+
{
74+
return $this->getConfig(static::PATH_CUSTOMER_NUMBER);
75+
}
76+
77+
/**
78+
* @return string
79+
*/
80+
public function getCustomerAddressComplement()
81+
{
82+
return $this->getConfig(static::PATH_CUSTOMER_COMPLEMENT);
83+
}
6284

85+
/**
86+
* @return string
87+
*/
88+
public function getCustomerAddressDistrict()
89+
{
90+
return $this->getConfig(static::PATH_CUSTOMER_DISTRICT);
6391
}
6492
}

Gateway/Transaction/Base/Config/ConfigInterface.php

100644100755
+29-5
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,15 @@
1414

1515
interface ConfigInterface
1616
{
17-
const PATH_PUBLIC_KEY_TEST = 'mundipagg_mundipagg/global/public_key_test';
18-
const PATH_SECRET_KEY_TEST = 'mundipagg_mundipagg/global/secret_key_test';
19-
const PATH_PUBLIC_KEY = 'mundipagg_mundipagg/global/public_key';
20-
const PATH_SECRET_KEY = 'mundipagg_mundipagg/global/secret_key';
21-
const PATH_TEST_MODE = 'mundipagg_mundipagg/global/test_mode';
17+
const PATH_PUBLIC_KEY_TEST = 'mundipagg_mundipagg/global/public_key_test';
18+
const PATH_SECRET_KEY_TEST = 'mundipagg_mundipagg/global/secret_key_test';
19+
const PATH_PUBLIC_KEY = 'mundipagg_mundipagg/global/public_key';
20+
const PATH_SECRET_KEY = 'mundipagg_mundipagg/global/secret_key';
21+
const PATH_TEST_MODE = 'mundipagg_mundipagg/global/test_mode';
22+
const PATH_CUSTOMER_STREET = 'payment/mundipagg_customer_address/street_attribute';
23+
const PATH_CUSTOMER_NUMBER = 'payment/mundipagg_customer_address/number_attribute';
24+
const PATH_CUSTOMER_COMPLEMENT = 'payment/mundipagg_customer_address/complement_attribute';
25+
const PATH_CUSTOMER_DISTRICT = 'payment/mundipagg_customer_address/district_attribute';
2226

2327
/**
2428
* @return string
@@ -39,4 +43,24 @@ public function getTestMode();
3943
* @return string
4044
*/
4145
public function getBaseUrl();
46+
47+
/**
48+
* @return string
49+
*/
50+
public function getCustomerStreetAttribute();
51+
52+
/**
53+
* @return string
54+
*/
55+
public function getCustomerAddressNumber();
56+
57+
/**
58+
* @return string
59+
*/
60+
public function getCustomerAddressComplement();
61+
62+
/**
63+
* @return string
64+
*/
65+
public function getCustomerAddressDistrict();
4266
}

Gateway/Transaction/Billet/Command/AuthorizeCommand.php

100644100755
File mode changed.

Gateway/Transaction/Billet/Config/Config.php

100644100755
+32
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,36 @@ public function getExpirationDays()
4747
{
4848
return $this->getConfig(static::PATH_EXPIRATION_DAYS);
4949
}
50+
51+
/**
52+
* @return string
53+
*/
54+
public function getCustomerStreetAttribute()
55+
{
56+
return $this->getConfig(static::PATH_CUSTOMER_STREET);
57+
}
58+
59+
/**
60+
* @return string
61+
*/
62+
public function getCustomerAddressNumber()
63+
{
64+
return $this->getConfig(static::PATH_CUSTOMER_NUMBER);
65+
}
66+
67+
/**
68+
* @return string
69+
*/
70+
public function getCustomerAddressComplement()
71+
{
72+
return $this->getConfig(static::PATH_CUSTOMER_COMPLEMENT);
73+
}
74+
75+
/**
76+
* @return string
77+
*/
78+
public function getCustomerAddressDistrict()
79+
{
80+
return $this->getConfig(static::PATH_CUSTOMER_DISTRICT);
81+
}
5082
}

Gateway/Transaction/Billet/Config/ConfigInterface.php

100644100755
+24
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ interface ConfigInterface
1818
const PATH_TEXT = 'payment/mundipagg_billet/text';
1919
const PATH_TYPE_BANK = 'payment/mundipagg_billet/types';
2020
const PATH_EXPIRATION_DAYS = 'payment/mundipagg_billet/expiration_days';
21+
const PATH_CUSTOMER_STREET = 'payment/mundipagg_customer_address/street_attribute';
22+
const PATH_CUSTOMER_NUMBER = 'payment/mundipagg_customer_address/number_attribute';
23+
const PATH_CUSTOMER_COMPLEMENT = 'payment/mundipagg_customer_address/complement_attribute';
24+
const PATH_CUSTOMER_DISTRICT = 'payment/mundipagg_customer_address/district_attribute';
2125

2226
/**
2327
* @return string
@@ -38,4 +42,24 @@ public function getTypeBank();
3842
* @return string
3943
*/
4044
public function getExpirationDays();
45+
46+
/**
47+
* @return string
48+
*/
49+
public function getCustomerStreetAttribute();
50+
51+
/**
52+
* @return string
53+
*/
54+
public function getCustomerAddressNumber();
55+
56+
/**
57+
* @return string
58+
*/
59+
public function getCustomerAddressComplement();
60+
61+
/**
62+
* @return string
63+
*/
64+
public function getCustomerAddressDistrict();
4165
}

Gateway/Transaction/Billet/ResourceGateway/Create/RequestBuilder.php

+15-13
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class RequestBuilder implements BuilderInterface
3131

3232
const MODULE_NAME = 'MundiPagg_MundiPagg';
3333
const NAME_METADATA = 'Magento 2';
34-
34+
const SHIPPING = 1;
35+
const BILLING = 0;
36+
3537
protected $request;
3638
/** @var BoletoTransaction */
3739
protected $transaction;
@@ -180,14 +182,14 @@ protected function createNewRequest($requestDataProvider)
180182
'document' => $document,
181183
'type' => 'individual',
182184
'address' => [
183-
'street' => $quote->getShippingAddress()->getStreetLine(1),
184-
'number' => $quote->getShippingAddress()->getStreetLine(2),
185-
'complement' => $quote->getShippingAddress()->getStreetLine(3),
186-
'zip_code' => trim(str_replace('-','',$quote->getShippingAddress()->getPostCode())),
187-
'neighborhood' => $quote->getShippingAddress()->getStreetLine(4),
188-
'city' => $quote->getShippingAddress()->getCity(),
189-
'state' => $quote->getShippingAddress()->getRegionCode(),
190-
'country' => $quote->getShippingAddress()->getCountryId()
185+
'street' => $requestDataProvider->getCustomerAddressStreet(self::BILLING),
186+
'number' => $requestDataProvider->getCustomerAddressNumber(self::BILLING),
187+
'complement' => $requestDataProvider->getCustomerAddressComplement(self::BILLING),
188+
'zip_code' => trim(str_replace('-','',$quote->getBillingAddress()->getPostCode())),
189+
'neighborhood' => $requestDataProvider->getCustomerAddressDistrict(self::BILLING),
190+
'city' => $quote->getBillingAddress()->getCity(),
191+
'state' => $quote->getBillingAddress()->getRegionCode(),
192+
'country' => $quote->getBillingAddress()->getCountryId()
191193
]
192194
];
193195

@@ -197,11 +199,11 @@ protected function createNewRequest($requestDataProvider)
197199
'amount' => $quote->getShippingAddress()->getShippingAmount() * 100,
198200
'description' => '.',
199201
'address' => [
200-
'street' => $quote->getShippingAddress()->getStreetLine(1),
201-
'number' => $quote->getShippingAddress()->getStreetLine(2),
202-
'complement' => $quote->getShippingAddress()->getStreetLine(3),
202+
'street' => $requestDataProvider->getCustomerAddressStreet(self::SHIPPING),
203+
'number' => $requestDataProvider->getCustomerAddressNumber(self::SHIPPING),
204+
'complement' => $requestDataProvider->getCustomerAddressComplement(self::SHIPPING),
203205
'zip_code' => trim(str_replace('-','',$quote->getShippingAddress()->getPostCode())),
204-
'neighborhood' => $quote->getShippingAddress()->getStreetLine(4),
206+
'neighborhood' => $requestDataProvider->getCustomerAddressDistrict(self::SHIPPING),
205207
'city' => $quote->getShippingAddress()->getCity(),
206208
'state' => $quote->getShippingAddress()->getRegionCode(),
207209
'country' => $quote->getShippingAddress()->getCountryId()

Gateway/Transaction/Billet/ResourceGateway/Create/RequestDataProvider.php

+48
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,52 @@ protected function setConfig(ConfigInterface $config)
7979
$this->config = $config;
8080
return $this;
8181
}
82+
83+
/**
84+
* @return string
85+
*/
86+
public function getCustomerAddressStreet($shipping)
87+
{
88+
if ($shipping) {
89+
return $this->getShippingAddressAttribute($this->getConfig()->getCustomerStreetAttribute());
90+
}
91+
92+
return $this->getBillingAddressAttribute($this->getConfig()->getCustomerStreetAttribute());
93+
}
94+
95+
/**
96+
* @return string
97+
*/
98+
public function getCustomerAddressNumber($shipping)
99+
{
100+
if ($shipping) {
101+
return $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressNumber());
102+
}
103+
104+
return $this->getBillingAddressAttribute($this->getConfig()->getCustomerAddressNumber());
105+
}
106+
107+
/**
108+
* @return string
109+
*/
110+
public function getCustomerAddressComplement($shipping)
111+
{
112+
if ($shipping) {
113+
return $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressComplement());
114+
}
115+
116+
return $this->getBillingAddressAttribute($this->getConfig()->getCustomerAddressComplement());
117+
}
118+
119+
/**
120+
* @return string
121+
*/
122+
public function getCustomerAddressDistrict($shipping)
123+
{
124+
if ($shipping) {
125+
return $this->getShippingAddressAttribute($this->getConfig()->getCustomerAddressDistrict());
126+
}
127+
128+
return $this->getBillingAddressAttribute($this->getConfig()->getCustomerAddressDistrict());
129+
}
82130
}

Gateway/Transaction/BilletCreditCard/Config/Config.php

+33
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,37 @@ public function getAntifraudMinAmount()
5555
{
5656
return $this->getConfig(static::PATH_ANTIFRAUD_MIN_AMOUNT);
5757
}
58+
59+
60+
/**
61+
* @return string
62+
*/
63+
public function getCustomerStreetAttribute()
64+
{
65+
return $this->getConfig(static::PATH_CUSTOMER_STREET);
66+
}
67+
68+
/**
69+
* @return string
70+
*/
71+
public function getCustomerAddressNumber()
72+
{
73+
return $this->getConfig(static::PATH_CUSTOMER_NUMBER);
74+
}
75+
76+
/**
77+
* @return string
78+
*/
79+
public function getCustomerAddressComplement()
80+
{
81+
return $this->getConfig(static::PATH_CUSTOMER_COMPLEMENT);
82+
}
83+
84+
/**
85+
* @return string
86+
*/
87+
public function getCustomerAddressDistrict()
88+
{
89+
return $this->getConfig(static::PATH_CUSTOMER_DISTRICT);
90+
}
5891
}

0 commit comments

Comments
 (0)