Import from SVN (r45945, r596)
[civicrm-core.git] / tests / phpunit / CiviTest / PaypalPro.php
CommitLineData
6a488035
TO
1<?php
2require_once "CRM/Financial/DAO/PaymentProcessor.php";
3class 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
9 */
10 static function create() {
11
12 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
13 $paymentParams = array(
14 'name' => 'demo',
15 'domain_id' => CRM_Core_Config::domainID(),
16 'payment_processor_type' => 'PayPal',
17 'is_active' => 1,
18 'is_default' => 0,
19 'is_test' => 1,
20 'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
21 'password' => '1183377788',
22 'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
23 'url_site' => 'https://www.sandbox.paypal.com/',
24 'url_api' => 'https://api-3t.sandbox.paypal.com/',
25 'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
26 'class_name' => 'Payment_PayPalImpl',
27 'billing_mode' => 3,
28 'financial_type_id' => 1,
29 );
30 $paymentProcessor->copyValues($paymentParams);
31 $paymentProcessor->save();
32 return $paymentProcessor->id;
33 }
34
35 /**
36 * Helper function to delete a PayPal Pro
37 * payment processor
38 * @param int $id - id of the PayPal Pro payment processor
39 * to be deleted
40 * @return boolean true if payment processor deleted, false otherwise
41 */
42 static function delete($id) {
43 $pp = new CRM_Financial_DAO_PaymentProcessor();
44 $pp->id = $id;
45 if ($pp->find(TRUE)) {
46 $result = $pp->delete();
47 }
48 return $result;
49 }
50}