/**
  * Retrieve a headInfo model, filled with the merchant crdentials and some transaction data
  * 
  * @param order $order
  * @param string $transactionId
  * @param string $transactionShortId 
  * @param int $orderId
  * @param string $subtype
  * @return HeadInfo
  */
 public static function getHeadInfoModel(order $order, $transactionId = null, $transactionShortId = null, $orderId = null, $subtype = null)
 {
     Session::setRpSessionEntry('orderId', $orderId);
     $payment = Loader::getRatepayPayment($order->info['payment_method']);
     $headInfo = new HeadInfo();
     $headInfo->setOrderId($orderId)->setProfileId($payment->profileId)->setSecurityCode($payment->securityCode)->setSubtype($subtype)->setTransactionId($transactionId)->setTransactionShortId($transactionShortId)->setShopSystem($payment->shopSystem)->setShopVersion($payment->shopVersion)->setModuleVersion($payment->version);
     return $headInfo;
 }
 /**
  * Call PAYMENT_CHANGE with the subtype credit
  * and add a credit item to the order
  */
 public static function creditAction()
 {
     $orderId = Globals::getPostEntry('order_number');
     $order = new order($orderId);
     $payment = Loader::getRatepayPayment($order->info['payment_method']);
     $transactionId = Db::getRatepayOrderDataEntry($orderId, 'transaction_id');
     $transactionShortId = Db::getRatepayOrderDataEntry($orderId, 'transaction_short_id');
     $data = array('HeadInfo' => RequestMapper::getHeadInfoModel($order, $transactionId, $transactionShortId, $orderId, 'credit'), 'BasketInfo' => RequestMapper::getBasketInfoModel($order, $orderId, Globals::getPost()), 'CustomerInfo' => RequestMapper::getCustomerInfoModel($order, $orderId), 'PaymentInfo' => RequestMapper::getPaymentInfoModel($order, $orderId));
     $requestService = new RequestService($payment->sandbox, $data);
     $result = $requestService->callPaymentChange();
     Db::xmlLog($order, $requestService->getRequest(), $orderId, $requestService->getResponse());
     if (!array_key_exists('error', $result)) {
         Session::setRpSessionEntry('message_css_class', 'messageStackSuccess');
         Session::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_SUCCESS);
         Db::setRpCreditItem(Globals::getPost());
         Db::setRpHistoryEntry($orderId, Data::getCreditItem(Globals::getPost()), 'PAYMENT_CHANGE', 'credit');
         Db::addCreditToShop($orderId, Globals::getPost());
         Db::updateShopOrderTotals($orderId);
     } else {
         Session::setRpSessionEntry('message_css_class', 'messageStackError');
         Session::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_ERROR);
     }
     tep_redirect(tep_href_link("ratepay_order.php", 'oID=' . $orderId, 'SSL'));
 }
 /**
  * Is called when the checkout_confirmation.php page is called
  */
 public function rateCalculatorCheck()
 {
     $checking = true;
     if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_total_amount'))) {
         $checking = false;
     } else {
         if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_amount'))) {
             $checking = false;
         } else {
             if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_interest_amount'))) {
                 $checking = false;
             } else {
                 if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_service_charge'))) {
                     $checking = false;
                 } else {
                     if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_annual_percentage_rate'))) {
                         $checking = false;
                     } else {
                         if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_monthly_debit_interest'))) {
                             $checking = false;
                         } else {
                             if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_number_of_rates'))) {
                                 $checking = false;
                             } else {
                                 if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_rate'))) {
                                     $checking = false;
                                 } else {
                                     if (Data::betterEmpty(Session::getRpSessionEntry('ratepay_rate_last_rate'))) {
                                         $checking = false;
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$checking) {
         Session::setRpSessionEntry('calculator_error', RATEPAY_RATE_RATE_CALCULATOR_ERROR);
         tep_redirect(tep_href_link("ratepay_rate_checkout_details.php", 'conditions=1', 'SSL'));
     }
 }
 /**
  * This method set all needed data and has to be rewritten
  * It is for internal Shop usage, like saving the variables in the DB or session etc.
  * @param string $total_amount
  * @param string $amount
  * @param string $interest_amount
  * @param string $service_charge
  * @param string $annual_percentage_rate
  * @param string $monthly_debit_interest
  * @param string $number_of_rates
  * @param string $rate
  * @param string $last_rate
  */
 public function setData($total_amount, $amount, $interest_rate, $interest_amount, $service_charge, $annual_percentage_rate, $monthly_debit_interest, $number_of_rates, $rate, $last_rate, $payment_firstday)
 {
     Session::setRpSessionEntry('ratepay_rate_total_amount', $total_amount);
     Session::setRpSessionEntry('ratepay_rate_amount', $amount);
     Session::setRpSessionEntry('ratepay_rate_interest_rate', $interest_rate);
     Session::setRpSessionEntry('ratepay_rate_interest_amount', $interest_amount);
     Session::setRpSessionEntry('ratepay_rate_service_charge', $service_charge);
     Session::setRpSessionEntry('ratepay_rate_annual_percentage_rate', $annual_percentage_rate);
     Session::setRpSessionEntry('ratepay_rate_monthly_debit_interest', $monthly_debit_interest);
     Session::setRpSessionEntry('ratepay_rate_number_of_rates', $number_of_rates);
     Session::setRpSessionEntry('ratepay_rate_rate', $rate);
     Session::setRpSessionEntry('ratepay_rate_last_rate', $last_rate);
     if (array_key_exists('pi_dd', $_SESSION)) {
         Session::setRpSessionEntry('ratepay_payment_firstday', $_SESSION['pi_dd']);
     } else {
         Session::setRpSessionEntry('ratepay_payment_firstday', $payment_firstday);
     }
 }
 private function _setBankDataSession($data)
 {
     Session::setRpSessionEntry('owner', $data['owner']);
     if (!Data::betterEmpty($data['iban'])) {
         Session::setRpSessionEntry('iban', $data['iban']);
         if (!Data::betterEmpty($data['bic-swift'])) {
             Session::setRpSessionEntry('bic-swift', $data['bic-swift']);
         }
     } else {
         Session::setRpSessionEntry('bank-account-number', $data['bank-account-number']);
         Session::setRpSessionEntry('bank-code', $data['bank-code']);
         Session::cleanRpSessionEntry('iban');
         Session::cleanRpSessionEntry('bic-swift');
     }
     Session::setRpSessionEntry('bank-name', $data['bank-name']);
 }
 /**
  * get the current customer country
  *
  * @return string $country
  */
 protected function _getCountry()
 {
     global $order;
     if (is_array($order->billing['country'])) {
         $country = $order->billing['country']['iso_code_2'];
     } elseif (Session::getRpSessionEntry('orderId')) {
         $country = Db::getRatepayOrderDataEntry(Session::getRpSessionEntry('orderId'), 'customers_country_code');
     } elseif (Session::getRpSessionEntry('country')) {
         $country = Session::getRpSessionEntry('country');
     } else {
         $country = "DE";
     }
     Session::setRpSessionEntry('country', $country);
     return strtoupper($country);
 }
Example #7
0
 /**
  * Disable RatePAY for a customer
  */
 public static function disableRatepay()
 {
     Session::setRpSessionEntry('disabled', true);
 }
                                                <td class="<?php 
    echo Session::getRpSessionEntry('message_css_class');
    ?>
">
                                                    <img border="0" title="" alt="" src="images/icons/error.gif">
                                                    <?php 
    echo Session::getRpSessionEntry('message');
    ?>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                            </table>
                            <?php 
    Session::setRpSessionEntry('message', null);
    ?>
                            <?php 
}
?>
                            <?php 
if ($order->info['payment_method'] == 'ratepay_rate') {
    ?>
                            <?php 
    $details = Db::getRatepayRateDetails($orderId);
    ?>
                            <table border="0" width="100%" cellspacing="0" cellpadding="2" height="40">
                                <tr>
                                    <td class="pageHeading"><?php 
    echo RATEPAY_ORDER_RATEPAY_ADMIN_RATE_DETAILS;
    ?>