diff --git a/vendor/php-payments/.gitkeep b/vendor/php-payments/.gitkeep new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/vendor/php-payments/README.md b/vendor/php-payments/README.md new file mode 100755 index 000000000000..8d2f6a5982d0 --- /dev/null +++ b/vendor/php-payments/README.md @@ -0,0 +1,80 @@ +## This code has taken tons of work. Donations highly appreciated. [Make a Donation](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=TJMWX5E9GXS7S "Make a Donation to Codeigniter Payments") + +# PHP Payments + +## NOTICE - USING PHP-PAYMENTS ALONE DOES NOT MAKE YOU PCI COMPLIANT + +It is highly recommended that you attempt to architect your application to achieve some level of PCI compliance. Without this, the applications you create can be vulnerable to fines for PCI compliance violations. Using PHP-Payments does not circumvent the need for you to do this. You can check out the PCI compliance self assessment form here: https://www.pcisecuritystandards.org/merchants/self_assessment_form.php + +## Installing + +There are config files for each gateway in the /config folder of the package. You need to enter your own API usernames and passwords (the ones in there are mine, used only for testing purposes) in the config of each gateway you would like to use. + +## Testing + +1. If you want to test locally (and you should), you need to set "force_secure_connection" to FALSE in config/payments.php + +2. By default, test api endpoints will be used. To enable production endpoints, change the mode in /config/payments.php from 'test' to 'production' or pass a 'mode' parameter in the config param when you instantiate PHP payments (ie $p = new PHP-Payments(array('mode' => 'test'));. Note that if you are a Psigate customer, you must obtain your production endpoint from Psigate support. + +3. It's highly advised that you run tests before trying to go live. The automated testing utility in the tests folder can help you do this. To use tests: + +- To run all tests, cd into tests and type test.php +- To test all payment drivers, cd into tests and type test.php drivers +- To test a specific payment driver, cd into tests and type test.php drivers driver (Where 'driver' is a driver name, such as stripe, beanstream or paypal_payments_pro) + +Alternatively, you could visit test.php in a web browser to run all tests. We may introduce enhanced browser based testing in the future - but for not the preferred usage is from command line. + +## Documentation + +To avoid constantly updating documentation to match code, we've opted for automating as much documentation as possible. To view the current documentation, cd into the documentation folder, then cd into dox and type doxgen.php in the command line. You can alternatively open this file in a web browser. + +When you run doxgen, documentation will appear in documentation/HTML which you can load in your web browser. + +## Gateway, Method and Parameter Support + +As this is constantly changing, please run doxgen.php in the dox folder to generate up to date documentation. At time of writing the README, PHP-Payments supports a dozen gateways. However it should be mentioned the PHP-Payments currently supports two types of gateways - "Button" gateways and regular "Server to Server" gateways. Button gateways may have server to server operations, but for things like payment methods (such as oneoff_payment_button) generate HTML code for a button. This HTML code is retrieved from the detail property of a PHP-Payments response object. + +## Responses + +There are two types of responses returned, local responses and gateway responses. If a method is not supported, required params are missing, a gateway does not exist, etc., a local response will be returned. This prevents the transaction from being sent to the gateway and the gateway telling you 3 seconds later there is something wrong with your request.: + +```php +'type' => 'local_response', //Indicates failure was local +'status' => $status, //Either success or failure +'response_code' => $this->_response_codes[$response], +'response_message' => $this->_response_messages[$response], +'details' => $response_details +``` +Access response properties by naming your call something like this: + +```php +$response = $payments->payment_action('gateway_name', $params); +``` + +Then you can do: + +```php +$status = $response->status; +``` + +Gateway responses will usually have a full response from the gateway, and on failure a 'reason' property in the details object: + +```php +'type' => 'gateway_response', +'status' => $status, +'response_code' => $this->_response_codes[$response], +'response_message' => $this->_response_messages[$response], +'details' => $details +``` + +You can access this like $response->details->reason. You may want to save the full gateway response (it's an array) in a database table, you can access it at $response->details->gateway_response + +## LICENSE + +Copyright (c) 2011-2012 Calvin Froedge + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/php-payments/config/drivers/amazon_simplepay.php b/vendor/php-payments/config/drivers/amazon_simplepay.php new file mode 100755 index 000000000000..d691f067ea81 --- /dev/null +++ b/vendor/php-payments/config/drivers/amazon_simplepay.php @@ -0,0 +1,14 @@ + 'test', + 'secret_key' => 'test', + 'abandon_url' => 'http://yourwebsite.com/cancel', //Where user goes if they cancel the order + 'return_url' => 'http://yourwebsite.com/continue', //Where user goes after payment is finished + 'immediate_return' => '0', //Set to 1 if you want to skip the final status screen on amazon + 'process_immediate' => '0', //1 if you want to settle immediately. Else it's simply an authorization and you must capture later. + 'ipn_url' => 'http://yourwebsite.com/ipn', //Where to send the ipn notification + 'collect_shipping_address' => '1', //1 tells amazon to collect buyer's shipping information +); + +return $config; \ No newline at end of file diff --git a/vendor/php-payments/config/drivers/authorize_net.php b/vendor/php-payments/config/drivers/authorize_net.php new file mode 100755 index 000000000000..a4b75bfdc8db --- /dev/null +++ b/vendor/php-payments/config/drivers/authorize_net.php @@ -0,0 +1,8 @@ + 'mCeiwZDpJ6Qt_ktvePBvFQPCqoVTPE6nCbaG17IWl6UPqxZtda967ezzyXjI_wwm', + 'app_secret' => 'nAdkW9Geud8lOXguS_qUYNM2C96J5DFRA0nmbpKFheJUzxj85SQI2qm1gyrE1aFf', + 'access_token' => 'HckEz6jLMRxSfWSHqxHrRMJlQF3VGFQo1UGts46X1veyBIejzZ3emeb0sLYA7LqY', + 'id' => '01FCVJW4YC' +); + +return $config; \ No newline at end of file diff --git a/vendor/php-payments/config/drivers/google_checkout.php b/vendor/php-payments/config/drivers/google_checkout.php new file mode 100755 index 000000000000..72be0fc8eb15 --- /dev/null +++ b/vendor/php-payments/config/drivers/google_checkout.php @@ -0,0 +1,10 @@ + 'test', + 'merchant_key' => 'test', + 'request_buyer_phone' => true, + 'button_size' => 'SMALL' +); + +return $config; diff --git a/vendor/php-payments/config/drivers/paypal_paymentspro.php b/vendor/php-payments/config/drivers/paypal_paymentspro.php new file mode 100755 index 000000000000..4f1ee99b6796 --- /dev/null +++ b/vendor/php-payments/config/drivers/paypal_paymentspro.php @@ -0,0 +1,7 @@ + '000', + 'invalid_input' => '000', + 'not_a_method' => '000', + 'required_params_missing' => '000', + 'invalid_xml' => '000', + 'authentication_failure' => '011', + + //Payment Methods + 'authorize_payment_success' => '100', + 'authorize_payment_local_failure' => '000', + 'authorize_payment_gateway_failure' => '011', + 'oneoff_payment_success' => '100', + 'oneoff_payment_local_failure' => '000', + 'oneoff_payment_gateway_failure' => '011', + 'oneoff_payment_button_success' => '100', + 'oneoff_payment_button_local_failure' => '000', + 'oneoff_payment_button_gateway_failure' => '011', + 'reference_payment_success' => '100', + 'reference_payment_local_failure' => '000', + 'reference_payment_gateway_failure' => '011', + 'capture_payment_success' => '100', + 'capture_payment_local_failure' => '000', + 'capture_payment_gateway_failure' => '011', + 'void_payment_success' => '100', + 'void_payment_local_failure' => '000', + 'void_payment_gateway_failure' => '011', + 'void_refund_success' => '100', + 'void_refund_local_failure' => '000', + 'void_refund_gateway_failure' => '011', + 'get_transaction_details_success' => '100', + 'get_transaction_details_local_failure' => '000', + 'get_transaction_details_gateway_failure' => '011', + 'change_transaction_status_success' => '100', + 'change_transaction_status_local_failure' => '000', + 'change_transaction_status_gateway_failure' => '011', + 'refund_payment_success' => '100', + 'refund_payment_local_failure' => '000', + 'refund_payment_gateway_failure' => '011', + 'search_transactions_success' => '100', + 'search_transactions_local_failure' => '000', + 'search_transactions_gateway_failure' => '011', + 'recurring_payment_success' => '100', + 'recurring_payment_local_failure' => '000', + 'recurring_payment_gateway_failure' => '011', + 'get_recurring_profile_success' => '100', + 'get_recurring_profile_local_failure' => '000', + 'get_recurring_profile_gateway_failure' => '011', + 'suspend_recurring_profile_success' => '100', + 'suspend_recurring_profile_local_failure' => '000', + 'suspend_recurring_profile_gateway_failure' => '011', + 'activate_recurring_profile_success' => '100', + 'activate_recurring_profile_local_failure' => '000', + 'activate_recurring_profile_gateway_failure' => '011', + 'cancel_recurring_profile_success' => '100', + 'cancel_recurring_profile_local_failure' => '000', + 'cancel_recurring_profile_gateway_failure' => '011', + 'recurring_bill_outstanding_success' => '100', + 'recurring_bill_outstanding_local_failure' => '000', + 'recurring_bill_outstanding_gateway_failure' => '011', + 'update_recurring_profile_success' => '100', + 'update_recurring_profile_local_failure' => '000', + 'update_recurring_profile_gateway_failure' => '011', + 'token_create_success' => '100', + 'token_create_local_failure' => '000', + 'token_create_gateway_failure' => '011', + 'customer_create_success' => '100', + 'customer_create_local_failure' => '000', + 'customer_create_gateway_failure' => '011', + 'customer_charge_success' => '100', + 'customer_charge_local_failure' => '000', + 'customer_create_gateway_failure' => '011' +); + +return $config; diff --git a/vendor/php-payments/documentation/README.md b/vendor/php-payments/documentation/README.md new file mode 100755 index 000000000000..e9911a72f43b --- /dev/null +++ b/vendor/php-payments/documentation/README.md @@ -0,0 +1,4 @@ +# Generating Documentation + +Generating documentation is easy. Simply cd into the documentation/dox folder and type doxgen.php. Current HTML documentation will be generated in documentation/html + diff --git a/vendor/php-payments/documentation/dox/content/add_drivers.php b/vendor/php-payments/documentation/dox/content/add_drivers.php new file mode 100755 index 000000000000..ebf22b6e8b8b --- /dev/null +++ b/vendor/php-payments/documentation/dox/content/add_drivers.php @@ -0,0 +1,20 @@ +
Being uploaded!
+Because you think the idea of an open source PHP project supporting many payment gateways with one API is sexy as hell. Because you're not a douche. Because you like writing code and want to sharpen your teeth with payment APIs. These, and many others, are all excellent reasons to contribute to PHP-Payments.
+PHP-Payments relies heavily on __call magic methods and matching methods and keys via arrays. Taking this approach allowed us to eliminate duplicate code and keep an extremely clear detail of what methods and parameters were supported by each method within each gateway, within the driver itself. When you instantiate PHP-Payments, the library first autoloads some helper classes such as a utility class, a response class, a request class, the payment driver abstract class. When you call a method, PHP-Payments make sure the driver and method you're using exists, and via the method_map() function which is implemented in each driver, ensures you've submitted the required keys for that method. If all checks out, the request can be made.
+Calvin started writing code for a freelance project in February of 2012 that needed an integration with PayPal Payments Pro. Finding that the PayPal SDK was not that great, and thinking "payment gateway implementations should be an abstraction - not an involved integration project", Calvin started writing code for a CodeIgniter package. When the package was released, it only supported PayPal Payments Pro and was very simple.
+Follow Calvin on Twitter: @calvinfroedge
+Phil provided early support, encouraging Calvin (who was new to PHP) to continue developing the code and to package the code as a CodeIgniter spark. When Phil made the call for speakers for the first CodeIgniter on tour conference, Calvin asked to speak and promised to radically improve his payments class (which by then supported 3 gateways). Amazingly, and probably against his better judgement, Phil obliged. PHP-Payments would not exist had Phil not taken a chance on an unproven developer.
+Follow Phil on Twitter: @philsturgeon
+Joel was the first person to fork the spark CodeIgniter payments and contribute a gateway to the codebase. He is responsible for the BluePay payments support. He has also contributed extremely valuable ideas on how to improve the code and has made great feature suggestions.
+Follow Joel on Twitter: @eclarian
+James made the first donation to CodeIgniter payments. He needed a payment integration for his own project and CodeIgniter payments met his need. His gift was a huge confidence booster and was most appreciated.
+Follow James on Twitter: @outofcontrol
++<?php +include('/path/to/payments/payments.php'); + +$p = new PHP_Payments; + +$config = Payment_Utility::load('config', '/path/to/your/gateway/config'); +$params = array('cc_number' => 4111111111111111, 'amt' => 35.00, 'cc_exp' => '022016', 'cc_code' => '203'); + +$response = $p->oneoff_payment('name_of_payment_driver', $params, $config); ++ +
Though the project began as a CodeIgniter spark, PHP-Payments is now a framework agnostic API. Writing an interface to bring it to your framework is easy, and your framework could already be supported. Check out the frameworks page for more info.
+Please note that not all drivers implement each of these methods. In addition, the params available in each method may not be used in a particular driver's implementation. If you use a param in a request which is not used, it will appear in your error log, but will not create any ill effects in the request - it simply will not be sent to the gateway.
+ +$v) +{ + if($v[0] != '.') + { + include $mdir.$v; + $class = str_replace('.php', '', $v); + $ex = explode('_', $class); + foreach($ex as $k=>$v) + { + $ex[$k] = ucfirst($v); + } + $class_name = implode("_", $ex); + $class_instance = new $class(); + + ?> + +# | +Parameter | +Example | +
---|---|---|
+ | + | + |
+include('/path/to/lib/payments.php'); + +$payments = new PHP_Payments; + +$config = Payment_Utility::load('config', '/path/to/config/file'); //You can do this or you can make this an array. Config file is recommended since configuration needs differ by gateway. + +//Make the call +$response = $payments->payment_action('gateway_name', $params, $config); ++ +
There are two types of responses returned, local responses and gateway responses. If a method is not supported, required params are missing, a gateway does not exist, etc., a local response will be returned. This prevents the transaction from being sent to the gateway and the gateway telling you 3 seconds later there is something wrong with your request.
+ +Accessing response properties looks like this:
+ ++$status = $response->status; ++ +
Gateway responses will usually have a full response from the gateway, and on failure a 'reason' property in the details object:
+ ++$gatway_response = $response->details; + +$failure_reason = $response->reason; ++ +