Exemplo n.º 1
0
 protected function getCardData()
 {
     $card = array();
     $card['number'] = $this->order_info['payment_info']['card_number'];
     $card['cardholder_name'] = $this->order_info['payment_info']['cardholder_name'];
     $card['exp_month'] = $this->order_info['payment_info']['expiry_month'];
     $card['exp_year'] = $this->order_info['payment_info']['expiry_year'];
     $card['cvv2'] = !empty($this->order_info['payment_info']['cvv2']) ? $this->order_info['payment_info']['cvv2'] : '';
     $card['type'] = fn_get_payment_card($this->order_info['payment_info']['card_number'], array('visa' => 'VISA', 'amex' => 'AMEX', 'mastercard' => 'MC', 'maestro' => 'MC', 'laser' => 'LASER', 'diners_club_carte_blanche' => 'DINERS', 'diners_club_international' => 'DINERS'));
     return $card;
 }
Exemplo n.º 2
0
/**
 * Make cmpi_lookup request to 3-D Secure sevice provider
 *
 * @param array $processor_data Payment processor data
 * @param array $order_info Order information
 * @return boolean true
 */
function fn_cmpi_lookup($processor_data, $order_info, $mode = '')
{
    unset(Tygh::$app['session']['cmpi']);
    $amount = preg_replace('/\\D/', '', $order_info['total']);
    // array with ISO codes of currencies. //TODO: move to database.
    $iso4217 = array('USD' => 840, 'GBP' => 826, 'EUR' => 978, 'AUD' => 036, 'CAD' => 124, 'JPY' => 392);
    $settings = array('processor_id', 'merchant_id', 'transaction_password', 'transaction_url');
    foreach ($settings as $setting) {
        Tygh::$app['session']['cmpi'][$setting] = $processor_data['processor_params'][$setting];
    }
    $session = Tygh::$app['session'];
    $cardinal_request = <<<EOT
<CardinalMPI>
<MsgType>cmpi_lookup</MsgType>
<Version>1.7</Version>
<ProcessorId>{$session['cmpi']['processor_id']}</ProcessorId>
<MerchantId>{$session['cmpi']['merchant_id']}</MerchantId>
<TransactionPwd>{$session['cmpi']['transaction_password']}</TransactionPwd>
<TransactionType>C</TransactionType>
<Amount>{$amount}</Amount>
<CurrencyCode>{$iso4217[$processor_data['processor_params']['currency']]}</CurrencyCode>
<CardNumber>{$order_info['payment_info']['card_number']}</CardNumber>
<CardExpMonth>{$order_info['payment_info']['expiry_month']}</CardExpMonth>
<CardExpYear>20{$order_info['payment_info']['expiry_year']}</CardExpYear>
<OrderNumber>{$order_info['order_id']}</OrderNumber>
<OrderDesc>Order #{$order_info['order_id']}; customer: {$order_info['b_firstname']} {$order_info['b_lastname']};</OrderDesc>
<BrowserHeader>*/*</BrowserHeader>
<EMail>{$order_info['email']}</EMail>
<IPAddress>{$_SERVER['REMOTE_ADDR']}</IPAddress>
<BillingFirstName>{$order_info['b_firstname']}</BillingFirstName>
<BillingLastName>{$order_info['b_lastname']}</BillingLastName>
<BillingAddress1>{$order_info['b_address']}</BillingAddress1>
<BillingAddress2>{$order_info['b_address_2']}</BillingAddress2>
<BillingCity>{$order_info['b_city']}</BillingCity>
<BillingState>{$order_info['b_state']}</BillingState>
<BillingPostalCode>{$order_info['b_zipcode']}</BillingPostalCode>
<BillingCountryCode>{$order_info['b_country']}</BillingCountryCode>
<ShippingFirstName>{$order_info['s_firstname']}</ShippingFirstName>
<ShippingLastName>{$order_info['s_lastname']}</ShippingLastName>
<ShippingAddress1>{$order_info['s_address']}</ShippingAddress1>
<ShippingAddress2>{$order_info['s_address_2']}</ShippingAddress2>
<ShippingCity>{$order_info['s_city']}</ShippingCity>
<ShippingState>{$order_info['s_state']}</ShippingState>
<ShippingPostalCode>{$order_info['s_zipcode']}</ShippingPostalCode>
<ShippingCountryCode>{$order_info['s_country']}</ShippingCountryCode>
</CardinalMPI>
EOT;
    Registry::set('log_cut_data', array('CardNumber', 'CardExpMonth', 'CardExpYear'));
    $response_data = Http::post(Tygh::$app['session']['cmpi']['transaction_url'], array('cmpi_msg' => $cardinal_request));
    $cmpi = @simplexml_load_string($response_data);
    $err_no = 0;
    Tygh::$app['session']['cmpi']['enrolled'] = 'U';
    $acs_url = '';
    if (empty($response_data) || $cmpi === false) {
        Tygh::$app['session']['cmpi']['eci_flag'] = fn_get_payment_card($order_info['payment_info']['card_number'], array('mastercard' => 1, 'visa' => 7, 'jcb' => 7));
        $err_desc = 'Connection problem';
    } else {
        $err_no = intval((string) $cmpi->ErrorNo);
        $err_desc = (string) $cmpi->ErrorDesc;
        $acs_url = (string) $cmpi->ACSUrl;
        Tygh::$app['session']['cmpi']['enrolled'] = (string) $cmpi->Enrolled;
        Tygh::$app['session']['cmpi']['transaction_id'] = (string) $cmpi->TransactionId;
        Tygh::$app['session']['cmpi']['eci_flag'] = (string) $cmpi->EciFlag;
    }
    if ($err_no == 0 && Tygh::$app['session']['cmpi']['enrolled'] == 'Y' && !empty($acs_url)) {
        $sess = Tygh::$app['session']->getName() . '=' . Tygh::$app['session']->getId();
        $payment_name = str_replace('.php', '', $processor_data['processor_script']);
        Tygh::$app['session']['cmpi']['acs_url'] = $acs_url;
        Tygh::$app['session']['cmpi']['order_id'] = $order_info['order_id'];
        Tygh::$app['session']['cmpi']['frame_data'] = array('PaReq' => (string) $cmpi->Payload, 'TermUrl' => fn_url("payment_notification.bank?payment={$payment_name}&{$sess}", AREA, 'current'), 'MD' => '');
        $frame_src = fn_url("payment_notification.frame?payment={$payment_name}&{$sess}", AREA, 'current');
        $msg = __('text_cmpi_frame_message');
        $back_link_msg = __('text_cmpi_go_back');
        $dispatch = $mode == 'repay' ? 'orders.details?order_id=' . $order_info['order_id'] . '&' : 'checkout.checkout?';
        $back_link = fn_url($dispatch . $sess, AREA, 'current');
        echo <<<EOT
<table width="100%" cellspacing="0" cellpadding="0">
    <tr>
        <td valign="top" align="center">
            <div style="width:500px;">
                {$msg}
                <br /><br />
            </div>
        </td>
    </tr>
    <tr>
        <td valign="top" align="center">
            <iframe width="420" height="420" marginwidth="0" marginheight="0" src="{$frame_src}"></iframe><br />
            <br />
            <div>
                <a href="{$back_link}>{$back_link_msg}</a>
            </div>
        </td>
    </tr>
</table>
EOT;
        exit;
    } else {
        Tygh::$app['session']['cmpi']['err_no'][0] = $err_no;
        Tygh::$app['session']['cmpi']['err_desc'][0] = $err_desc;
        define('DO_DIRECT_PAYMENT', true);
    }
    return true;
}
Exemplo n.º 3
0
        $post_address = 'https://test.sagepay.com/Simulator/VSPDirectCallback.asp';
    }
    $result = Http::post($post_address, $post);
    $already_posted = true;
} else {
    $pp_merch = $processor_data['processor_params']['vendor'];
    $pp_curr = $processor_data['processor_params']['currency'];
    if ($processor_data['processor_params']['testmode'] == 'Y') {
        $post_address = 'https://test.sagepay.com/gateway/service/vspdirect-register.vsp';
    } elseif ($processor_data['processor_params']['testmode'] == 'N') {
        $post_address = 'https://live.sagepay.com/gateway/service/vspdirect-register.vsp';
    } elseif ($processor_data['processor_params']['testmode'] == 'S') {
        $post_address = 'https://test.sagepay.com/Simulator/VSPDirectGateway.asp';
    }
    $already_posted = false;
    $card_type = fn_get_payment_card($order_info['payment_info']['card_number'], array('visa' => 'VISA', 'visa_debit' => 'DELTA', 'mastercard' => 'MC', 'mastercard_debit' => 'MCDEBIT', 'amex' => 'AMEX', 'jcb' => 'JCB', 'maestro' => 'MAESTRO', 'visa_electron' => 'UKE', 'laser' => 'LASER', 'diners_club_carte_blanche' => 'DINERS', 'diners_club_international' => 'DINERS'));
    $post = array();
    $post['VPSProtocol'] = '2.23';
    $post['TxType'] = $processor_data['processor_params']['transaction_type'];
    $post['Vendor'] = $pp_merch;
    $post['VendorTxCode'] = (!empty($processor_data['processor_params']['order_prefix']) ? $processor_data['processor_params']['order_prefix'] : 'O') . '-' . ($order_info['repaid'] ? $order_info['order_id'] . '-' . $order_info['repaid'] : $order_info['order_id']) . '-' . fn_date_format(time(), '%H_%M_%S');
    $post['Amount'] = $order_info["total"];
    $post['Currency'] = $pp_curr;
    $post['Description'] = 'Your Cart';
    $post['CardHolder'] = $order_info['payment_info']['cardholder_name'];
    $post['CardNumber'] = $order_info['payment_info']['card_number'];
    $post['ExpiryDate'] = $order_info['payment_info']['expiry_month'] . $order_info['payment_info']['expiry_year'];
    $post['CV2'] = $order_info['payment_info']['cvv2'];
    $post['CardType'] = $card_type;
    $post['Apply3DSecure'] = 0;
    $post['BillingAddress1'] = $order_info['b_address'];
Exemplo n.º 4
0
        $paypal_sslcertpath = '';
        $paypal_url = "https://api-3t{$sandbox}.paypal.com:443/2.0/";
    } else {
        $paypal_signature = '';
        $paypal_sslcertpath = Registry::get('config.dir.certificates') . (isset($processor_data['processor_params']['certificate_filename']) ? $processor_data['processor_params']['certificate_filename'] : '');
        $paypal_url = "https://api{$sandbox}.paypal.com:443/2.0/";
    }
    $paypal_notify_url = fn_url("payment_notification.paypal_ipn", AREA, 'current');
    $paypal_payment_action = 'Sale';
    // FIXME: Should be configurable
    $paypal_currency = $processor_data['processor_params']['currency'];
    //Order Total
    $paypal_total = fn_format_price($order_info['total'], $paypal_currency);
    $paypal_order_id = $processor_data['processor_params']['order_prefix'] . ($order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id);
    //Credit Card
    $paypal_card = fn_get_payment_card($order_info['payment_info']['card_number'], array('visa' => 'Visa', 'amex' => 'Amex', 'discover' => 'Discover', 'mastercard' => 'MasterCard'));
    $paypal_card_number = $order_info['payment_info']['card_number'];
    $paypal_card_exp_month = $order_info['payment_info']['expiry_month'];
    $paypal_card_exp_year = '20' . $order_info['payment_info']['expiry_year'];
    $paypal_card_cvv2 = !empty($order_info['payment_info']['cvv2']) ? $order_info['payment_info']['cvv2'] : '';
    $paypal_3dsecure = '';
    if ($use_cardinal) {
        $fields = array('eci_flag', 'pares', 'xid', 'cavv', 'enrolled');
        foreach ($fields as $field) {
            $_SESSION['cmpi'][$field] = isset($_SESSION['cmpi'][$field]) ? $_SESSION['cmpi'][$field] : '';
        }
        $paypal_3dsecure = <<<EOT
<ThreeDSecureRequest>
<AuthStatus3ds><![CDATA[{$_SESSION['cmpi']['pares']}]]></AuthStatus3ds>
<MpiVendor3ds><![CDATA[{$_SESSION['cmpi']['enrolled']}]]></MpiVendor3ds>
<Cavv><![CDATA[{$_SESSION['cmpi']['cavv']}]]></Cavv>
Exemplo n.º 5
0
/***************************************************************************
*                                                                          *
*   (c) 2004 Vladimir V. Kalynyak, Alexey V. Vinokurov, Ilya M. Shalnev    *
*                                                                          *
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$card_type = fn_get_payment_card($order_info['payment_info']['card_number'], array('visa' => 'VISA', 'mastercard' => 'MASTERCARD', 'amex' => 'AMEX', 'jcb' => 'JCB', 'maestro' => 'MAESTRO', 'laser' => 'LASER', 'diners_club_carte_blanche' => 'DINERS', 'diners_club_international' => 'DINERS'));
$_order_id = $order_info['repaid'] ? $order_id . '_' . $order_info['repaid'] : $order_id;
$expiry_date = $order_info['payment_info']['expiry_month'] . $order_info['payment_info']['expiry_year'];
$test = $processor_data['processor_params']['test'] == '1' ? true : false;
$avs = $processor_data['processor_params']['avs'] == '1' ? true : false;
$cvv = $order_info['payment_info']['cvv2'];
require_once 'worldnettps_files/worldnet_tps_xml.php';
$sale = new XmlAuthRequest($processor_data['processor_params']['terminal_id'], $_order_id . fn_date_format(TIME, '%H_%M_%S'), $processor_data['processor_params']['currency'], $order_info['total'], $order_info['email'] . " " . $_order_id, $order_info['email'], $order_info['payment_info']['card_number'], $card_type, $expiry_date, $order_info['payment_info']['cardholder_name']);
if ($cvv != '') {
    $sale->SetCvv($cvv);
}
if ($avs) {
    $address1 = $order_info['b_address'];
    $address2 = $order_info['b_city'] . $order_info['b_state'];
    $postcode = $order_info['b_zipcode'];
    $sale->SetAvs($address1, $address2, $postcode);
Exemplo n.º 6
0
* This  is  commercial  software,  only  users  who have purchased a valid *
* license  and  accept  to the terms of the  License Agreement can install *
* and use this program.                                                    *
*                                                                          *
****************************************************************************
* PLEASE READ THE FULL TEXT  OF THE SOFTWARE  LICENSE   AGREEMENT  IN  THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE.            *
****************************************************************************/
use Tygh\Http;
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
    die('Access denied');
}
$avs_responses = array("X" => "Both the zip code (the AVS 9-digit) and the street address match.", "Y" => "Both the zip (the AVS 5-digit) and the street address match.", "A" => "The street address matches, but the zip code does not match.", "W" => "The 9-digit zip codes matches, but the street address does not match.", "Z" => "The 5-digit zip codes matches, but the street address does not match.", "N" => "Neither the street address nor the postal code matches.", "R" => "Retry, System unavailable (maybe due to timeout).", "S" => "Service not supported.", "U" => "Address information unavailable.", "E" => "Data not available/error invalid.", "G" => "Non-US card issuer that does not participate in AVS");
// Get CC type
$card_type = fn_get_payment_card($order_info['payment_info']['card_number'], array('visa' => 'visa', 'mastercard' => 'mc', 'amex' => 'amex', 'jcb' => 'jcb', 'diners_club_carte_blanche' => 'diners', 'diners_club_international' => 'diners', 'discover' => 'discover'));
// Prepare data to post to Innovative server
$post = array();
$post['VPSProtocol'] = '2.22';
$post['target_app'] = 'WebCharge_v5.06';
$post['response_mode'] = 'simple';
$post['response_fmt'] = 'delimited';
$post['upg_auth'] = 'zxcvlkjh';
$post['delimited_fmt_field_delimiter'] = '=';
$post['delimited_fmt_include_fields'] = 'true';
$post['delimited_fmt_value_delimiter'] = '||';
$post['username'] = $processor_data['processor_params']['username'];
$post['pw'] = $processor_data['processor_params']['password'];
$post['trantype'] = 'sale';
$post['cardtype'] = $card_type;
$post['ccnumber'] = $order_info['payment_info']['card_number'];