예제 #1
0
 /**
  * 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 rpHeadInfo
  */
 public static function getHeadInfoModel(order $order, $transactionId = null, $transactionShortId = null, $orderId = null, $subtype = null)
 {
     rpSession::setRpSessionEntry('orderId', $orderId);
     $payment = rpLoader::getRatepayPayment($order->info['payment_method']);
     $headInfo = new rpHeadInfo();
     $headInfo->setOrderId($orderId)->setProfileId($payment->profileId)->setSecurityCode($payment->securityCode)->setSubtype($subtype)->setTransactionId($transactionId)->setTransactionShortId($transactionShortId)->setShopSystem($payment->shopSystem)->setShopVersion($payment->shopVersion)->setModuleVersion($payment->version)->setDeviceSite(rpSession::getRpSessionEntry('RATEPAY_DFP_SNIPPET_ID'))->setDeviceToken(rpSession::getRpSessionEntry('RATEPAY_DFP_TOKEN'));
     return $headInfo;
 }
예제 #2
0
 public function selection()
 {
     global $order;
     $display = parent::selection();
     rpSession::setRpSessionEntry('basketAmount', rpData::getBasketAmount($order));
     rpSession::setRpSessionEntry('securityCode', $this->securityCode);
     rpSession::setRpSessionEntry('profileId', $this->profileId);
     if (!is_null($display)) {
         $minVarName = 'min' . ucfirst(strtolower($order->billing['country']['iso_code_2']));
         $maxVarName = 'max' . ucfirst(strtolower($order->billing['country']['iso_code_2']));
         $privacy = '';
         $privacyConstant = 'MODULE_PAYMENT_' . strtoupper($this->code) . '_RATEPAY_PRIVACY_URL_' . strtoupper($order->billing['country']['iso_code_2']);
         if (defined($privacyConstant)) {
             $privacy = constant($privacyConstant);
         }
         $smarty = new Smarty();
         /* BEGINN OF DEVICE FINGERPRINT CODE */
         if (!rpSession::getRpSessionEntry('RATEPAY_DFP_TOKEN') && rpDb::getRpDfpSId()) {
             $ratepay_dfp_token = md5($order->info['total'] . microtime());
             rpSession::setRpSessionEntry('RATEPAY_DFP_TOKEN', $ratepay_dfp_token);
             $smarty->assign('RATEPAY_DFP_TOKEN', $ratepay_dfp_token);
             $smarty->assign('RATEPAY_DFP_SNIPPET_ID', rpDb::getRpDfpSId());
         }
         /* END OF DEVICE FINGERPRINT CODE */
         //CS Aenderung des Value von $display['module'] fuer die Ausgabe
         $display['module'] = $this->public_title;
         $display['fields'][] = array('title' => '', 'field' => $smarty->fetch(CURRENT_TEMPLATE . '/module/ratepay_rate.html'));
     }
     return $display;
 }
예제 #3
0
 /**
  * Call PAYMENT_CHANGE with the subtype credit
  * and add a credit item to the order
  */
 public static function creditAction()
 {
     $post = rpGlobals::getPost();
     $orderId = rpGlobals::getPostEntry('order_number');
     $creditAmount = floatval($post['voucherAmount'] . '.' . $post['voucherAmountKomma']);
     $deliveredBasketAmount = rpDb::getRpBasketAmount($orderId);
     if ($creditAmount <= $deliveredBasketAmount) {
         $order = new order($orderId);
         $rate = $order->info['payment_method'] == 'ratepay_rate' ? true : false;
         $payment = rpLoader::getRatepayPayment($order->info['payment_method']);
         $transactionId = rpDb::getRatepayOrderDataEntry($orderId, 'transaction_id');
         $transactionShortId = rpDb::getRatepayOrderDataEntry($orderId, 'transaction_short_id');
         if ($rate) {
             $subType = 'return';
             $postCredit = self::getRefundPostData($post);
         } else {
             $subType = 'credit';
         }
         $postCredit['order_number'] = $post['order_number'];
         $postCredit['voucherAmount'] = $post['voucherAmount'];
         $postCredit['voucherAmountKomma'] = $post['voucherAmountKomma'];
         $data = array('HeadInfo' => rpRequestMapper::getHeadInfoModel($order, $transactionId, $transactionShortId, $orderId, $subType), 'BasketInfo' => rpRequestMapper::getBasketInfoModel($order, $orderId, $postCredit, $subType), 'PaymentInfo' => rpRequestMapper::getPaymentInfoModel($order, $orderId, $postCredit, $subType));
         $requestService = new rpRequestService($payment->sandbox, $data);
         $result = $requestService->callPaymentChange();
         rpDb::xmlLog($order, $requestService->getRequest(), $orderId, $requestService->getResponse());
         if (!array_key_exists('error', $result)) {
             rpSession::setRpSessionEntry('message_css_class', 'messageStackSuccess');
             rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_SUCCESS);
             rpDb::setRpCreditItem(rpGlobals::getPost(), $rate ? 1 : 0);
             rpDb::setRpHistoryEntry($orderId, rpData::getCreditItem($post), 'PAYMENT_CHANGE', $subType);
             rpDb::addCreditToShop($orderId, $post);
             rpDb::updateShopOrderTotals($orderId);
         } else {
             rpSession::setRpSessionEntry('message_css_class', 'messageStackError');
             rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_ERROR);
         }
         if ($rate) {
             xtc_redirect(xtc_href_link("ratepay_order.php", 'oID=' . $orderId, 'SSL'));
         } else {
             self::deliverAction(self::getDeliverPostArray($orderId, $post['items']));
         }
     } else {
         rpSession::setRpSessionEntry('message_css_class', 'messageStackError');
         rpSession::setRpSessionEntry('message', RATEPAY_ORDER_MESSAGE_CREDIT_ERROR);
         xtc_redirect(xtc_href_link("ratepay_order.php", 'oID=' . $orderId, 'SSL'));
     }
 }
