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