Created
February 24, 2016 12:10
-
-
Save razbakov/8372d7e8ae920e8ef098 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
<?php | |
/** | |
* | |
* | |
* @category Kirchbergerknorr | |
* @package Kirchbergerknorr_OrderProcessor | |
* @author Aleksey Razbakov <[email protected]> | |
* @copyright Copyright (c) 2016 kirchbergerknorr GmbH (http://www.kirchbergerknorr.de) | |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) | |
*/ | |
class Kirchbergerknorr_OrderProcessor_Model_AdyenPayment_Adyen_Data_PaymentRequest | |
extends Adyen_Payment_Model_Adyen_Data_PaymentRequest | |
{ | |
public function reauthorize( | |
Varien_Object $payment, | |
$amount, | |
$merchantAccount = null, | |
$recurringDetailReference = null | |
) { | |
$order = $payment->getOrder(); | |
$incrementId = $order->getIncrementId(); | |
$orderCurrencyCode = $order->getOrderCurrencyCode(); | |
// override amount because this amount uses the right currency | |
$amount = $order->getGrandTotal(); | |
$this->selectedRecurringDetailReference = $recurringDetailReference; | |
$this->shopperInteraction = "ContAuth"; | |
$this->recurring = new Adyen_Payment_Model_Adyen_Data_Recurring(); | |
$this->recurring->contract = "RECURRING"; | |
//shopper data | |
$customerEmail = $order->getCustomerEmail(); | |
$this->shopperEmail = $customerEmail; | |
$customerId = $order->getCustomerId(); | |
if ($customerId) { | |
$customer = Mage::getModel('customer/customer')->load($order->getCustomerId()); | |
$customerId = $customer->getData('adyen_customer_ref') | |
?: $customer->getData('increment_id') | |
?: $customerId; | |
} | |
$realOrderId = $order->getRealOrderId(); | |
$this->shopperReference = (!empty($customerId)) ? $customerId : self::GUEST_ID . $realOrderId; | |
$this->amount->currency = $orderCurrencyCode; | |
$this->amount->value = Mage::helper('adyen')->formatAmount($amount, $orderCurrencyCode); | |
$this->reference = $incrementId; | |
$this->merchantAccount = $merchantAccount; | |
return $this; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment