This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(PPWP-377): unified calls * fix(PPWP-377): unified calls * fix(PPWP-377): unified calls * fix(PPWP-377): unified calls * fix(PPWP-377): unified calls * added payment places method * comments removed * refactored access token validation * fixed ternary if structure * fixed instantiation of access token * 🐛 Fix the PR cover checker when there is no test (#189) This fixes an issue that is workflow failure when the pull request does not contain tests and Added hotfix branch filter to check tests * feat(PPWP-421): paycash front-end * feat(PPWP-422): paycash admin * fix(helper): 🐛 fixed float to int convertion * feat(bin): ✨ new command sync with container * improv: init tests * improv: changing chmod command * build: 📦 new patch version of mercardo pago for magento 2 v3.12.3 * getMercadoPagoPaymentMethods testing * fix(ppwp-337): fixing exception testing * testing config provider and api * testing PaymentMethodsTicket * feat(ppwp-377): testing custom config provider * refactored constants * refactored model test classes * refactored helper test classes * added annotation for Code Coverage Ignore * fixed test variables * fixed html structure of ticket * feat(ppwp-377): adding metadata payment_option_id * fixing data tests * removed exception to access token * hotfix(PLUG-1533): fixing refund error handling * fixing pr coverage checker * testing pr coverage checker * fixing pr coverage checker * hotfix: fixed js - undefined variable * feat(PPWP-569): initial commit * build: 📦 new minor version of mercardo pago for magento 2 v3.13.0 * build(v3.13.0): 📦 updated readme * expiration date mask and validations * PPWP-569: inserted translations for titles * PPWP-569: added space between fields * improv(PPWP-611): dinamically validating bank transfer on admin page * implementing cache * PPWP-611: payment unit tests * PPWP-611: fixed abstractElementMock * fix(wallet button): 🐛 create order even with cho pro disabled * fixing cache * separating cache values with constants * PPWP-611: refactored test directory * PPWP-570: added translation * PPWP-569: inserted style in title * PPWP-569: fixed cache for new installs * PPWP-569: fixed cache for new installs * feature(ppwp-630): new front-end definitions * removing cache from bank_transfer validation * fixing payment fieldset and removing debit text * Update ConfigObserver.php (#183) Changing protocol for banners to use https * Fix refund: cuando el response de la API de MP es un {status:400,response:{error:bad_request,status:400}}, no se tiene que generar el creditmemo (#180) Co-authored-by: Fernando Lira <[email protected]> * improv(ppwp-531): adding mlu to available lists * adding payment methods validation using API * removing old validation * improving cache and applying rules to other checkouts * fixing pix rules * disabling invalid payments * clearing config activation flag caching * testing new methods * fixing cache code coverage * fixing observer code coverage * fixing exception syntax * code enhancement * fixing prefix issue * fix(ticket): 🐛 changed str_contains to strpos * build(v3.14.0): 📦 updated version files and changelog * build(v3.14.0): 📦 updated changelog * fix: treating paymentId on disablePayment function * Upgrade New Logo MP Magento 2 * hotfix: prevent "missing required argument $data" exception (#187) Co-authored-by: Ivan Augusto <[email protected]> * build(v3.14.1): 📦 new version v3.14.1 * build(v3.14.1): 📦 updated mercado pago's minilogo image * build(v3.14.2): 📦 Create a new version * build(v3.14.2): 📦 Migrate to db_schema * build(v3.14.2): 📦 link img desktop logo mercado pago * build(v3.14.2): 📦 add release to skipped branch * build(v3.14.2): 📦 add parameters :P * hotfix(PLUG-1713): treating invalid credentials * changing test files * set observers as no has converage * Adjusted logos from checkouts (#219) * build(v3.14.1): 📦 new version v3.14.1 * build(v3.14.1): 📦 updated mercado pago's minilogo image * build(v3.14.2): 📦 Create a new version * build(v3.14.2): 📦 Migrate to db_schema * build(v3.14.2): 📦 link img desktop logo mercado pago * build(v3.14.2): 📦 add release to skipped branch * build(v3.14.2): 📦 add parameters :P * feat: update logos from cho pro * feat: update logos from cho ticket * feat: update logos from cho custom * feat: fix credit card js * fix: fixed create payments with issuer Co-authored-by: Fernando Lira <[email protected]> Co-authored-by: Fernando Lira <[email protected]> * Fixed sending email for new order in pending status * Changed position of additional information method * Code centered in only one method * hotfix: link ticket options labels to they checkboxes (#190) Co-authored-by: Ivan Augusto <[email protected]> Co-authored-by: Fernando Lira <[email protected]> * Added cvv validation for cho custom (#222) * feat: added cvv validation for cho custom * feat: added cvv validation for cho custom * Fixed some accentuation in pt_BR translations * feat: cho ticket logo adjustments (#223) * Fixed some other accentuation in pt_BR translations and 'partually' in label * Fixed title text * Fixed text * Returning removed text pt-br (número) * build(v3.15.0): 📦 new version Co-authored-by: Gustavo Brito <[email protected]> Co-authored-by: sleaof <[email protected]> Co-authored-by: Douglas <[email protected]> Co-authored-by: Manuel Eduardo Cánepa Cihuelo <[email protected]> Co-authored-by: lc-mayoul <[email protected]> Co-authored-by: hugodamm <[email protected]> Co-authored-by: Code Slicer <[email protected]> Co-authored-by: Ivan Augusto <[email protected]> Co-authored-by: Hugo Damm <[email protected]> Co-authored-by: Giovanni Cavallari <[email protected]> Co-authored-by: katelucena-meli <[email protected]> Co-authored-by: AlberAlmeida <[email protected]>
- Loading branch information
1 parent
e79af20
commit 0b5d4e0
Showing
29 changed files
with
354 additions
and
133 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
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
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
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
101 changes: 101 additions & 0 deletions
101
src/MercadoPago/Core/Model/System/Config/Source/PaymentMethodsTicket.php
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 |
---|---|---|
@@ -0,0 +1,101 @@ | ||
<?php | ||
|
||
namespace MercadoPago\Core\Model\System\Config\Source; | ||
|
||
use Exception; | ||
use Magento\Backend\Block\Store\Switcher; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Option\ArrayInterface; | ||
use Magento\Store\Model\ScopeInterface; | ||
use MercadoPago\Core\Helper\ConfigData; | ||
use MercadoPago\Core\Helper\Data; | ||
use MercadoPago\Core\Lib\RestClient; | ||
|
||
/** | ||
* Class PaymentMethods | ||
* | ||
* @package MercadoPago\Core\Model\System\Config\Source | ||
*/ | ||
class PaymentMethodsTicket implements ArrayInterface | ||
{ | ||
|
||
/** | ||
* @var ScopeConfigInterface | ||
*/ | ||
protected $scopeConfig; | ||
|
||
/** | ||
* @var Data | ||
*/ | ||
protected $coreHelper; | ||
|
||
protected $_switcher; | ||
|
||
|
||
/** | ||
* PaymentMethodsTicket constructor. | ||
* | ||
* @param ScopeConfigInterface $scopeConfig | ||
* @param Data $coreHelper | ||
* @param Switcher $switcher | ||
*/ | ||
public function __construct( | ||
ScopeConfigInterface $scopeConfig, | ||
Data $coreHelper, | ||
Switcher $switcher | ||
) { | ||
$this->scopeConfig = $scopeConfig; | ||
$this->coreHelper = $coreHelper; | ||
$this->_switcher = $switcher; | ||
} //end __construct() | ||
|
||
|
||
/** | ||
* Return available payment methods | ||
* | ||
* @return array | ||
*/ | ||
public function toOptionArray() | ||
{ | ||
$methods = []; | ||
|
||
// default empty value | ||
$methods[] = [ | ||
'value' => '', | ||
'label' => __('Accept all payment methods'), | ||
]; | ||
$accessToken = $this->scopeConfig->getValue(ConfigData::PATH_ACCESS_TOKEN, ScopeInterface::SCOPE_WEBSITE, $this->_switcher->getWebsiteId()); | ||
|
||
if (empty($accessToken)) { | ||
return $methods; | ||
} | ||
|
||
$this->coreHelper->log('GET /v1/payment_methods', 'mercadopago'); | ||
|
||
try { | ||
$response = RestClient::get('/v1/payment_methods', null, ['Authorization: Bearer ' . $accessToken]); | ||
} catch (Exception $e) { | ||
$this->coreHelper->log('PaymentMethodsTicket:: An error occurred at the time of obtaining the ticket payment methods: ' . $e); | ||
return []; | ||
} | ||
|
||
if (isset($response['error']) || (isset($response['status']) && ($response['status'] != '200' && $response['status'] != '201'))) { | ||
return $methods; | ||
} | ||
|
||
$response = $response['response']; | ||
|
||
foreach ($response as $pm) { | ||
if ((isset($pm['payment_type_id']) && $pm['payment_type_id'] == 'ticket') || $pm['payment_type_id'] == 'atm') { | ||
$methods[] = [ | ||
'value' => $pm['id'], | ||
'label' => __($pm['name']), | ||
]; | ||
} | ||
} | ||
|
||
$this->coreHelper->log('PaymentMethodsTicket:: Displayed', 'mercadopago', $methods); | ||
|
||
return $methods; | ||
} //end toOptionArray() | ||
}//end class |
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
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
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
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.