Commit | Line | Data |
---|---|---|
6a488035 TO |
1 | <?php |
2 | require_once "CRM/Financial/DAO/PaymentProcessor.php"; | |
3 | class PaypalPro extends PHPUnit_Framework_Testcase { | |
4 | /** | |
5 | * Helper function to create | |
6 | * a payment processor of type Paypal Pro | |
7 | * | |
8 | * @return $paymentProcessor id of created payment processor | |
a86d27fc | 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 | |
6a488035 TO |
12 | */ |
13 | static function create() { | |
14 | ||
15 | $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor(); | |
16 | $paymentParams = array( | |
17 | 'name' => 'demo', | |
18 | 'domain_id' => CRM_Core_Config::domainID(), | |
19 | 'payment_processor_type' => 'PayPal', | |
20 | 'is_active' => 1, | |
21 | 'is_default' => 0, | |
22 | 'is_test' => 1, | |
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', | |
30 | 'billing_mode' => 3, | |
31 | 'financial_type_id' => 1, | |
32 | ); | |
33 | $paymentProcessor->copyValues($paymentParams); | |
34 | $paymentProcessor->save(); | |
35 | return $paymentProcessor->id; | |
36 | } | |
37 | ||
38 | /** | |
39 | * Helper function to delete a PayPal Pro | |
40 | * payment processor | |
41 | * @param int $id - id of the PayPal Pro payment processor | |
42 | * to be deleted | |
43 | * @return boolean true if payment processor deleted, false otherwise | |
44 | */ | |
45 | static function delete($id) { | |
46 | $pp = new CRM_Financial_DAO_PaymentProcessor(); | |
47 | $pp->id = $id; | |
48 | if ($pp->find(TRUE)) { | |
49 | $result = $pp->delete(); | |
50 | } | |
51 | return $result; | |
52 | } | |
53 | } |