/** * Retrieve a customerInfo model filled with the addresses and the customer data * * @param order $order * @param int $orderId * @return CustomerInfo */ public static function getCustomerInfoModel(order $order, $orderId = null) { $customerInfo = new CustomerInfo(); $customerInfo->setBillingAddressInfo(self::getBillingAdressInfo($order, $orderId))->setShippingAddressInfo(self::getShippingAdressInfo($order, $orderId)); if ($order->info['payment_method'] === 'ratepay_lastschrift' && is_null($orderId)) { $payment = Loader::getRatepayPayment($order->info['payment_method']); $bankAccount = $payment->getBankData(); $bankAccountInfo = new BankInfo(); $bankAccountInfo->setOwner($bankAccount['owner']); if (!empty($bankAccount['iban'])) { $bankAccountInfo->setIban($bankAccount['iban']); if (!empty($bankAccount['bic-swift'])) { $bankAccountInfo->setBic($bankAccount['bic-swift']); } } else { $bankAccountInfo->setAccountNumber($bankAccount['bank-account-number']); $bankAccountInfo->setBankCode($bankAccount['bank-code']); } $bankAccountInfo->setBankName($bankAccount['bank-name']); $customerInfo->setBankAccount($bankAccountInfo); } $customerInfo->setCreditInquiry('yes')->setDateOfBirth(Db::getCustomersDob($orderId, Session::getSessionEntry('customer_id')))->setEmail($order->customer['email_address'])->setFax(Db::getCustomersFax($orderId, Session::getSessionEntry('customer_id')))->setPhone($order->customer['telephone'])->setFirstName(is_null($orderId) ? $order->customer['firstname'] : Db::getRatepayOrderDataEntry($orderId, 'firstname'))->setGender(is_null($orderId) ? $order->customer['gender'] : Db::getRatepayOrderDataEntry($orderId, 'gender'))->setIp(is_null($orderId) ? Data::getCustomerIp() : Db::getRatepayOrderDataEntry($orderId, 'ip_address'))->setLastName(is_null($orderId) ? $order->customer['lastname'] : Db::getRatepayOrderDataEntry($orderId, 'lastname'))->setNationality(is_array($order->customer['country']) ? $order->customer['country']['iso_code_2'] : Db::getRatepayOrderDataEntry($orderId, 'customers_country_code')); $vatId = Db::getCustomersVatId($orderId, Session::getSessionEntry('customer_id')); if (!empty($order->customer['company']) && !empty($vatId)) { $customerInfo->setCompany($order->customer['company'])->setVatId($vatId); } return $customerInfo; }
/** * 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')); }
</table> </td> <td class="" valign="top"> <div style="margin:10px;color:#2F2F2F;"> <form name="details" id="details" action="checkout_confirmation.php" method="post"> <table style="width:100%;"> <tr> <td colspan="2"> <input type="hidden" id='conditions' name='conditions' value='conditions'/> <link type="text/css" rel="stylesheet" href="ext/modules/payment/ratepay/ratepay_rate/ratenrechner/css/style.css"/> <script type="text/javascript" src="ext/modules/payment/ratepay/ratepay_rate/ratenrechner/js/path.js"></script> <script type="text/javascript" src="ext/modules/payment/ratepay/ratepay_rate/ratenrechner/js/layout.js"></script> <script type="text/javascript" src="ext/modules/payment/ratepay/ratepay_rate/ratenrechner/js/ajax.js"></script> <script type="text/javascript" src="ext/modules/payment/ratepay/ratepay_rate/ratenrechner/js/mouseaction.js"></script> <?php echo Loader::getRatepayPayment('ratepay_rate')->getRateCalculatorError(); ?> <div id="pirpmain-cont" class="pirpmain-cont"> </div> <script type="text/javascript"> if(document.getElementById('pirpmain-cont')) { piLoadrateCalculator(); } </script> </td> </tr> <tr> <!--<td style="text-align:left;"> <a href="checkout_payment.php"> <img src="<?php echo DIR_WS_LANGUAGES . $language;
* @copyright (C) 2012 PayIntelligent GmbH <http://www.payintelligent.de/> * @license GPLv2 */ require_once 'includes/application_top.php'; require_once DIR_WS_CLASSES . 'currencies.php'; require_once 'includes/languages/' . $_SESSION['language'] . '/invoice.php'; require_once DIR_WS_CLASSES . 'order.php'; require_once DIR_FS_CATALOG . 'includes/languages/' . $_SESSION['language'] . '/modules/payment/ratepay_rechnung.php'; require_once '../includes/modules/payment/ratepay_rechnung.php'; require_once '../includes/classes/ratepay/helpers/Data.php'; require_once '../includes/classes/ratepay/helpers/Db.php'; require_once '../includes/classes/ratepay/helpers/Globals.php'; $currencies = new currencies(); $oID = tep_db_prepare_input($_GET['oID']); $order = new order($oID); $piRatepay = Loader::getRatepayPayment($order->info['payment_method']); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html <?php echo HTML_PARAMS; ?> > <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?> "> <title><?php echo TITLE; ?> </title>
/** * This method save's all necessary request and response informations in the database * * @param order $order * @param SimpleXmlExtended $request * @param string $orderId * @param SimpleXMLElement $response */ public static function xmlLog($order, $request, $orderId = 'N/A', $response = null) { require_once dirname(__FILE__) . '/../../../languages/' . Session::getLang() . '/modules/payment/' . $order->info['payment_method'] . '.php'; $payment = Loader::getRatepayPayment($order->info['payment_method']); if ($payment->logging) { $transactionId = 'N/A'; $subType = 'N/A'; if ($request->head->{'transaction-id'}) { $transactionId = (string) $request->head->{'transaction-id'}; } if ($request->head->operation->attributes()->subtype) { $subType = (string) $request->head->operation->attributes()->subtype; } $operation = (string) $request->head->operation; $responseXml = 'N/A'; if (!empty($response)) { $responseXml = $response->asXML(); $result = (string) $response->head->processing->result; $resultCode = (string) $response->head->processing->result->attributes()->code; $reasonText = (string) $response->head->processing->reason; if ($response->head->{'transaction-id'}) { $transactionId = (string) $response->head->{'transaction-id'}; } } else { $result = "Service unavaible."; $resultCode = "Service unavaible."; } $sql = "INSERT INTO ratepay_log " . "(" . "order_number, " . "transaction_id, " . "payment_method, " . "payment_type, " . "payment_subtype, " . "result, " . "request, " . "response, " . "result_code, " . "reason" . ") " . "VALUES ('" . tep_db_input($orderId) . "', '" . tep_db_input($transactionId) . "', '" . tep_db_input($payment->title) . "', '" . tep_db_input($operation) . "', '" . tep_db_input($subType) . "', '" . tep_db_input($result) . "','" . tep_db_input($request->asXML()) . "','" . tep_db_input($responseXml) . "','" . tep_db_input($resultCode) . "','" . tep_db_input($reasonText) . "')"; tep_db_query($sql); if ($operation == "PAYMENT_CONFIRM" && $transactionId != 'N/A') { $sql = "UPDATE ratepay_log SET order_number = '" . tep_db_input($orderId) . "' WHERE transaction_id = '" . tep_db_input($transactionId) . "';"; tep_db_query($sql); } } }
/** * Retrieve the credntials for the request * * @param string $payment * @return array */ public static function getCredentials($payment) { $payment = Loader::getRatepayPayment($payment); return array('profileId' => $payment->profileId, 'securityCode' => $payment->securityCode); }