PageRenderTime 34ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/plugins/wp-e-commerce/wpsc-merchants/paypal-standard.merchant.php

https://github.com/AaronFernandes/aquestionof
PHP | 699 lines | 549 code | 68 blank | 82 comment | 48 complexity | 7219a1d87247ee92ebd9d985cddf321d MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
  1. <?php
  2. /**
  3. * This is the PayPal Payments Standard 2.0 Gateway.
  4. * It uses the wpsc_merchant class as a base class which is handy for collating user details and cart contents.
  5. */
  6. /*
  7. * This is the gateway variable $nzshpcrt_gateways, it is used for displaying gateway information on the wp-admin pages and also
  8. * for internal operations.
  9. */
  10. $nzshpcrt_gateways[$num] = array(
  11. 'name' => 'PayPal Payments Standard 2.0',
  12. 'api_version' => 2.0,
  13. 'image' => WPSC_URL . '/images/paypal.gif',
  14. 'class_name' => 'wpsc_merchant_paypal_standard',
  15. 'has_recurring_billing' => true,
  16. 'wp_admin_cannot_cancel' => true,
  17. 'display_name' => 'PayPal Payments Standard',
  18. 'requirements' => array(
  19. /// so that you can restrict merchant modules to PHP 5, if you use PHP 5 features
  20. 'php_version' => 4.3,
  21. /// for modules that may not be present, like curl
  22. 'extra_modules' => array()
  23. ),
  24. // this may be legacy, not yet decided
  25. 'internalname' => 'wpsc_merchant_paypal_standard',
  26. // All array members below here are legacy, and use the code in paypal_multiple.php
  27. 'form' => 'form_paypal_multiple',
  28. 'submit_function' => 'submit_paypal_multiple',
  29. 'payment_type' => 'paypal',
  30. 'supported_currencies' => array(
  31. 'currency_list' => array('AUD', 'BRL', 'CAD', 'CHF', 'CZK', 'DKK', 'EUR', 'GBP', 'HKD', 'HUF', 'ILS', 'JPY', 'MXN', 'MYR', 'NOK', 'NZD', 'PHP', 'PLN', 'SEK', 'SGD', 'THB', 'TWD', 'USD'),
  32. 'option_name' => 'paypal_curcode'
  33. )
  34. );
  35. /**
  36. * WP eCommerce PayPal Standard Merchant Class
  37. *
  38. * This is the paypal standard merchant class, it extends the base merchant class
  39. *
  40. * @package wp-e-commerce
  41. * @since 3.7.6
  42. * @subpackage wpsc-merchants
  43. */
  44. class wpsc_merchant_paypal_standard extends wpsc_merchant {
  45. var $name = 'PayPal Payments Standard';
  46. var $paypal_ipn_values = array();
  47. /**
  48. * construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
  49. * @access public
  50. */
  51. function construct_value_array() {
  52. $this->collected_gateway_data = $this->_construct_value_array();
  53. }
  54. /**
  55. * construct value array method, converts the data gathered by the base class code to something acceptable to the gateway
  56. * @access private
  57. * @param boolean $aggregate Whether to aggregate the cart data or not. Defaults to false.
  58. * @return array $paypal_vars The paypal vars
  59. */
  60. function _construct_value_array($aggregate = false) {
  61. global $wpdb;
  62. $paypal_vars = array();
  63. $add_tax = true;
  64. if(get_option('wpec_taxes_inprice') == 'inclusive')
  65. $add_tax = false;
  66. // Store settings to be sent to paypal
  67. $paypal_vars += array(
  68. 'business' => get_option('paypal_multiple_business'),
  69. 'return' => add_query_arg('sessionid', $this->cart_data['session_id'], $this->cart_data['transaction_results_url']),
  70. 'cancel_return' => $this->cart_data['transaction_results_url'],
  71. 'rm' => '2',
  72. 'currency_code' => $this->cart_data['store_currency'],
  73. 'lc' => $this->cart_data['store_currency'],
  74. 'bn' => $this->cart_data['software_name'],
  75. 'no_note' => '1',
  76. 'charset' => 'utf-8',
  77. );
  78. // IPN data
  79. if (get_option('paypal_ipn') == 1) {
  80. $notify_url = $this->cart_data['notification_url'];
  81. $notify_url = add_query_arg('gateway', 'wpsc_merchant_paypal_standard', $notify_url);
  82. $notify_url = apply_filters('wpsc_paypal_standard_notify_url', $notify_url);
  83. $paypal_vars += array(
  84. 'notify_url' => $notify_url,
  85. );
  86. }
  87. // Shipping
  88. if ((bool) get_option('paypal_ship')) {
  89. $paypal_vars += array(
  90. 'address_override' => '1',
  91. 'no_shipping' => '0',
  92. );
  93. }
  94. // Customer details
  95. $paypal_vars += array(
  96. 'email' => $this->cart_data['email_address'],
  97. 'first_name' => $this->cart_data['shipping_address']['first_name'],
  98. 'last_name' => $this->cart_data['shipping_address']['last_name'],
  99. 'address1' => $this->cart_data['shipping_address']['address'],
  100. 'city' => $this->cart_data['shipping_address']['city'],
  101. 'country' => $this->cart_data['shipping_address']['country'],
  102. 'zip' => $this->cart_data['shipping_address']['post_code'],
  103. );
  104. if ($this->cart_data['shipping_address']['state'] != '') {
  105. $paypal_vars += array(
  106. 'state' => $this->cart_data['shipping_address']['state'],
  107. );
  108. }
  109. // Order settings to be sent to paypal
  110. $paypal_vars += array(
  111. 'invoice' => $this->cart_data['session_id']
  112. );
  113. // Two cases:
  114. // - We're dealing with a subscription
  115. // - We're dealing with a normal cart
  116. if ($this->cart_data['is_subscription']) {
  117. $paypal_vars += array(
  118. 'cmd'=> '_xclick-subscriptions',
  119. );
  120. $reprocessed_cart_data['shopping_cart'] = array(
  121. 'is_used' => false,
  122. 'price' => 0,
  123. 'length' => 1,
  124. 'unit' => 'd',
  125. 'times_to_rebill' => 1,
  126. );
  127. $reprocessed_cart_data['subscription'] = array(
  128. 'is_used' => false,
  129. 'price' => 0,
  130. 'length' => 1,
  131. 'unit' => 'D',
  132. 'times_to_rebill' => 1,
  133. );
  134. foreach ($this->cart_items as $cart_row) {
  135. if ($cart_row['is_recurring']) {
  136. $reprocessed_cart_data['subscription']['is_used'] = true;
  137. $reprocessed_cart_data['subscription']['price'] = $cart_row['price'];
  138. $reprocessed_cart_data['subscription']['length'] = $cart_row['recurring_data']['rebill_interval']['length'];
  139. $reprocessed_cart_data['subscription']['unit'] = strtoupper($cart_row['recurring_data']['rebill_interval']['unit']);
  140. $reprocessed_cart_data['subscription']['times_to_rebill'] = $cart_row['recurring_data']['times_to_rebill'];
  141. } else {
  142. $item_cost = ($cart_row['price'] + $cart_row['shipping'] + $cart_row['tax']) * $cart_row['quantity'];
  143. if ($item_cost > 0) {
  144. $reprocessed_cart_data['shopping_cart']['price'] += $item_cost;
  145. $reprocessed_cart_data['shopping_cart']['is_used'] = true;
  146. }
  147. }
  148. $paypal_vars += array(
  149. 'item_name' => __('Your Subscription', 'wpsc'),
  150. // I fail to see the point of sending a subscription to paypal as a subscription
  151. // if it does not recur, if (src == 0) then (this == underfeatured waste of time)
  152. 'src' => '1'
  153. );
  154. // This can be false, we don't need to have additional items in the cart/
  155. if ($reprocessed_cart_data['shopping_cart']['is_used']) {
  156. $paypal_vars += array(
  157. "a1" => $this->format_price($reprocessed_cart_data['shopping_cart']['price']),
  158. "p1" => $reprocessed_cart_data['shopping_cart']['length'],
  159. "t1" => $reprocessed_cart_data['shopping_cart']['unit'],
  160. );
  161. }
  162. // We need at least one subscription product,
  163. // If this is not true, something is rather wrong.
  164. if ($reprocessed_cart_data['subscription']['is_used']) {
  165. $paypal_vars += array(
  166. "a3" => $this->format_price($reprocessed_cart_data['subscription']['price']),
  167. "p3" => $reprocessed_cart_data['subscription']['length'],
  168. "t3" => $reprocessed_cart_data['subscription']['unit'],
  169. );
  170. // If the srt value for the number of times to rebill is not greater than 1,
  171. // paypal won't accept the transaction.
  172. if ($reprocessed_cart_data['subscription']['times_to_rebill'] > 1) {
  173. $paypal_vars += array(
  174. 'srt' => $reprocessed_cart_data['subscription']['times_to_rebill'],
  175. );
  176. }
  177. }
  178. } // end foreach cart item
  179. } else {
  180. $paypal_vars += array(
  181. 'upload' => '1',
  182. 'cmd' => '_ext-enter',
  183. 'redirect_cmd' => '_cart',
  184. );
  185. $handling = $this->cart_data['base_shipping'];
  186. if($add_tax)
  187. $handling += $this->cart_data['cart_tax'];
  188. // Set base shipping
  189. $paypal_vars += array(
  190. 'handling_cart' => $handling
  191. );
  192. // Stick the cart item values together here
  193. $i = 1;
  194. if (!$this->cart_data['has_discounts'] && !$aggregate) {
  195. foreach ($this->cart_items as $cart_row) {
  196. $paypal_vars += array(
  197. "item_name_$i" => $cart_row['name'],
  198. "amount_$i" => $this->format_price($cart_row['price']),
  199. "tax_$i" => ($add_tax) ? $this->format_price($cart_row['tax']) : 0,
  200. "quantity_$i" => $cart_row['quantity'],
  201. "item_number_$i" => $cart_row['product_id'],
  202. // additional shipping for the the (first item / total of the items)
  203. "shipping_$i" => $this->format_price($cart_row['shipping']/$cart_row['quantity']),
  204. // additional shipping beyond the first item
  205. "shipping2_$i" => $this->format_price($cart_row['shipping']/$cart_row['quantity']),
  206. "handling_$i" => '',
  207. );
  208. ++$i;
  209. }
  210. } else {
  211. // Work out discounts where applicable
  212. $currency_code = $wpdb->get_var("
  213. SELECT `code`
  214. FROM `".WPSC_TABLE_CURRENCY_LIST."`
  215. WHERE `id`='".get_option('currency_type')."'
  216. LIMIT 1
  217. ");
  218. $local_currency_code = $currency_code;
  219. $paypal_currency_code = get_option('paypal_curcode', 'USD');
  220. if ($paypal_currency_code != $local_currency_code) {
  221. $curr = new CURRENCYCONVERTER();
  222. $paypal_currency_productprice = $curr->convert(
  223. $this->cart_data['total_price'],
  224. $paypal_currency_code,
  225. $local_currency_code
  226. );
  227. } else {
  228. $paypal_currency_productprice = $this->cart_data['total_price'];
  229. }
  230. $paypal_vars['item_name_'.$i] = "Your Shopping Cart";
  231. $paypal_vars['amount_'.$i] = ($this->format_price(
  232. $paypal_currency_productprice,
  233. $local_currency_code
  234. )-$paypal_vars['handling_cart']);
  235. $paypal_vars['quantity_'.$i] = 1;
  236. $paypal_vars['shipping_'.$i] = 0;
  237. $paypal_vars['shipping2_'.$i] = 0;
  238. $paypal_vars['handling_'.$i] = 0;
  239. }
  240. }
  241. return $paypal_vars;
  242. }
  243. /**
  244. * submit method, sends the received data to the payment gateway
  245. * @access public
  246. */
  247. function submit() {
  248. $name_value_pairs = array();
  249. foreach ($this->collected_gateway_data as $key => $value) {
  250. $name_value_pairs[] = $key . '=' . urlencode($value);
  251. }
  252. $gateway_values = implode('&', $name_value_pairs);
  253. $redirect = get_option('paypal_multiple_url')."?".$gateway_values;
  254. // URLs up to 2083 characters long are short enough for an HTTP GET in all browsers.
  255. // Longer URLs require us to send aggregate cart data to PayPal short of losing data.
  256. // An exception is made for recurring transactions, since there isn't much we can do.
  257. if (strlen($redirect) > 2083 && !$this->cart_data['is_subscription']) {
  258. $name_value_pairs = array();
  259. foreach($this->_construct_value_array(true) as $key => $value) {
  260. $name_value_pairs[]= $key . '=' . urlencode($value);
  261. }
  262. $gateway_values = implode('&', $name_value_pairs);
  263. $redirect = get_option('paypal_multiple_url')."?".$gateway_values;
  264. }
  265. if (defined('WPSC_ADD_DEBUG_PAGE') && WPSC_ADD_DEBUG_PAGE) {
  266. echo "<a href='".esc_url($redirect)."'>Test the URL here</a>";
  267. echo "<pre>".print_r($this->collected_gateway_data,true)."</pre>";
  268. exit();
  269. } else {
  270. wp_redirect($redirect);
  271. exit();
  272. }
  273. }
  274. /**
  275. * parse_gateway_notification method, receives data from the payment gateway
  276. * @access private
  277. */
  278. function parse_gateway_notification() {
  279. /// PayPal first expects the IPN variables to be returned to it within 30 seconds, so we do this first.
  280. $paypal_url = get_option('paypal_multiple_url');
  281. $received_values = array();
  282. $received_values['cmd'] = '_notify-validate';
  283. $received_values += $_POST;
  284. $options = array(
  285. 'timeout' => 5,
  286. 'body' => $received_values,
  287. 'user-agent' => ('WP e-Commerce/'.WPSC_PRESENTABLE_VERSION)
  288. );
  289. $response = wp_remote_post($paypal_url, $options);
  290. if( 'VERIFIED' == $response['body'] ) {
  291. $this->paypal_ipn_values = $received_values;
  292. $this->session_id = $received_values['invoice'];
  293. $this->set_purchase_processed_by_sessionid(3);
  294. } else {
  295. exit("IPN Request Failure");
  296. }
  297. }
  298. /**
  299. * process_gateway_notification method, receives data from the payment gateway
  300. * @access public
  301. */
  302. function process_gateway_notification() {
  303. // Compare the received store owner email address to the set one
  304. if(strtolower($this->paypal_ipn_values['receiver_email']) == strtolower(get_option('paypal_multiple_business'))) {
  305. switch($this->paypal_ipn_values['txn_type']) {
  306. case 'cart':
  307. case 'express_checkout':
  308. if((float)$this->paypal_ipn_values['mc_gross'] == (float)$this->cart_data['total_price']) {
  309. $this->set_transaction_details($this->paypal_ipn_values['txn_id'], 3);
  310. transaction_results($this->cart_data['session_id'],false);
  311. }
  312. break;
  313. case 'subscr_signup':
  314. case 'subscr_payment':
  315. $this->set_transaction_details($this->paypal_ipn_values['subscr_id'], 3);
  316. foreach($this->cart_items as $cart_row) {
  317. if($cart_row['is_recurring'] == true) {
  318. do_action('wpsc_activate_subscription', $cart_row['cart_item_id'], $this->paypal_ipn_values['subscr_id']);
  319. }
  320. }
  321. transaction_results($this->cart_data['session_id'],false);
  322. break;
  323. case 'subscr_cancel':
  324. case 'subscr_eot':
  325. case 'subscr_failed':
  326. foreach($this->cart_items as $cart_row) {
  327. $altered_count = 0;
  328. if((bool)$cart_row['is_recurring'] == true) {
  329. $altered_count++;
  330. wpsc_update_cartmeta($cart_row['cart_item_id'], 'is_subscribed', 0);
  331. }
  332. }
  333. break;
  334. default:
  335. break;
  336. }
  337. }
  338. $message = "
  339. {$this->paypal_ipn_values['receiver_email']} => ".get_option('paypal_multiple_business')."
  340. {$this->paypal_ipn_values['txn_type']}
  341. {$this->paypal_ipn_values['mc_gross']} => {$this->cart_data['total_price']}
  342. {$this->paypal_ipn_values['txn_id']}
  343. ".print_r($this->cart_items, true)."
  344. {$altered_count}
  345. ";
  346. }
  347. function format_price($price, $paypal_currency_code = null) {
  348. if (!isset($paypal_currency_code)) {
  349. $paypal_currency_code = get_option('paypal_curcode');
  350. }
  351. switch($paypal_currency_code) {
  352. case "JPY":
  353. $decimal_places = 0;
  354. break;
  355. case "HUF":
  356. $decimal_places = 0;
  357. default:
  358. $decimal_places = 2;
  359. break;
  360. }
  361. $price = number_format(sprintf("%01.2f",$price),$decimal_places,'.','');
  362. return $price;
  363. }
  364. }
  365. /**
  366. * submit_paypal_multiple function.
  367. *
  368. * Use this for now, but it will eventually be replaced with a better form API for gateways
  369. * @access public
  370. * @return void
  371. */
  372. function submit_paypal_multiple(){
  373. if(isset($_POST['paypal_multiple_business'])) {
  374. update_option('paypal_multiple_business', $_POST['paypal_multiple_business']);
  375. }
  376. if(isset($_POST['paypal_multiple_url'])) {
  377. update_option('paypal_multiple_url', $_POST['paypal_multiple_url']);
  378. }
  379. if(isset($_POST['paypal_curcode'])) {
  380. update_option('paypal_curcode', $_POST['paypal_curcode']);
  381. }
  382. if(isset($_POST['paypal_curcode'])) {
  383. update_option('paypal_curcode', $_POST['paypal_curcode']);
  384. }
  385. if(isset($_POST['paypal_ipn'])) {
  386. update_option('paypal_ipn', (int)$_POST['paypal_ipn']);
  387. }
  388. if(isset($_POST['address_override'])) {
  389. update_option('address_override', (int)$_POST['address_override']);
  390. }
  391. if(isset($_POST['paypal_ship'])) {
  392. update_option('paypal_ship', (int)$_POST['paypal_ship']);
  393. }
  394. if (!isset($_POST['paypal_form'])) $_POST['paypal_form'] = array();
  395. foreach((array)$_POST['paypal_form'] as $form => $value) {
  396. update_option(('paypal_form_'.$form), $value);
  397. }
  398. return true;
  399. }
  400. /**
  401. * form_paypal_multiple function.
  402. *
  403. * Use this for now, but it will eventually be replaced with a better form API for gateways
  404. * @access public
  405. * @return void
  406. */
  407. function form_paypal_multiple() {
  408. global $wpdb, $wpsc_gateways;
  409. $output = "
  410. <tr>
  411. <td>Username:
  412. </td>
  413. <td>
  414. <input type='text' size='40' value='".get_option('paypal_multiple_business')."' name='paypal_multiple_business' />
  415. </td>
  416. </tr>
  417. <tr>
  418. <td>Url:
  419. </td>
  420. <td>
  421. <input type='text' size='40' value='".get_option('paypal_multiple_url')."' name='paypal_multiple_url' /> <br />
  422. </td>
  423. </tr>
  424. ";
  425. $paypal_ipn = get_option('paypal_ipn');
  426. $paypal_ipn1 = "";
  427. $paypal_ipn2 = "";
  428. switch($paypal_ipn) {
  429. case 0:
  430. $paypal_ipn2 = "checked ='checked'";
  431. break;
  432. case 1:
  433. $paypal_ipn1 = "checked ='checked'";
  434. break;
  435. }
  436. $paypal_ship = get_option('paypal_ship');
  437. $paypal_ship1 = "";
  438. $paypal_ship2 = "";
  439. switch($paypal_ship){
  440. case 1:
  441. $paypal_ship1 = "checked='checked'";
  442. break;
  443. case 0:
  444. default:
  445. $paypal_ship2 = "checked='checked'";
  446. break;
  447. }
  448. $address_override = get_option('address_override');
  449. $address_override1 = "";
  450. $address_override2 = "";
  451. switch($address_override) {
  452. case 1:
  453. $address_override1 = "checked ='checked'";
  454. break;
  455. case 0:
  456. default:
  457. $address_override2 = "checked ='checked'";
  458. break;
  459. }
  460. $output .= "
  461. <tr>
  462. <td>IPN :
  463. </td>
  464. <td>
  465. <input type='radio' value='1' name='paypal_ipn' id='paypal_ipn1' ".$paypal_ipn1." /> <label for='paypal_ipn1'>".__('Yes', 'wpsc')."</label> &nbsp;
  466. <input type='radio' value='0' name='paypal_ipn' id='paypal_ipn2' ".$paypal_ipn2." /> <label for='paypal_ipn2'>".__('No', 'wpsc')."</label>
  467. </td>
  468. </tr>
  469. <tr>
  470. <td style='padding-bottom: 0px;'>Send shipping details:
  471. </td>
  472. <td style='padding-bottom: 0px;'>
  473. <input type='radio' value='1' name='paypal_ship' id='paypal_ship1' ".$paypal_ship1." /> <label for='paypal_ship1'>".__('Yes', 'wpsc')."</label> &nbsp;
  474. <input type='radio' value='0' name='paypal_ship' id='paypal_ship2' ".$paypal_ship2." /> <label for='paypal_ship2'>".__('No', 'wpsc')."</label>
  475. </td>
  476. </tr>
  477. <tr>
  478. <td colspan='2'>
  479. <span class='wpscsmall description'>
  480. Note: If your checkout page does not have a shipping details section, or if you don't want to send Paypal shipping information. You should change Send shipping details option to No.</span>
  481. </td>
  482. </tr>
  483. <tr>
  484. <td style='padding-bottom: 0px;'>
  485. Address Override:
  486. </td>
  487. <td style='padding-bottom: 0px;'>
  488. <input type='radio' value='1' name='address_override' id='address_override1' ".$address_override1." /> <label for='address_override1'>".__('Yes', 'wpsc')."</label> &nbsp;
  489. <input type='radio' value='0' name='address_override' id='address_override2' ".$address_override2." /> <label for='address_override2'>".__('No', 'wpsc')."</label>
  490. </td>
  491. </tr>
  492. <tr>
  493. <td colspan='2'>
  494. <span class='wpscsmall description'>
  495. This setting affects your PayPal purchase log. If your customers already have a PayPal account PayPal will try to populate your PayPal Purchase Log with their PayPal address. This setting tries to replace the address in the PayPal purchase log with the Address customers enter on your Checkout page.
  496. </span>
  497. </td>
  498. </tr>\n";
  499. $store_currency_data = $wpdb->get_row("SELECT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `id` IN ('".absint(get_option('currency_type'))."')", ARRAY_A);
  500. $current_currency = get_option('paypal_curcode');
  501. if(($current_currency == '') && in_array($store_currency_data['code'], $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'])) {
  502. update_option('paypal_curcode', $store_currency_data['code']);
  503. $current_currency = $store_currency_data['code'];
  504. }
  505. if($current_currency != $store_currency_data['code']) {
  506. $output .= "
  507. <tr>
  508. <td colspan='2'><strong class='form_group'>".__('Currency Converter')."</td>
  509. </tr>
  510. <tr>
  511. <td colspan='2'>".sprintf(__('Your website uses <strong>%s</strong>. This currency is not supported by PayPal, please select a currency using the drop down menu below. Buyers on your site will still pay in your local currency however we will send the order through to Paypal using the currency you choose below.', 'wpsc'), $store_currency_data['currency'])."</td>
  512. </tr>\n";
  513. $output .= " <tr>\n";
  514. $output .= " <td>Select Currency:</td>\n";
  515. $output .= " <td>\n";
  516. $output .= " <select name='paypal_curcode'>\n";
  517. $paypal_currency_list = $wpsc_gateways['wpsc_merchant_paypal_standard']['supported_currencies']['currency_list'];
  518. $currency_list = $wpdb->get_results("SELECT DISTINCT `code`, `currency` FROM `".WPSC_TABLE_CURRENCY_LIST."` WHERE `code` IN ('".implode("','",$paypal_currency_list)."')", ARRAY_A);
  519. foreach($currency_list as $currency_item) {
  520. $selected_currency = '';
  521. if($current_currency == $currency_item['code']) {
  522. $selected_currency = "selected='selected'";
  523. }
  524. $output .= "<option ".$selected_currency." value='{$currency_item['code']}'>{$currency_item['currency']}</option>";
  525. }
  526. $output .= " </select> \n";
  527. $output .= " </td>\n";
  528. $output .= " </tr>\n";
  529. }
  530. $output .= "
  531. <tr class='update_gateway' >
  532. <td colspan='2'>
  533. <div class='submit'>
  534. <input type='submit' value='".__('Update &raquo;', 'wpsc')."' name='updateoption'/>
  535. </div>
  536. </td>
  537. </tr>
  538. <tr class='firstrowth'>
  539. <td style='border-bottom: medium none;' colspan='2'>
  540. <strong class='form_group'>Forms Sent to Gateway</strong>
  541. </td>
  542. </tr>
  543. <tr>
  544. <td>
  545. First Name Field
  546. </td>
  547. <td>
  548. <select name='paypal_form[first_name]'>
  549. ".nzshpcrt_form_field_list(get_option('paypal_form_first_name'))."
  550. </select>
  551. </td>
  552. </tr>
  553. <tr>
  554. <td>
  555. Last Name Field
  556. </td>
  557. <td>
  558. <select name='paypal_form[last_name]'>
  559. ".nzshpcrt_form_field_list(get_option('paypal_form_last_name'))."
  560. </select>
  561. </td>
  562. </tr>
  563. <tr>
  564. <td>
  565. Address Field
  566. </td>
  567. <td>
  568. <select name='paypal_form[address]'>
  569. ".nzshpcrt_form_field_list(get_option('paypal_form_address'))."
  570. </select>
  571. </td>
  572. </tr>
  573. <tr>
  574. <td>
  575. City Field
  576. </td>
  577. <td>
  578. <select name='paypal_form[city]'>
  579. ".nzshpcrt_form_field_list(get_option('paypal_form_city'))."
  580. </select>
  581. </td>
  582. </tr>
  583. <tr>
  584. <td>
  585. State Field
  586. </td>
  587. <td>
  588. <select name='paypal_form[state]'>
  589. ".nzshpcrt_form_field_list(get_option('paypal_form_state'))."
  590. </select>
  591. </td>
  592. </tr>
  593. <tr>
  594. <td>
  595. Postal code/Zip code Field
  596. </td>
  597. <td>
  598. <select name='paypal_form[post_code]'>
  599. ".nzshpcrt_form_field_list(get_option('paypal_form_post_code'))."
  600. </select>
  601. </td>
  602. </tr>
  603. <tr>
  604. <td>
  605. Country Field
  606. </td>
  607. <td>
  608. <select name='paypal_form[country]'>
  609. ".nzshpcrt_form_field_list(get_option('paypal_form_country'))."
  610. </select>
  611. </td>
  612. </tr> ";
  613. return $output;
  614. }
  615. ?>