Skip to content

Commit

Permalink
1.5.6
Browse files Browse the repository at this point in the history
  • Loading branch information
dyd committed Jul 29, 2020
1 parent ff27c56 commit cebbbb1
Show file tree
Hide file tree
Showing 13 changed files with 552 additions and 400 deletions.
109 changes: 52 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Requirements
------------

* Magento Community Edition > 1.7 (Tested up to: __1.9.3.1__)
* [GenesisPHP v1.18.3](https://github.com/GenesisGateway/genesis_php/releases/tag/1.18.3) - (Integrated in Module)
* [GenesisPHP v1.18.4](https://github.com/GenesisGateway/genesis_php/releases/tag/1.18.4) - (Integrated in Module)
* PCI-certified server in order to use ```emerchantpay Direct```

*Note:* This module has been tested only with Magento __Community Edition__, it may not work
Expand Down Expand Up @@ -76,76 +76,71 @@ Supported Transactions
* __Sale (3D-Secure)__

* ```emerchantpay Checkout``` Payment Method
* __Alternative Payment Methods__
* __P24__
* __POLi__
* __PPRO__
* __eps__
* __GiroPay__
* __Mr.Cash__
* __MyBank__
* __Przelewy24__
* __Qiwi__
* __SafetyPay__
* __TrustPay__
* __SOFORT__
* __Trustly Sale__
* __PayPal Express__
* __Credit Cards__
* __Argencard__
* __Aura__
* __Authorize__
* __Authorize (3D-Secure)__
* __Cabal__
* __Cencosud__
* __Elo__
* __Naranja__
* __Nativa__
* __Sale__
* __Sale (3D-Secure)__
* __Tarjeta Shopping__
* __Recurring__
* __InitRecurringSale__
* __InitRecurringSale (3D-Secure)__
* __RecurringSale__
* __Cash Payments__
* __Baloto__
* __Banamex__
* __Bancomer__
* __Bancontact__
* __Banco de Occidente__
* __Boleto__
* __Efecty__
* __OXXO__
* __Pago Facil__
* __Redpagos__
* __Santander Cash__
* __Crypto__
* __BitPay__
* __Sepa Direct Debit__
* __SDD Sale__
* __Online Banking Payments__
* __Alipay__
* __Banco do Brasil__
* __Bancomer__
* __BitPay__
* __Boleto__
* __Bradesco__
* __Entercash__
* __iDebit Payin__
* __INPay__
* __InstaDebit Payin__
* __Cabal__
* __CashU__
* __Cencosud__
* __Davivienda__
* __Efecty__
* __Elo__
* __eps__
* __eZeeWallet__
* __Fashioncheque__
* __GiroPay__
* __iDeal__
* __iDebit__
* __InstaDebit__
* __InstantTransfer__
* __InitRecurringSale__
* __InitRecurringSale (3D-Secure)__
* __Intersolve__
* __Itau__
* __Klarna__
* __Multibanco__
* __OnlineBanking__
* __MyBank__
* __Naranja__
* __Nativa__
* __Neosurf__
* __Neteller__
* __Online Banking__
* __OXXO__
* __P24__
* __Pago Facil__
* __PayPal Express__
* __PaySafeCard__
* __PayU__
* __POLi__
* __PPRO__
* __PSE__
* __Qiwi__
* __RapiPago__
* __Redpagos__
* __SafetyPay__
* __Sale__
* __Sale (3D-Secure)__
* __Santander__
* __WeChat__
* __Vouchers__
* __CashU__
* __PayByVoucher (Sale)__
* __PaySafeCard__
* __Electronic Wallets__
* __eZeeWallet__
* __Neteller__
* __Santander Cash__
* __Sepa Direct Debit__
* __SOFORT__
* __Tarjeta Shopping__
* __TCS__
* __Trustly__
* __TrustPay__
* __UPI__
* __WebMoney__
* __WebPay__
* __WeChat__
* __Zimpler__

_Note_: If you have trouble with your credentials or terminal configuration, get in touch with our [support] team
Expand Down
100 changes: 99 additions & 1 deletion app/code/community/EMerchantPay/Genesis/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
class EMerchantPay_Genesis_Helper_Data extends Mage_Core_Helper_Abstract
{
const SECURE_TRANSCTION_TYPE_SUFFIX = "3D";
const PPRO_TRANSACTION_SUFFIX = '_ppro';

const RAW_DETAILS_TRANSACTION_TYPE = 'transaction_type';
const RAW_DETAILS_TERMINAL_TOKEN = 'terminal_token';
Expand Down Expand Up @@ -328,6 +329,101 @@ public function getItemList($order)
return $description;
}

/**
* @param $order
* @return array
*/
public function getItemListArray($order)
{
$productResult = array();

foreach ($order->getAllItems() as $item) {
/** @var $item Mage_Sales_Model_Quote_Item */
$product = $item->getProduct();

$type = $item->getIsVirtual() ?
\Genesis\API\Request\Financial\Alternatives\Klarna\Item::ITEM_TYPE_DIGITAL :
\Genesis\API\Request\Financial\Alternatives\Klarna\Item::ITEM_TYPE_PHYSICAL;

if ($item->getPrice() <= 0) {
continue;
}

$productResult[] = array(
'sku' =>
$product->getSku(),
'name' =>
$product->getName(),
'qty' =>
$item->getData('qty_ordered'),
'price' =>
$item->getPrice(),
'type' =>
$type
);
}

return $productResult;
}

/**
* @param Mage_Sales_Model_Order $order
* @return \Genesis\API\Request\Financial\Alternatives\Klarna\Items
* @throws \Genesis\Exceptions\ErrorParameter
*/
public function getKlarnaCustomParamItems($order)
{
$items = new \Genesis\API\Request\Financial\Alternatives\Klarna\Items($order->getOrderCurrencyCode());
$itemsList = $this->getItemListArray($order);
foreach ($itemsList as $item) {
$klarnaItem = new \Genesis\API\Request\Financial\Alternatives\Klarna\Item(
$item['name'],
$item['type'],
$item['qty'],
$item['price']
);
$items->addItem($klarnaItem);
}

$taxes = floatval($order->getTaxAmount());
if ($taxes) {
$items->addItem(
new \Genesis\API\Request\Financial\Alternatives\Klarna\Item(
$this->__('Taxes'),
\Genesis\API\Request\Financial\Alternatives\Klarna\Item::ITEM_TYPE_SURCHARGE,
1,
$taxes
)
);
}

$discount = floatval($order->getDiscountAmount());
if ($discount) {
$items->addItem(
new \Genesis\API\Request\Financial\Alternatives\Klarna\Item(
$this->__('Discount'),
\Genesis\API\Request\Financial\Alternatives\Klarna\Item::ITEM_TYPE_DISCOUNT,
1,
-$discount
)
);
}

$shipping_cost = floatval($order->getShippingAmount());
if ($shipping_cost) {
$items->addItem(
new \Genesis\API\Request\Financial\Alternatives\Klarna\Item(
$this->__('Shipping Costs'),
\Genesis\API\Request\Financial\Alternatives\Klarna\Item::ITEM_TYPE_SHIPPING_FEE,
1,
$shipping_cost
)
);
}

return $items;
}

/**
* Get list of items in the order
*
Expand Down Expand Up @@ -915,6 +1011,7 @@ public static function getCurrentUserId()
if ($helper->isLoggedIn()) {
return $helper->getCurrentCustomer()->getId();
}

return 0;
}

Expand Down Expand Up @@ -950,7 +1047,8 @@ public function getIsRefundable(Varien_Object $payment)
* @param Varien_Object|Mage_Sales_Model_Order_Payment $payment
* @return Mage_Sales_Model_Order_Payment_Transaction|null
*/
public function getCaptureForRefund(Varien_Object $payment) {
public function getCaptureForRefund(Varien_Object $payment)
{
$capture = $payment->lookupTransaction(
null,
Mage_Sales_Model_Order_Payment_Transaction::TYPE_CAPTURE
Expand Down
Loading

0 comments on commit cebbbb1

Please sign in to comment.