Исходный код метода:
$this->load->model('checkout/order');
$this->load->model('payment/pp_payflow_iframe');
$this->load->model('localisation/country');
$this->load->model('localisation/zone');
$order_info = $this->model_checkout_order->getOrder($this->session->data['order_id']);
if ($this->config->get('pp_payflow_iframe_test')) {
$mode = 'TEST';
} else {
$mode = 'LIVE';
}
$payflow_url = 'https://payflowlink.paypal.com';
if ($this->config->get('pp_payflow_iframe_transaction_method') == 'sale') {
$transaction_type = 'S';
} else {
$transaction_type = 'A';
}
$secure_token_id = md5($this->session->data['order_id'] . mt_rand() . microtime());
$this->model_payment_pp_payflow_iframe->addOrder($order_info['order_id'], $secure_token_id);
$shipping_country = $this->model_localisation_country->getCountry($order_info['shipping_country_id']);
$shipping_zone = $this->model_localisation_zone->getZone($order_info['shipping_zone_id']);
$payment_country = $this->model_localisation_country->getCountry($order_info['payment_country_id']);
$payment_zone = $this->model_localisation_zone->getZone($order_info['payment_zone_id']);
$urlParams = array(
'TENDER' => 'C',
'TRXTYPE' => $transaction_type,
'AMT' => $this->currency->format($order_info['total'], $order_info['currency_code'], false, false),
'CURRENCY' => $order_info['currency_code'],
'CREATESECURETOKEN' => 'Y',
'SECURETOKENID' => $secure_token_id,
'BILLTOFIRSTNAME' => $order_info['payment_firstname'],
'BILLTOLASTNAME' => $order_info['payment_lastname'],
'BILLTOSTREET' => trim($order_info['payment_address_1'] . ' ' . $order_info['payment_address_2']),
'BILLTOCITY' => $order_info['payment_city'],
'BILLTOSTATE' => $payment_zone['code'],
'BILLTOZIP' => $order_info['payment_postcode'],
'BILLTOCOUNTRY' => $payment_country['iso_code_2'],
);
// Does the order have shipping ?
if ($shipping_country) {
$urlParams['SHIPTOFIRSTNAME'] = $order_info['shipping_firstname'];
$urlParams['SHIPTOLASTNAME'] = $order_info['shipping_lastname'];
$urlParams['SHIPTOSTREET'] = trim($order_info['shipping_address_1'] . ' ' . $order_info['shipping_address_2']);
$urlParams['SHIPTOCITY'] = $order_info['shipping_city'];
$urlParams['SHIPTOSTATE'] = $shipping_zone['code'];
$urlParams['SHIPTOZIP'] = $order_info['shipping_postcode'];
$urlParams['SHIPTOCOUNTRY'] = $shipping_country['iso_code_2'];
}
$response_params = $this->model_payment_pp_payflow_iframe->call($urlParams);
if (isset($response_params['SECURETOKEN'])) {
$secure_token = $response_params['SECURETOKEN'];
} else {
$secure_token = '';
}
$iframe_params = array(
'MODE' => $mode,
'SECURETOKENID' => $secure_token_id,
'SECURETOKEN' => $secure_token,
);
$this->data['iframe_url'] = $payflow_url . '?' . http_build_query($iframe_params, '', "&");
$this->data['checkout_method'] = $this->config->get('pp_payflow_iframe_checkout_method');
$this->data['button_confirm'] = $this->language->get('button_confirm');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/payment/pp_payflow_iframe.tpl')) {
$this->template = $this->config->get('config_template') . '/template/payment/pp_payflow_iframe.tpl';
} else {
$this->template = 'default/template/payment/pp_payflow_iframe.tpl';
}
$this->render();