2 require_once "CRM/Financial/DAO/PaymentProcessor.php";
3 class PaypalPro
extends PHPUnit_Framework_Testcase
{
5 * Helper function to create
6 * a payment processor of type Paypal Pro
8 * @return $paymentProcessor id of created payment processor
9 * @todo this appears not to be working but because it doesn't extend the test class
10 * callAPISuccess won't work
11 * I have duplicated this on the main test class as a work around
13 static function create() {
15 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
16 $paymentParams = array(
18 'domain_id' => CRM_Core_Config
::domainID(),
19 'payment_processor_type' => 'PayPal',
23 'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
24 'password' => '1183377788',
25 'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
26 'url_site' => 'https://www.sandbox.paypal.com/',
27 'url_api' => 'https://api-3t.sandbox.paypal.com/',
28 'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
29 'class_name' => 'Payment_PayPalImpl',
31 'financial_type_id' => 1,
33 $paymentProcessor->copyValues($paymentParams);
34 $paymentProcessor->save();
35 return $paymentProcessor->id
;
39 * Helper function to delete a PayPal Pro
41 * @param int $id - id of the PayPal Pro payment processor
43 * @return boolean true if payment processor deleted, false otherwise
45 static function delete($id) {
46 $pp = new CRM_Financial_DAO_PaymentProcessor();
48 if ($pp->find(TRUE)) {
49 $result = $pp->delete();