/** * Save rate details to the db * * @param int$orderId */ protected function _saveRateDetails($orderId) { $data = array('order_number' => $orderId, 'total_amount' => Session::getRpSessionEntry('ratepay_rate_total_amount'), 'amount' => Session::getRpSessionEntry('ratepay_rate_amount'), 'interest_amount' => Session::getRpSessionEntry('ratepay_rate_interest_amount'), 'service_charge' => Session::getRpSessionEntry('ratepay_rate_service_charge'), 'annual_percentage_rate' => Session::getRpSessionEntry('ratepay_rate_annual_percentage_rate'), 'monthly_debit_interest' => Session::getRpSessionEntry('ratepay_rate_monthly_debit_interest'), 'number_of_rates' => Session::getRpSessionEntry('ratepay_rate_number_of_rates'), 'rate' => Session::getRpSessionEntry('ratepay_rate_rate'), 'last_rate' => Session::getRpSessionEntry('ratepay_rate_last_rate')); Db::setRatepayRateDetails($data); }
/** * This method get all needed data and has to be rewritten * Optional - Will only be used, if you want to show the result on another page (include_result.html) * Needs to return an array with the indexes total_amount, amount, interest_amount, service_charge, annual_percentage_rate, monthly_debit_interest, number_of_rates , rate, lastRate * @return array */ public function getData() { return array('total_amount' => Session::getRpSessionEntry('ratepay_rate_total_amount'), 'amount' => Session::getRpSessionEntry('ratepay_rate_amount'), 'interest_rate' => Session::getRpSessionEntry('ratepay_rate_interest_rate'), 'interest_amount' => Session::getRpSessionEntry('ratepay_rate_interest_amount'), 'service_charge' => Session::getRpSessionEntry('ratepay_rate_service_charge'), 'annual_percentage_rate' => Session::getRpSessionEntry('ratepay_rate_annual_percentage_rate'), 'monthly_debit_interest' => Session::getRpSessionEntry('ratepay_rate_monthly_debit_interest'), 'number_of_rates' => Session::getRpSessionEntry('ratepay_rate_number_of_rates'), 'rate' => Session::getRpSessionEntry('ratepay_rate_rate'), 'last_rate' => Session::getRpSessionEntry('ratepay_rate_last_rate'), 'payment_firstday' => Session::getRpSessionEntry('ratepay_payment_firstday')); }
/** * Insert ratepay order data * * @param order $order * @param int $orderId */ public static function setRatepayOrderData(order $order, $orderId) { $payment = $order->info['payment_method']; $sql = "INSERT INTO " . $payment . "_orders (" . "order_number, " . "transaction_id, " . "transaction_short_id, " . "descriptor," . "customers_birth," . "firstname," . "lastname," . "ip_address," . "billing_country_code," . "shipping_country_code," . "fax," . "customers_country_code," . "gender" . ") VALUES ('" . tep_db_input($orderId) . "', '" . tep_db_input(Session::getRpSessionEntry('transactionId')) . "', '" . tep_db_input(Session::getRpSessionEntry('transactionShortId')) . "', '" . tep_db_input(Session::getRpSessionEntry('descriptor')) . "', '" . tep_db_input(Db::getCustomersDob(null, Session::getSessionEntry('customer_id'))) . "', '" . tep_db_input($order->customer['firstname']) . "', '" . tep_db_input($order->customer['lastname']) . "', '" . tep_db_input(Data::getCustomerIp()) . "', '" . tep_db_input($order->billing['country']['iso_code_2']) . "', '" . tep_db_input($order->delivery['country']['iso_code_2']) . "', '" . tep_db_input(Db::getCustomersFax(null, Session::getSessionEntry('customer_id'))) . "','" . tep_db_input(Session::getRpSessionEntry('customers_country_code')) . "','" . tep_db_input(Db::getXtCustomerEntry(Session::getSessionEntry('customer_id'), 'customers_gender')) . "')"; tep_db_query($sql); self::setRpOrderItems($order, $orderId, $payment); }
/** * Retrieve paymentInfo model * * @param order $order * @param int $orderId * @return PaymentInfo */ public static function getPaymentInfoModel(order $order, $orderId = null) { $paymentInfo = new PaymentInfo(); $paymentInfo->setAmount(Data::getPaymentAmount($order, $orderId))->setCurrency($order->info['currency'])->setMethod(Data::getRpPaymentMethod($order->info['payment_method'])); if ($order->info['payment_method'] == 'ratepay_rate') { if (is_null($orderId)) { $paymentInfo->setDebitType('BANK-TRANSFER')->setInstallmentAmount(Session::getRpSessionEntry('ratepay_rate_rate'))->setInstallmentNumber(Session::getRpSessionEntry('ratepay_rate_number_of_rates'))->setInterestRate(Session::getRpSessionEntry('ratepay_rate_interest_rate'))->setLastInstallmentAmount(Session::getRpSessionEntry('ratepay_rate_last_rate'))->setPaymentFirstDay(Session::getRpSessionEntry('ratepay_payment_firstday')); } else { $details = Db::getRatepayRateDetails($orderId); $paymentInfo->setDebitType('BANK-TRANSFER')->setInstallmentAmount($details['rate'])->setInstallmentNumber($details['number_of_rates'])->setInterestRate($details['interest_amount'])->setLastInstallmentAmount($details['last_rate'])->setPaymentFirstDay($details['payment_firstday']); } } return $paymentInfo; }
/** * Retrieve the bankdata * * @return array */ public function getBankData() { $bankdata = array(); $bankdata['owner'] = Session::getRpSessionEntry('owner'); if (Session::getRpSessionEntry('iban')) { $bankdata['iban'] = Session::getRpSessionEntry('iban'); if (Session::getRpSessionEntry('bic-swift')) { $bankdata['bic-swift'] = Session::getRpSessionEntry('bic-swift'); } } else { $bankdata['bank-account-number'] = Session::getRpSessionEntry('bank-account-number'); $bankdata['bank-code'] = Session::getRpSessionEntry('bank-code'); } $bankdata['bank-name'] = Session::getRpSessionEntry('bank-name'); return $bankdata; }
<td> <?php if (!is_null(Session::getRpSessionEntry('message'))) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <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 } ?> <?php if ($order->info['payment_method'] == 'ratepay_rate') { ?> <?php $details = Db::getRatepayRateDetails($orderId);
/** * 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); }
/** * Is RatePAY disabled * * @return boolean */ public static function isRatepayAvailable() { return !Session::getRpSessionEntry('disabled'); }