Merge branch '4.5' of https://github.com/civicrm/civicrm-core
[civicrm-core.git] / tests / phpunit / CiviTest / AuthorizeNet.php
1 <?php
2
3 /**
4 * Class AuthorizeNet
5 */
6 class AuthorizeNet extends PHPUnit_Framework_Testcase {
7 /**
8 * Helper function to create
9 * a payment processor of type Authorize.net
10 * @return CRM_Financial_DAO_PaymentProcessor
11 */
12 function create() {
13
14 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
15 $paymentParams = array(
16 'name' => 'Authorize',
17 'domain_id' => CRM_Core_Config::domainID(),
18 'payment_processor_type' => 'AuthNet',
19 'is_active' => 1,
20 'is_default' => 0,
21 'is_test' => 1,
22 'user_name' => '4y5BfuW7jm',
23 'password' => '4cAmW927n8uLf5J8',
24 'url_site' => 'https://test.authorize.net/gateway/transact.dll',
25 'url_recur' => 'https://apitest.authorize.net/xml/v1/request.api',
26 'class_name' => 'Payment_AuthorizeNet',
27 'billing_mode' => 1,
28 );
29 $paymentProcessor->copyValues($paymentParams);
30 $paymentProcessor->save();
31 return $paymentProcessor;
32 }
33
34 /**
35 * Helper function to delete a PayPal Pro
36 * payment processor
37 * @param int $id - id of the PayPal Pro payment processor
38 * to be deleted
39 * @return boolean true if payment processor deleted, false otherwise
40 *
41 */
42 function delete($id) {
43 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
44 $paymentProcessor->id = $id;
45 if ($paymentProcessor->find(TRUE)) {
46 $result = $paymentProcessor->delete();
47 }
48 return $result;
49 }
50 }
51
52
53