paypal_ipn.php
来自「this the oscommerce 3.0 aplha 4」· PHP 代码 · 共 481 行 · 第 1/3 页
PHP
481 行
<?php/* $Id: paypal_ipn.php 1498 2007-03-29 14:04:50Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2006 osCommerce This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v2 (1991) as published by the Free Software Foundation.*//** * The administration side of the PayPal IPN payment module */ class osC_Payment_paypal_ipn extends osC_Payment_Admin {/** * The administrative title of the payment module * * @var string * @access private */ var $_title;/** * The code of the payment module * * @var string * @access private */ var $_code = 'paypal_ipn';/** * The developers name * * @var string * @access private */ var $_author_name = 'osCommerce';/** * The developers address * * @var string * @access private */ var $_author_www = 'http://www.oscommerce.com';/** * The status of the module * * @var boolean * @access private */ var $_status = false;/** * Constructor */ function osC_Payment_paypal_ipn() { global $osC_Language; $this->_title = $osC_Language->get('payment_paypal_ipn_title'); $this->_description = $osC_Language->get('payment_paypal_ipn_description'); $this->_method_title = $osC_Language->get('payment_paypal_ipn_method_title'); $this->_status = (defined('MODULE_PAYMENT_PAYPAL_IPN_STATUS') && (MODULE_PAYMENT_PAYPAL_IPN_STATUS == '1') ? true : false); $this->_sort_order = (defined('MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER') ? MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER : null); if (defined('MODULE_PAYMENT_PAYPAL_IPN_SERVER')) { switch (MODULE_PAYMENT_PAYPAL_IPN_SERVER) { case 'Production': $this->_gateway_server = 'https://api.paypal.com/2.0/'; break; default: $this->_gateway_server = 'https://api.sandbox.paypal.com/2.0/'; break; } } }/** * Checks to see if the module has been installed * * @access public * @return boolean */ function isInstalled() { return (bool)defined('MODULE_PAYMENT_PAYPAL_IPN_STATUS'); }/** * Installs the module * * @access public * @see osC_Payment_Admin::install() */ function install() { global $osC_Database; parent::install(); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Enable PayPal IPN Module', 'MODULE_PAYMENT_PAYPAL_IPN_STATUS', '-1', 'Do you want to accept PayPal IPN payments?', '6', '0', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PayPal E-Mail Address', 'MODULE_PAYMENT_PAYPAL_IPN_ID', '', 'The seller e-mail address to use for accepting PayPal payments.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Username', 'MODULE_PAYMENT_PAYPAL_IPN_API_USERNAME', '', 'The username to use for the PayPal Web Services API.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Password', 'MODULE_PAYMENT_PAYPAL_IPN_API_PASSWORD', '', 'The password to use for the PayPal Web Services API.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('API Certificate', 'MODULE_PAYMENT_PAYPAL_IPN_API_CERTIFICATE', '', 'The location of the PayPal API Certificate for the PayPal Web Services API.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Enable Encrypted Web Payments', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS', '-1', 'Do you want to enable Encrypted Web Payments?', '6', '0', 'osc_cfg_use_get_boolean_value', 'osc_cfg_set_boolean_value(array(1, -1))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Encrypted Web Payments Private Key (Seller)', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY', '', 'The location of your Private Key to use for signing the data. (*.pem)', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Encrypted Web Payments Public Certificate (Seller)', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY', '', 'The location of your Public Certificate to use for signing the data. (*.pem)', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Encrpyted Web Payments Public Certificate (PayPal)', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY', '', 'The location of the PayPal Public Certificate for encrypting the data.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Encrypted Web Payments Public Certificate ID', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID', '', 'The Certificate ID to use from your PayPal Encrypted Payment Settings Profile.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('OpenSSL Location', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL', '/usr/bin/openssl', 'The location of the openssl binary file.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Secret Key', 'MODULE_PAYMENT_PAYPAL_IPN_SECRET_KEY', '', 'A secret key to pass to PayPal (primarly used with Encrypted Web Payments).', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Currency', 'MODULE_PAYMENT_PAYPAL_IPN_CURRENCY', 'Selected Currency', 'The currency to use for credit card transactions', '6', '0', 'osc_cfg_set_boolean_value(array(\'Selected Currency\',\'USD\',\'CAD\',\'EUR\',\'GBP\',\'JPY\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Transaction Server', 'MODULE_PAYMENT_PAYPAL_IPN_SERVER', 'Sandbox', 'The server to perform transactions in.', '6', '0', 'osc_cfg_set_boolean_value(array(\'Production\',\'Sandbox\'))', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Payment Zone', 'MODULE_PAYMENT_PAYPAL_IPN_ZONE', '0', 'If a zone is selected, only enable this payment method for that zone.', '6', '0', 'osc_cfg_use_get_zone_class_title', 'osc_cfg_set_zone_classes_pull_down_menu', now())"); $osC_Database->simpleQuery("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, use_function, date_added) values ('Set Order Status', 'MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID', '0', 'Set the status of orders made with this payment module to this value', '6', '0', 'osc_cfg_set_order_statuses_pull_down_menu', 'osc_cfg_use_get_order_status_title', now())"); }/** * Return the configuration parameter keys in an array * * @access public * @return array */ function getKeys() { if (!isset($this->_keys)) { $this->_keys = array('MODULE_PAYMENT_PAYPAL_IPN_STATUS', 'MODULE_PAYMENT_PAYPAL_IPN_ID', 'MODULE_PAYMENT_PAYPAL_IPN_API_USERNAME', 'MODULE_PAYMENT_PAYPAL_IPN_API_PASSWORD', 'MODULE_PAYMENT_PAYPAL_IPN_API_CERTIFICATE', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_STATUS', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PRIVATE_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PUBLIC_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_PAYPAL_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_CERT_ID', 'MODULE_PAYMENT_PAYPAL_IPN_EWP_OPENSSL', 'MODULE_PAYMENT_PAYPAL_IPN_SECRET_KEY', 'MODULE_PAYMENT_PAYPAL_IPN_CURRENCY', 'MODULE_PAYMENT_PAYPAL_IPN_SERVER', 'MODULE_PAYMENT_PAYPAL_IPN_ORDER_STATUS_ID', 'MODULE_PAYMENT_PAYPAL_IPN_ZONE', 'MODULE_PAYMENT_PAYPAL_IPN_SORT_ORDER'); }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?