Пример #1
0
 /**
  * Gets installment details. Delivers a JSON String with history details
  *
  * @see templates/backend/plugins/PigmbhRatePAYPayment/index.php
  */
 public function getRateConfigRequestAction()
 {
     $this->View()->setTemplate();
     include_once dirname(__FILE__) . '/../../Views/Frontend/Ratenrechner/php/pi_ratepay_xml_service.php';
     $ratepay = new pi_ratepay_xml_service;
     $ratepay->live = checkSandboxMode('RatePAYRate');
     $request = $ratepay->getXMLObject();
     $returnItems = array();
     $head = $request->addChild('head');
     $head->addChild('system-id', $_SERVER['REMOTE_ADDR']);
     $head->addChild('operation', 'CONFIGURATION_REQUEST');
     setRatepayHeadCredentials($head, 'CONFIGURATION_REQUEST', false, false);
     $response = $ratepay->paymentOperation($request);
     $response? $responseVar = $response: $responseVar=false;
     writeLog("", "", "CONFIGURATION_REQUEST", "", $request, $responseVar, Shopware()->Config()->Shopname, 'RatePAYRate' );
     $returnItems[0]['text'] = 'interestrate-min';
     $returnItems[0]['value'] = (string) $response->content->{'installment-configuration-result'}->{'interestrate-min'};
     $returnItems[1]['text'] = 'interestrate-default';
     $returnItems[1]['value'] = (string) $response->content->{'installment-configuration-result'}->{'interestrate-default'};
     $returnItems[2]['text'] = 'interestrate-max';
     $returnItems[2]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'interestrate-max'};
     $returnItems[3]['text'] = 'month-number-min';
     $returnItems[3]['value'] = (string) $response->content->{'installment-configuration-result'}->{'month-number-min'};
     $returnItems[4]['text'] = 'month-number-max';
     $returnItems[4]['value'] = (string) $response->content->{'installment-configuration-result'}->{'month-number-max'};
     $returnItems[5]['text'] = 'month-longrun';
     $returnItems[5]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'month-longrun'};
     $returnItems[6]['text'] = 'month-allowed';
     $returnItems[6]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'month-allowed'};
     $returnItems[7]['text'] = 'payment-firstday';
     $returnItems[7]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'payment-firstday'};
     $returnItems[8]['text'] = 'payment-amount';
     $returnItems[8]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'payment-amount'};
     $returnItems[9]['text'] = 'payment-lastrate';
     $returnItems[9]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'payment-lastrate'};
     $returnItems[10]['text'] = 'rate-min-normal';
     $returnItems[10]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'rate-min-normal'};
     $returnItems[11]['text'] = 'rate-min-longrun';
     $returnItems[11]['value'] =  (string) $response->content->{'installment-configuration-result'}->{'rate-min-longrun'};
     $returnItems[12]['text'] = 'service-charge';
     $returnItems[12]['value'] = (string) $response->content->{'installment-configuration-result'}->{'service-charge'};
     echo json_encode(array("total" => count($returnItems), "items" => $returnItems));
 }
Пример #2
0
/**
 * Sets Head for request
 *
 * @param Object $request       Request object
 * @param String $operation     Request operation
 * @param String $subtype       Request subtype
 * @param String $ordernumber   Current ordernumber
 * @return Object
 */
function setRatepayHead($request, $operation, $subtype=false, $ordernumber=false) {
    $systemId = "";
    $transid = "";
    $transshortid = "";
    if ($operation == "CONFIRMATION_DELIVER" || $operation == 'PAYMENT_CHANGE') {
        $systemId = $_SERVER["SERVER_ADDR"];
        $sql = "SELECT `transactionid` FROM `pi_ratepay_orders` WHERE `order_number` = ?";
        $transid = Shopware()->Db()->fetchOne($sql,  array($ordernumber));
        $sql = "SELECT `transaction_short_id` FROM `pi_ratepay_orders` WHERE `order_number` = ?";
        $transshortid = Shopware()->Db()->fetchOne($sql,  array($ordernumber));
    }
    else {
        $systemId = Shopware()->Session()->pi_ratepay_ClientIp;
        $transid = Shopware()->Session()->pi_ratepay_transactionID;
        $transshortid = Shopware()->Session()->pi_ratepay_transactionShortID;
    }
    $head = $request->addChild('head');
    $head->addChild('system-id', $systemId);
    $head->addChild('transaction-id', $transid);
    $head->addChild('transaction-short-id', $transshortid);
    if ($operation == "PAYMENT_CHANGE") {
        $operation = $head->addChild('operation', $operation);
        $operation->addAttribute('subtype', $subtype);
    }
    else $head->addChild('operation', $operation);
    setRatepayHeadCredentials($head, $operation, $subtype, $ordernumber);

    if ($operation == "PAYMENT_REQUEST")
        setRatepayHeadCustomerDevice($head);
    elseif ($operation == "CONFIRMATION_DELIVER" || $operation == 'PAYMENT_CHANGE' || $operation == 'PAYMENT_CONFIRM')
        setRatepayHeadExternal($head, $transid);
    setRatepayHeadMeta($head);
    return($head);
}