tests - add autogenerated comment blocks
[civicrm-core.git] / tests / phpunit / CiviTest / PaypalPro.php
1 <?php
2 require_once "CRM/Financial/DAO/PaymentProcessor.php";
3
4 /**
5 * Class PaypalPro
6 */
7 class PaypalPro extends PHPUnit_Framework_Testcase {
8 /**
9 * Helper function to create
10 * a payment processor of type Paypal Pro
11 *
12 * @return int $paymentProcessor id of created payment processor@todo this appears not to be working but because it doesn't extend the test class
13 * callAPISuccess won't work
14 * I have duplicated this on the main test class as a work around
15 */
16 static function create() {
17
18 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
19 $paymentParams = array(
20 'name' => 'demo',
21 'domain_id' => CRM_Core_Config::domainID(),
22 'payment_processor_type' => 'PayPal',
23 'is_active' => 1,
24 'is_default' => 0,
25 'is_test' => 1,
26 'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
27 'password' => '1183377788',
28 'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
29 'url_site' => 'https://www.sandbox.paypal.com/',
30 'url_api' => 'https://api-3t.sandbox.paypal.com/',
31 'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
32 'class_name' => 'Payment_PayPalImpl',
33 'billing_mode' => 3,
34 'financial_type_id' => 1,
35 );
36 $paymentProcessor->copyValues($paymentParams);
37 $paymentProcessor->save();
38 return $paymentProcessor->id;
39 }
40
41 /**
42 * Helper function to delete a PayPal Pro
43 * payment processor
44 * @param int $id - id of the PayPal Pro payment processor
45 * to be deleted
46 * @return boolean true if payment processor deleted, false otherwise
47 */
48 static function delete($id) {
49 $pp = new CRM_Financial_DAO_PaymentProcessor();
50 $pp->id = $id;
51 if ($pp->find(TRUE)) {
52 $result = $pp->delete();
53 }
54 return $result;
55 }
56 }