예제 #4
0
 private function _setBankDataSession($data)
 {
     rpSession::setRpSessionEntry('ratepay_sepa_account_holder', $data['rp-account-holder']);
     rpSession::setRpSessionEntry('ratepay_sepa_account_number', $data['rp-account-number']);
     rpSession::setRpSessionEntry('ratepay_sepa_bank_name', $data['rp-bank-name']);
     rpSession::setRpSessionEntry('ratepay_sepa_bank_code_number', array_key_exists('rp-sort-code', $data) ? $data['rp-sort-code'] : null);
 }
 /**
  * Call PAYMENT_REQUEST request
  * 
  * @global order $order
  * @param string $transactionId
  * @param string$transactionShortId
  * @return array
  */
 protected function _paymentRequest($transactionId, $transactionShortId)
 {
     global $order;
     rpSession::setRpSessionEntry('countryCode', $order->customer['country']['iso_code_2']);
     $data = array('HeadInfo' => rpRequestMapper::getHeadInfoModel($order, $transactionId, $transactionShortId), 'CustomerInfo' => rpRequestMapper::getCustomerInfoModel($order), 'BasketInfo' => rpRequestMapper::getBasketInfoModel($order), 'PaymentInfo' => rpRequestMapper::getPaymentInfoModel($order));
     $requestService = new rpRequestService($this->sandbox, $data);
     $result = $requestService->callPaymentRequest();
     rpDb::xmlLog($order, $requestService->getRequest(), 'N/A', $requestService->getResponse());
     return $result;
 }
예제 #6
0
 /**
  * Disable RatePAY for a customer
  */
 public static function disableRatepay()
 {
     rpSession::setRpSessionEntry('disabled', true);
 }
 /**
  * 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)
 {
     rpSession::setRpSessionEntry('ratepay_rate_total_amount', $total_amount);
     rpSession::setRpSessionEntry('ratepay_rate_amount', $amount);
     rpSession::setRpSessionEntry('ratepay_rate_interest_rate', $interest_rate);
     rpSession::setRpSessionEntry('ratepay_rate_interest_amount', $interest_amount);
     rpSession::setRpSessionEntry('ratepay_rate_service_charge', $service_charge);
     rpSession::setRpSessionEntry('ratepay_rate_annual_percentage_rate', $annual_percentage_rate);
     rpSession::setRpSessionEntry('ratepay_rate_monthly_debit_interest', $monthly_debit_interest);
     rpSession::setRpSessionEntry('ratepay_rate_number_of_rates', $number_of_rates);
     rpSession::setRpSessionEntry('ratepay_rate_rate', $rate);
     rpSession::setRpSessionEntry('ratepay_rate_last_rate', $last_rate);
     if (array_key_exists('pi_dd', $_SESSION)) {
         rpSession::setRpSessionEntry('ratepay_payment_firstday', $_SESSION['pi_dd']);
     } else {
         rpSession::setRpSessionEntry('ratepay_payment_firstday', $payment_firstday);
     }
 }