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