| 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 | * |
| 11 | * @return $paymentProcessor id of created payment processor |
| 12 | */ |
| 13 | /** |
| 14 | * @return CRM_Financial_DAO_PaymentProcessor |
| 15 | */ |
| 16 | function create() { |
| 17 | |
| 18 | $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor(); |
| 19 | $paymentParams = array( |
| 20 | 'name' => 'Authorize', |
| 21 | 'domain_id' => CRM_Core_Config::domainID(), |
| 22 | 'payment_processor_type' => 'AuthNet', |
| 23 | 'is_active' => 1, |
| 24 | 'is_default' => 0, |
| 25 | 'is_test' => 1, |
| 26 | 'user_name' => '4y5BfuW7jm', |
| 27 | 'password' => '4cAmW927n8uLf5J8', |
| 28 | 'url_site' => 'https://test.authorize.net/gateway/transact.dll', |
| 29 | 'url_recur' => 'https://apitest.authorize.net/xml/v1/request.api', |
| 30 | 'class_name' => 'Payment_AuthorizeNet', |
| 31 | 'billing_mode' => 1, |
| 32 | ); |
| 33 | $paymentProcessor->copyValues($paymentParams); |
| 34 | $paymentProcessor->save(); |
| 35 | return $paymentProcessor; |
| 36 | } |
| 37 | |
| 38 | /* |
| 39 | * Helper function to delete a PayPal Pro |
| 40 | * payment processor |
| 41 | * @param int $id - id of the PayPal Pro payment processor |
| 42 | * to be deleted |
| 43 | * @return boolean true if payment processor deleted, false otherwise |
| 44 | * |
| 45 | */ |
| 46 | /** |
| 47 | * @param $id |
| 48 | * |
| 49 | * @return mixed |
| 50 | */ |
| 51 | function delete($id) { |
| 52 | $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor(); |
| 53 | $paymentProcessor->id = $id; |
| 54 | if ($paymentProcessor->find(TRUE)) { |
| 55 | $result = $paymentProcessor->delete(); |
| 56 | } |
| 57 | return $result; |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | |
| 62 | |