/** * Payment step. * * @return tempcode The result of execution. */ function payment_form() { require_code('ecommerce'); $title = get_page_title('PAYMENT_HEADING'); $cart_items = find_products_in_cart(); $purchase_id = NULL; $tax_opt_out = get_order_tax_opt_out_status(); if (count($cart_items) > 0) { $insert = array('c_member' => get_member(), 'session_id' => get_session_id(), 'add_date' => time(), 'tot_price' => 0, 'order_status' => 'ORDER_STATUS_awaiting_payment', 'notes' => '', 'purchase_through' => 'cart', 'transaction_id' => '', 'tax_opted_out' => $tax_opt_out); if (is_null($GLOBALS['SITE_DB']->query_value_null_ok('shopping_order', 'id'))) { $insert['id'] = hexdec('1701D'); // Start offset } $order_id = $GLOBALS['SITE_DB']->query_insert('shopping_order', $insert, true); } else { $order_id = NULL; } $total_price = 0; foreach ($cart_items as $item) { $product = $item['product_id']; $hook = $item['product_type']; require_code('hooks/systems/ecommerce/' . filter_naughty_harsh($hook), true); $object = object_factory('Hook_' . filter_naughty_harsh($hook), true); if (is_null($object)) { continue; } $temp = $object->get_products(false, $product); if ($temp[$product][0] == PRODUCT_SUBSCRIPTION) { continue; } //Subscription type skipped. $price = $temp[$product][1]; $item_name = $temp[$product][4]; if (method_exists($object, 'set_needed_fields')) { $purchase_id = $object->set_needed_fields($product); } else { $purchase_id = strval(get_member()); } $length = NULL; $length_units = ''; if (method_exists($object, 'calculate_product_price')) { $price = $object->calculate_product_price($item['price'], $item['price_pre_tax'], $item['product_weight']); } else { $price = $item['price']; } if (method_exists($object, 'calculate_tax') && $tax_opt_out == 0) { $tax = round($object->calculate_tax($item['price'], $item['price_pre_tax']), 2); } else { $tax = 0.0; } $GLOBALS['SITE_DB']->query_insert('shopping_order_details', array('p_id' => $item['product_id'], 'p_name' => $item['product_name'], 'p_code' => $item['product_code'], 'p_type' => $item['product_type'], 'p_quantity' => $item['quantity'], 'p_price' => $price, 'included_tax' => $tax, 'order_id' => $order_id, 'dispatch_status' => ''), true); $total_price += $price * $item['quantity']; } $GLOBALS['SITE_DB']->query_update('shopping_order', array('tot_price' => $total_price), array('id' => $order_id), '', 1); if (!perform_local_payment()) { $result = make_cart_payment_button($order_id, get_option('currency')); } else { if (!tacit_https() && !ecommerce_test_mode()) { warn_exit(do_lang_tempcode('NO_SSL_SETUP')); } if (is_null($order_id)) { $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); } else { list($fields, $hidden) = get_transaction_form_fields(NULL, strval($order_id), $item_name, float_to_raw_string($price), NULL, ''); } /*$via =get_option('payment_gateway'); require_code('hooks/systems/ecommerce_via/'.filter_naughty_harsh($via)); $object=object_factory('Hook_'.$via); $ipn_url=$object->get_ipn_url();*/ $finish_url = build_url(array('page' => 'purchase', 'type' => 'finish'), get_module_zone('purchase')); $result = do_template('PURCHASE_WIZARD_STAGE_TRANSACT', array('FIELDS' => $fields, 'HIDDEN' => $hidden)); require_javascript('javascript_validation'); return do_template('PURCHASE_WIZARD_SCREEN', array('TITLE' => $title, 'CONTENT' => $result, 'URL' => $finish_url)); } return $result; }
/** * Show my invoices. * * @return tempcode The interface. */ function pay() { $id = get_param_integer('id'); if (!tacit_https() && !ecommerce_test_mode()) { warn_exit(do_lang_tempcode('NO_SSL_SETUP')); } $title = get_page_title('MAKE_PAYMENT'); $post_url = build_url(array('page' => 'purchase', 'type' => 'finish'), get_module_zone('purchase')); $rows = $GLOBALS['SITE_DB']->query_select('invoices', array('*'), array('id' => $id), '', 1); if (!array_key_exists(0, $rows)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $row = $rows[0]; $product = $row['i_type_code']; $object = find_product($product); $products = $object->get_products(false, $product); $invoice_title = $products[$product][4]; list($fields, $hidden) = get_transaction_form_fields(NULL, strval($id), $invoice_title, float_to_raw_string($row['i_amount']), NULL, ''); $text = do_lang_tempcode('TRANSACT_INFO'); return do_template('FORM_SCREEN', array('_GUID' => 'e90a4019b37c8bf5bcb64086416bcfb3', 'TITLE' => $title, 'SKIP_VALIDATION' => '1', 'FIELDS' => $fields, 'URL' => $post_url, 'TEXT' => $text, 'HIDDEN' => $hidden, 'SUBMIT_NAME' => do_lang_tempcode('MAKE_PAYMENT'))); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('shopping'); require_lang('catalogues'); require_code('shopping'); require_code('feedback'); require_lang('ecommerce'); require_code('ecommerce'); if (get_forum_type() != 'ocf') { warn_exit(do_lang_tempcode('NO_OCF')); } // Kill switch if (ecommerce_test_mode() && !$GLOBALS['IS_ACTUALLY_ADMIN'] && !has_specific_permission(get_member(), 'access_ecommerce_in_test_mode')) { warn_exit(do_lang_tempcode('PURCHASE_DISABLED')); } $GLOBALS['NO_QUERY_LIMIT'] = true; $type = get_param('type', 'misc'); delete_incomplete_orders(); if ($type == 'misc') { return $this->view_shopping_cart(); } if ($type == 'add_item') { return $this->add_item_to_cart(); } if ($type == 'update_cart') { return $this->update_cart(); } if ($type == 'empty_cart') { return $this->empty_cart(); } if ($type == 'pay') { return $this->pay(); } if ($type == 'finish') { return $this->finish(); } if ($type == 'my_orders') { return $this->my_orders(); } if ($type == 'order_det') { return $this->order_det(); } return new ocp_tempcode(); }
/** * Perform a transaction. * * @param ?ID_TEXT The transaction ID (NULL: generate one) * @param SHORT_TEXT Cardholder name * @param SHORT_TEXT Card number * @param SHORT_TEXT Transaction amount * @param SHORT_TEXT Card Expiry date * @param integer Card Issue number * @param SHORT_TEXT Card Start date * @param SHORT_TEXT Card Type * @set "Visa" "Master Card" "Switch" "UK Maestro" "Maestro" "Solo" "Delta" "American Express" "Diners Card" "JCB" * @param SHORT_TEXT Card CV2 number (security number) * @param ?integer The subscription length in the units. (NULL: not a subscription) * @param ?ID_TEXT The length units. (NULL: not a subscription) * @set d w m y * @return array A tuple: success (boolean), trans-id (string), message (string), raw message (string) */ function do_transaction($trans_id, $name, $card_number, $amount, $expiry_date, $issue_number, $start_date, $card_type, $cv2, $length = NULL, $length_units = NULL) { if (is_null($trans_id)) { $trans_id = $this->generate_trans_id(); } $username = $this->_get_username(); $password_2 = get_option('vpn_password'); $digest = md5($trans_id . strval($amount) . get_option('ipn_password')); $options = 'currency=' . get_option('currency') . ',card_type=' . str_replace(',', '', $card_type) . ',digest=' . $digest . ',cv2=' . strval(intval($cv2)); if (ecommerce_test_mode()) { $options .= ',test_status=true'; } if (!is_null($length)) { list($length_units_2, $first_repeat) = $this->_translate_subscription_details($length, $length_units); $options .= ',repeat=' . $first_repeat . '/' . $length_units_2 . '/0/' . $amount; } require_lang('ecommerce'); require_code('xmlrpc'); $result = xml_rpc('https://www.secpay.com:443/secxmlrpc/make_call', 'SECVPN.validateCardFull', array($username, $password_2, $trans_id, get_ip_address(), $name, $card_number, $amount, $expiry_date, $issue_number, $start_date, '', '', '', $options)); $pos_1 = strpos($result, '<value>'); if ($pos_1 === false) { fatal_exit(do_lang('INTERNAL_ERROR')); } $pos_2 = strpos($result, '</value>'); $value = @html_entity_decode(trim(substr($result, $pos_1 + 7, $pos_2 - $pos_1 - 7)), ENT_QUOTES, get_charset()); if (substr($value, 0, 1) == '?') { $value = substr($value, 1); } $_map = explode('&', $value); $map = array(); foreach ($_map as $x) { $explode = explode('=', $x); if (count($explode) == 2) { $map[$explode[0]] = $explode[1]; } } $success = array_key_exists('code', $map) && ($map['code'] == 'A' || $map['code'] == 'P:P'); $message_raw = array_key_exists('message', $map) ? $map['message'] : ''; $message = $success ? do_lang('ACCEPTED_MESSAGE', $message_raw) : do_lang('DECLINED_MESSAGE', $message_raw); $purchase_id = post_param_integer('customfld1', '-1'); if (addon_installed('shopping')) { $this->store_shipping_address($purchase_id); } return array($success, $trans_id, $message, $message_raw); }
/** * Standard modular run function. * * @return tempcode The result of execution. */ function run() { require_lang('ecommerce'); require_code('ecommerce'); require_css('ecommerce'); // Kill switch if (ecommerce_test_mode() && !$GLOBALS['IS_ACTUALLY_ADMIN'] && !has_specific_permission(get_member(), 'access_ecommerce_in_test_mode')) { warn_exit(do_lang_tempcode('PURCHASE_DISABLED')); } if (is_guest()) { access_denied('NOT_AS_GUEST'); } $type = get_param('type', 'misc'); if ($type == 'misc') { return $this->my(); } if ($type == 'cancel') { return $this->cancel(); } return new ocp_tempcode(); }
/** * Make a subscription (payment) button. * * @param ID_TEXT The product codename. * @param SHORT_TEXT The human-readable product title. * @param AUTO_LINK The purchase ID. * @param float A transaction amount. * @param integer The subscription length in the units. * @param ID_TEXT The length units. * @set d w m y * @param ID_TEXT The currency to use. * @return tempcode The button */ function make_subscription_button($product, $item_name, $purchase_id, $amount, $length, $length_units, $currency) { $username = $this->_get_username(); $ipn_url = $this->get_ipn_url(); $trans_id = $this->generate_trans_id(); $length_units_2 = '1'; $first_repeat = time(); switch ($length_units) { case 'd': $length_units_2 = '1'; $first_repeat = 60 * 60 * 24 * $length; break; case 'w': $length_units_2 = '2'; $first_repeat = 60 * 60 * 24 * 7 * $length; break; case 'm': $length_units_2 = '3'; $first_repeat = 60 * 60 * 24 * 31 * $length; break; case 'y': $length_units_2 = '4'; $first_repeat = 60 * 60 * 24 * 365 * $length; break; } $digest = md5(get_option('ipn_digest') . ':' . $trans_id . ':' . float_to_raw_string($amount) . ':' . $currency . $length_units_2 . strval($length)); $GLOBALS['SITE_DB']->query_insert('trans_expecting', array('id' => $trans_id, 'e_purchase_id' => $purchase_id, 'e_item_name' => $item_name, 'e_member_id' => get_member(), 'e_amount' => float_to_raw_string($amount), 'e_ip_address' => get_ip_address(), 'e_session_id' => get_session_id(), 'e_time' => time(), 'e_length' => NULL, 'e_length_units' => '')); return do_template('ECOM_SUBSCRIPTION_BUTTON_VIA_WORLDPAY', array('_GUID' => '1f88716137762a467edbf5fbb980c6fe', 'PRODUCT' => $product, 'DIGEST' => $digest, 'TEST' => ecommerce_test_mode(), 'LENGTH' => strval($length), 'LENGTH_UNITS_2' => $length_units_2, 'ITEM_NAME' => $item_name, 'PURCHASE_ID' => strval($trans_id), 'AMOUNT' => float_to_raw_string($amount), 'FIRST_REPEAT' => date('Y-m-d', $first_repeat), 'CURRENCY' => $currency, 'USERNAME' => $username, 'IPN_URL' => $ipn_url)); }
/** * Payment step. * * @param tempcode The page title. * @return tempcode The result of execution. */ function pay($title) { $product = get_param('product'); $object = find_product($product); if (method_exists($object, 'is_available') && !$object->is_available($product, get_member())) { warn_exit(do_lang_tempcode('PRODUCT_UNAVAILABLE')); } $temp = $object->get_products(true, $product); $price = $temp[$product][1]; $item_name = $temp[$product][4]; if (method_exists($object, 'set_needed_fields')) { $purchase_id = $object->set_needed_fields($product); } else { $purchase_id = strval(get_member()); } if ($temp[$product][0] == PRODUCT_SUBSCRIPTION) { $_purchase_id = $GLOBALS['SITE_DB']->query_value_null_ok('subscriptions', 'id', array('s_type_code' => $product, 's_member_id' => get_member(), 's_state' => 'new')); if (is_null($_purchase_id)) { $purchase_id = strval($GLOBALS['SITE_DB']->query_insert('subscriptions', array('s_type_code' => $product, 's_member_id' => get_member(), 's_state' => 'new', 's_amount' => $temp[$product][1], 's_special' => $purchase_id, 's_time' => time(), 's_auto_fund_source' => '', 's_auto_fund_key' => '', 's_via' => get_option('payment_gateway')), true)); } else { $purchase_id = strval($_purchase_id); } $length = array_key_exists('length', $temp[$product][3]) ? $temp[$product][3]['length'] : 1; $length_units = array_key_exists('length_units', $temp[$product][3]) ? $temp[$product][3]['length_units'] : 'm'; } else { $length = NULL; $length_units = ''; //Add cataloue item order to shopping_orders if (method_exists($object, 'add_purchase_order')) { $purchase_id = strval($object->add_purchase_order($product, $temp[$product])); } } breadcrumb_set_parents(array(array('_SELF:_SELF:misc', do_lang_tempcode('PURCHASING')))); if ($price == '0') { $payment_status = 'Completed'; $reason_code = ''; $pending_reason = ''; $mc_currency = get_option('currency'); $txn_id = 'manual-' . substr(uniqid('', true), 0, 10); $parent_txn_id = ''; $memo = 'Free'; $mc_gross = ''; handle_confirmed_transaction($purchase_id, $item_name, $payment_status, $reason_code, $pending_reason, $memo, $mc_gross, $mc_currency, $txn_id, $parent_txn_id); return inform_screen($title, do_lang_tempcode('FREE_PURCHASE')); } if (!array_key_exists(4, $temp[$product])) { $item_name = do_lang('CUSTOM_PRODUCT_' . $product, NULL, NULL, NULL, get_site_default_lang()); } if (!perform_local_payment()) { if ($temp[$product][0] == PRODUCT_SUBSCRIPTION) { $transaction_button = make_subscription_button($product, $item_name, $purchase_id, floatval($price), $length, $length_units, get_option('currency')); } else { $transaction_button = make_transaction_button($product, $item_name, $purchase_id, floatval($price), get_option('currency')); } $tpl = $temp[$product][0] == PRODUCT_SUBSCRIPTION ? 'PURCHASE_WIZARD_STAGE_SUBSCRIBE' : 'PURCHASE_WIZARD_STAGE_PAY'; $logos = method_exists($object, 'get_logos') ? $object->get_logos() : new ocp_tempcode(); $result = do_template($tpl, array('LOGOS' => $logos, 'TRANSACTION_BUTTON' => $transaction_button, 'CURRENCY' => get_option('currency'), 'ITEM_NAME' => $item_name, 'TITLE' => $title, 'LENGTH' => is_null($length) ? '' : strval($length), 'LENGTH_UNITS' => $length_units, 'PURCHASE_ID' => $purchase_id, 'PRICE' => float_to_raw_string(floatval($price)))); } else { if (!tacit_https() && !ecommerce_test_mode()) { warn_exit(do_lang_tempcode('NO_SSL_SETUP')); } $fields = get_transaction_form_fields(NULL, $purchase_id, $item_name, float_to_raw_string($price), $temp[$product][0] == PRODUCT_SUBSCRIPTION ? intval($length) : NULL, $temp[$product][0] == PRODUCT_SUBSCRIPTION ? $length_units : ''); /*$via = get_option('payment_gateway'); require_code('hooks/systems/ecommerce_via/'.filter_naughty_harsh($via)); $object = object_factory('Hook_'.$via); $ipn_url = $object->get_ipn_url();*/ $finish_url = build_url(array('page' => '_SELF', 'type' => 'finish'), '_SELF'); $result = do_template('PURCHASE_WIZARD_STAGE_TRANSACT', array('_GUID' => '15cbba9733f6ff8610968418d8ab527e', 'FIELDS' => $fields)); return $this->wrap($result, $title, $finish_url); } return $this->wrap($result, $title, NULL); }
/** * Handle IPN's. The function may produce output, which would be returned to the Payment Gateway. The function may do transaction verification. * * @return array A long tuple of collected data. */ function handle_transaction() { if (file_exists(get_file_base() . '/data_custom/ecommerce.log') && is_writable_wrap(get_file_base() . '/data_custom/ecommerce.log')) { $myfile = fopen(get_file_base() . '/data_custom/ecommerce.log', 'at'); fwrite($myfile, serialize($_POST) . chr(10)); fclose($myfile); } // assign posted variables to local variables $purchase_id = post_param_integer('custom', '-1'); $txn_type = post_param('txn_type', NULL); if ($txn_type == 'cart') { require_lang('shopping'); $item_name = do_lang('CART_ORDER', $purchase_id); } else { $item_name = substr(post_param('txn_type', ''), 0, 6) == 'subscr' ? '' : post_param('item_name', ''); } $payment_status = post_param('payment_status', ''); // May be blank for subscription $reason_code = post_param('reason_code', ''); $pending_reason = post_param('pending_reason', ''); $memo = post_param('memo', ''); $mc_gross = post_param('mc_gross', ''); // May be blank for subscription $tax = post_param('tax', ''); if ($tax != '' && intval($tax) > 0 && $mc_gross != '') { $mc_gross = float_to_raw_string(floatval($mc_gross) - floatval($tax)); } $mc_currency = post_param('mc_currency', ''); // May be blank for subscription $txn_id = post_param('txn_id', ''); // May be blank for subscription $parent_txn_id = post_param('parent_txn_id', '-1'); $receiver_email = post_param('receiver_email'); // post back to PayPal system to validate if (!ecommerce_test_mode()) { require_code('files'); $pure_post = isset($GLOBALS['PURE_POST']) ? $GLOBALS['PURE_POST'] : $_POST; $x = 0; $res = mixed(); do { $res = http_download_file('http://' . (ecommerce_test_mode() ? 'www.sandbox.paypal.com' : 'www.paypal.com') . '/cgi-bin/webscr', NULL, false, false, 'ocPortal', $pure_post + array('cmd' => '_notify-validate')); $x++; } while (is_null($res) && $x < 3); if (is_null($res)) { my_exit(do_lang('IPN_SOCKET_ERROR')); } if (!(strcmp($res, 'VERIFIED') == 0)) { if (post_param('txn_type', '') == 'send_money') { exit('Unexpected'); } // PayPal has been seen to mess up on send_money transactions, making the IPN unverifiable my_exit(do_lang('IPN_UNVERIFIED') . ' - ' . $res . ' - ' . flatten_slashed_array($pure_post), strpos($res, '<html') !== false); } } $txn_type = str_replace('-', '_', post_param('txn_type')); if ($txn_type == 'subscr-modify') { $payment_status = 'SModified'; $txn_id = post_param('subscr_id') . '-m'; } elseif ($txn_type == 'subscr_signup') { $payment_status = 'Completed'; $mc_gross = post_param('mc_amount3'); if (post_param_integer('recurring') != 1) { my_exit(do_lang('IPN_SUB_RECURRING_WRONG')); } $txn_id = post_param('subscr_id'); } elseif ($txn_type == 'subscr_eot' || $txn_type == 'recurring_payment_suspended_due_to_max_failed_payment') { $payment_status = 'SCancelled'; $txn_id = post_param('subscr_id') . '-c'; } elseif ($txn_type == 'subscr_payment' || $txn_type == 'subscr_failed' || $txn_type == 'subscr_cancel') { exit; } $primary_paypal_email = get_value('primary_paypal_email'); if (!is_null($primary_paypal_email)) { if ($receiver_email != $primary_paypal_email) { my_exit(do_lang('IPN_EMAIL_ERROR')); } } else { if ($receiver_email != $this->_get_payment_address()) { my_exit(do_lang('IPN_EMAIL_ERROR')); } } if (addon_installed('shopping')) { $this->store_shipping_address($purchase_id); } return array($purchase_id, $item_name, $payment_status, $reason_code, $pending_reason, $memo, $mc_gross, $mc_currency, $txn_id, $parent_txn_id); }
/** * Find a transaction fee from a transaction amount. Regular fees aren't taken into account. * * @param ?ID_TEXT The transaction ID (NULL: auto-generate) * @param ID_TEXT The purchase ID * @param SHORT_TEXT The item name * @param SHORT_TEXT The amount * @param ?integer The length (NULL: not a subscription) * @param ID_TEXT The length units * @return array A pair: The form fields, Hidden fields */ function get_transaction_form_fields($trans_id, $purchase_id, $item_name, $amount, $length, $length_units) { if (is_null($trans_id)) { $via = get_option('payment_gateway'); require_code('hooks/systems/ecommerce_via/' . filter_naughty_harsh($via)); $object = object_factory('Hook_' . $via); if (!method_exists($object, 'do_transaction')) { warn_exit(do_lang_tempcode('LOCAL_PAYMENT_NOT_SUPPORTED', escape_html($via))); } $trans_id = $object->generate_trans_id(); } $GLOBALS['SITE_DB']->query_insert('trans_expecting', array('id' => $trans_id, 'e_purchase_id' => $purchase_id, 'e_item_name' => $item_name, 'e_amount' => $amount, 'e_member_id' => get_member(), 'e_ip_address' => get_ip_address(), 'e_session_id' => get_session_id(), 'e_time' => time(), 'e_length' => $length, 'e_length_units' => $length_units)); require_code('form_templates'); $fields = new ocp_tempcode(); $hidden = new ocp_tempcode(); $fields->attach(form_input_line(do_lang_tempcode('CARDHOLDER_NAME'), do_lang_tempcode('DESCRIPTION_CARDHOLDER_NAME'), 'name', ecommerce_test_mode() ? $GLOBALS['FORUM_DRIVER']->get_username(get_member()) : get_ocp_cpf('TODO'), true)); $fields->attach(form_input_list(do_lang_tempcode('CARD_TYPE'), '', 'card_type', $object->nice_get_card_types(ecommerce_test_mode() ? 'Visa' : get_ocp_cpf('payment_type')))); $fields->attach(form_input_line(do_lang_tempcode('CARD_NUMBER'), do_lang_tempcode('DESCRIPTION_CARD_NUMBER'), 'card_number', ecommerce_test_mode() ? '4444333322221111' : get_ocp_cpf('payment_card_number'), true)); $fields->attach(form_input_line(do_lang_tempcode('CARD_START_DATE'), do_lang_tempcode('DESCRIPTION_CARD_START_DATE'), 'start_date', ecommerce_test_mode() ? date('m/y', utctime_to_usertime(time() - 60 * 60 * 24 * 365)) : get_ocp_cpf('payment_card_start_date'), true)); $fields->attach(form_input_line(do_lang_tempcode('CARD_EXPIRY_DATE'), do_lang_tempcode('DESCRIPTION_CARD_EXPIRY_DATE'), 'expiry_date', ecommerce_test_mode() ? date('m/y', utctime_to_usertime(time() + 60 * 60 * 24 * 365)) : get_ocp_cpf('payment_card_expiry_date'), true)); $fields->attach(form_input_integer(do_lang_tempcode('CARD_ISSUE_NUMBER'), do_lang_tempcode('DESCRIPTION_CARD_ISSUE_NUMBER'), 'issue_number', intval(get_ocp_cpf('payment_card_issue_number')), false)); $fields->attach(form_input_line(do_lang_tempcode('CARD_CV2'), do_lang_tempcode('DESCRIPTION_CARD_CV2'), 'cv2', ecommerce_test_mode() ? '123' : get_ocp_cpf('payment_card_cv2'), true)); // Shipping address fields $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_firstname'), '', 'first_name', get_ocp_cpf('firstname'), true)); $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_lastname'), '', 'last_name', get_ocp_cpf('last_name'), true)); $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_building_name_or_number'), '', 'address1', get_ocp_cpf('building_name_or_number'), true)); $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_city'), '', 'city', get_ocp_cpf('city'), true)); $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_state'), '', 'zip', get_ocp_cpf('state'), true)); $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_post_code'), '', 'zip', get_ocp_cpf('post_code'), true)); $fields->attach(form_input_line(do_lang_tempcode('SPECIAL_CPF__ocp_country'), '', 'country', get_ocp_cpf('country'), true)); $hidden->attach(form_input_hidden('trans_id', $trans_id)); // Set purchase ID as hidden form field to get back after transaction $hidden->attach(form_input_hidden('customfld1', $purchase_id)); return array($fields, $hidden); }