Merge pull request #5182 from colemanw/Cleanup
[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 public 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
38 * Id of the PayPal Pro payment processor.
39 * to be deleted
40 * @return bool
41 * true if payment processor deleted, false otherwise
42 */
43 public function delete($id) {
44 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
45 $paymentProcessor->id = $id;
46 if ($paymentProcessor->find(TRUE)) {
47 $result = $paymentProcessor->delete();
48 }
49 return $result;
50 }
51
52 }