-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from compropago/jose
Fix composer require and descriptions
- Loading branch information
Showing
17 changed files
with
176 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ | |
* @author José Castañeda <[email protected]> | ||
* @category Compropago | ||
* @package Compropago\Magento2 | ||
* @copyright qbo (http://www.qbo.tech) | ||
* @copyright qbo (http://www.qbo.tech) | ||
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | ||
* | ||
* © 2017 QBO DIGITAL SOLUTIONS. | ||
|
@@ -66,16 +66,12 @@ protected function _prepareSpecificInformation($transport = null) | |
|
||
if ( | ||
$this->_appState->getAreaCode() === FrontNameResolver::AREA_CODE | ||
&& $info->getAdditionalInformation() ) | ||
{ | ||
foreach ($info->getAdditionalInformation() as $field => $value) | ||
{ | ||
&& $info->getAdditionalInformation() ) { | ||
foreach ($info->getAdditionalInformation() as $field => $value) { | ||
$beautifiedFieldName = str_replace("_", " ", ucwords(trim(preg_replace('/(?<=\\w)(?=[A-Z])/', " $1", $field)))); | ||
if($field == "ID") | ||
{ | ||
if($field == "ID") { | ||
$data["ID"] = $value; | ||
} | ||
else if (!in_array($field, $this->_disallowedFiledNames)) | ||
} else if (!in_array($field, $this->_disallowedFiledNames)) | ||
{ | ||
$data[__($beautifiedFieldName)->getText()] = $value; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -120,7 +120,7 @@ class Cash extends AbstractMethod | |
/** | ||
* @var array | ||
*/ | ||
public $_supportedCurrencyCodes = ['USD','MXN','GBP','EUR']; | ||
public $_supportedCurrencyCodes = ['EUR', 'GBP', 'MXN', 'USD']; | ||
|
||
/** | ||
* Payment constructor. | ||
|
@@ -180,20 +180,15 @@ public function assignData(DataObject $data) | |
{ | ||
parent::assignData($data); | ||
|
||
if ($data->getData(self::PROVIDER_KEY_NAME)) | ||
{ | ||
if ($data->getData(self::PROVIDER_KEY_NAME)) { | ||
$this->getInfoInstance()->setAdditionalInformation( | ||
self::PROVIDER_KEY_NAME, | ||
$data->getData(self::PROVIDER_KEY_NAME) | ||
); | ||
} | ||
else | ||
{ | ||
} else { | ||
$additionalData = $data->getData(PaymentInterface::KEY_ADDITIONAL_DATA); | ||
foreach ($additionalData as $key => $value) | ||
{ | ||
if(!is_object($value)) | ||
{ | ||
foreach ($additionalData as $key => $value) { | ||
if(!is_object($value)) { | ||
$this->getInfoInstance()->setAdditionalInformation($key, $value); | ||
} | ||
} | ||
|
@@ -226,23 +221,19 @@ public function authorize(InfoInterface $payment, $amount) | |
{ | ||
$this->_initialize(); | ||
|
||
try | ||
{ | ||
try { | ||
$result = $this->_executePayment( | ||
$this->_getRequestInfo( $payment->getOrder() ) | ||
); | ||
|
||
if (isset($result['success'])) | ||
{ | ||
if (isset($result['success'])) { | ||
$this->_addTransactionInfo( | ||
$payment, | ||
$result | ||
); | ||
} | ||
|
||
} | ||
catch(\Exception $e) | ||
{ | ||
} catch(\Exception $e) { | ||
$this->_processErrors($e); | ||
} | ||
|
||
|
@@ -260,24 +251,17 @@ protected function _executePayment($_orderInfo) | |
{ | ||
$result = []; | ||
|
||
try | ||
{ | ||
try { | ||
$response = $this->_apiClient->createOrder($_orderInfo); | ||
if (isset($response['id'])) | ||
{ | ||
if (isset($response['id'])) { | ||
$result = [ | ||
'success' => true, | ||
'response' => $response | ||
'success' => true, | ||
'response' => $response | ||
]; | ||
} else { | ||
throw new \Magento\Framework\Validator\Exception(__('Old API version, Send mail to [email protected]')); | ||
} | ||
else | ||
{ | ||
# Error old API version | ||
|
||
} | ||
} | ||
catch(\Exception $e) | ||
{ | ||
} catch(\Exception $e) { | ||
$this->_processErrors($e); | ||
} | ||
|
||
|
@@ -385,9 +369,9 @@ protected function _processErrors($e) | |
if($e->getCode() === self::ERROR_CODE_STORE_NOT_FOUND) | ||
{ | ||
throw new \Magento\Framework\Exception\LocalizedException(__($message)); | ||
} | ||
|
||
throw new \Magento\Framework\Validator\Exception(__('Payment capturing error.')); | ||
} | ||
throw new \Magento\Framework\Validator\Exception(__($message)); | ||
} | ||
|
||
/** | ||
|
@@ -406,8 +390,7 @@ public function getCode() | |
*/ | ||
public function canUseForCurrency($currencyCode) | ||
{ | ||
if (!in_array($currencyCode, $this->_supportedCurrencyCodes)) | ||
{ | ||
if (!in_array($currencyCode, $this->_supportedCurrencyCodes)) { | ||
return false; | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.