Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
remove credit card
Browse files Browse the repository at this point in the history
  • Loading branch information
fcarrero committed Dec 28, 2023
1 parent db0f9d4 commit 504ecc2
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 113 deletions.
66 changes: 2 additions & 64 deletions Block/EmbedForm/EmbedFormInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Magento\Payment\Block\Info;
use Magento\Payment\Model\Config;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Phrase;

class EmbedFormInfo extends Info
{
Expand Down Expand Up @@ -34,21 +33,6 @@ public function __construct(
$this->_paymentConfig = $paymentConfig;
}

/**
* Get CC type name
*
* @return Phrase|mixed
* @throws LocalizedException
*/
public function getCcTypeName()
{
$types = $this->_paymentConfig->getCcTypes();
$ccType = $this->getInfo()->getCcType();
if (isset($types[$ccType])) {
return $types[$ccType];
}
return empty($ccType) ? __('N/A') : $ccType;
}

/**
* Get additional Data
Expand Down Expand Up @@ -99,32 +83,13 @@ public function getPaymentMethodTitle(): string
$methodType = $this->getPaymentMethodType();
$title = '';

switch ($methodType) {
case ConfigProvider::PAYMENT_METHOD_CREDIT_CARD:
$title = 'Pago con Tarjeta';
break;

case ConfigProvider::PAYMENT_METHOD_CASH:
$title = 'Pago en Efectivo';
break;
case ConfigProvider::PAYMENT_METHOD_BANK_TRANSFER:
$title = 'Transferencia Bancaria';
break;
if ($methodType == ConfigProvider::PAYMENT_METHOD_CASH) {
$title = 'Pago en Efectivo';
}

return $title;
}

/**
* Is credit card payment method
*
* @return bool
* @throws LocalizedException
*/
public function isCreditCardPaymentMethod(): bool
{
return $this->getPaymentMethodType() === ConfigProvider::PAYMENT_METHOD_CREDIT_CARD;
}

/**
* Is cash payment method
Expand All @@ -137,31 +102,4 @@ public function isCashPaymentMethod(): bool
return $this->getPaymentMethodType() === ConfigProvider::PAYMENT_METHOD_CASH;
}

/**
* Is BankTransfer payment method
*
* @return bool
* @throws LocalizedException
*/
public function isBankTransferPaymentMethod(): bool
{
return $this->getPaymentMethodType() === ConfigProvider::PAYMENT_METHOD_BANK_TRANSFER;
}

/**
* Show if card is debit o credit card
*
* @return string
* @throws LocalizedException
*/
public function getCardType(): ?string
{
$additionalData = $this->getAdditionalData();

if (isset($additionalData['card_type'])) {
return $additionalData['card_type'];
}

return null;
}
}
2 changes: 0 additions & 2 deletions etc/frontend/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
<arguments>
<argument name="configProviders" xsi:type="array">
<item name="femsa_global_provider" xsi:type="object">Femsa\Payments\Model\Ui\ConfigProvider</item>
<!-- Credit Card -->
<item name="femsa_cc_provider" xsi:type="object">Femsa\Payments\Model\Ui\CreditCard\ConfigProvider</item>
<!-- Embed Form -->
<item name="femsa_ef_provider" xsi:type="object">Femsa\Payments\Model\Ui\EmbedForm\ConfigProvider</item>
</argument>
Expand Down
36 changes: 2 additions & 34 deletions view/base/templates/info/embedform.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,7 @@ $offlineInfo = $block->getOfflineInfo();
</td>
</tr>

<?php if ($block->isCreditCardPaymentMethod()) {?>
<tr>
<th><strong><?= /* @noEscape */ __('Card Brand:'); ?></strong></th>
<td>
<?= $block->escapeHtml($block->getCcTypeName()); ?>
</td>
</tr>
<tr>
<th><strong><?= /* @noEscape */ __('Card Type:'); ?></strong></th>
<td>
<?= $block->escapeHtml($block->getCardType()); ?>
</td>
</tr>
<?php } elseif ($block->isCashPaymentMethod()) { ?>
<?php if ($block->isCashPaymentMethod()) { ?>
<tr>
<th><strong><?= /* @noEscape */ __('Reference Number:'); ?></strong></th>
<td>
Expand All @@ -41,26 +28,7 @@ $offlineInfo = $block->getOfflineInfo();
</td>
</tr>

<?php } elseif ($block->isBankTransferPaymentMethod()) { ?>
<tr>
<th><strong><?= /* @noEscape */ __('CLABE:'); ?></strong></th>
<td>
<?= $block->escapeHtml($offlineInfo["clabe"]); ?>
</td>
</tr>
<tr>
<th><strong><?= /* @noEscape */ __('Bank Name:'); ?></strong></th>
<td>
<?= $block->escapeHtml($offlineInfo["bank_name"]); ?>
</td>
</tr>
<tr>
<th><strong><?= /* @noEscape */ __('Expires at:'); ?></strong></th>
<td>
<?= $block->escapeHtml(date("Y-m-d", (integer) $offlineInfo["expires_at"])) ?>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
</dd>
Expand Down
13 changes: 0 additions & 13 deletions view/frontend/web/js/view/payment/method-renderer/embedform.js
Original file line number Diff line number Diff line change
Expand Up @@ -308,20 +308,15 @@ define(
},

getData: function () {
var number = this.creditCardNumber().replace(/\D/g, '');
if (this.iframOrderData() !== '') {
var params = this.iframOrderData();
var data = {
'method': this.getCode(),
'additional_data': {
'payment_method': params.charge.payment_method.type,
'cc_type': params.charge.payment_method.brand,
'cc_last_4': params.charge.payment_method.last4,
'reference': params.reference,
'order_id': params.charge.order_id,
'txn_id': params.charge.id,
'card_type': params.charge.payment_method.card_type,
'card_token': $("#" + this.getCode() + "_card_token").val(),
'iframe_payment': true
}
};
Expand All @@ -331,20 +326,12 @@ define(
'method': this.getCode(),
'additional_data': {
'payment_method': '',
'cc_type': this.creditCardType(),
'cc_last_4': number.substring(number.length - 4, number.length),
'card_token': $("#" + this.getCode() + "_card_token").val(),
'reference': '',
'iframe_payment': false,
'order_id': '',
'txn_id': ''
}
};

if (this.activeMonthlyInstallments()) {
data['additional_data']['monthly_installments'] = $("#" + this.getCode() + "_monthly_installments").children("option:selected").val();
}

return data;
},

Expand Down

0 comments on commit 504ecc2

Please sign in to comment.