INFRA-132 - Fix misc oddball syntax
[civicrm-core.git] / tests / phpunit / CiviTest / PaypalPro.php
CommitLineData
6a488035
TO
1<?php
2require_once "CRM/Financial/DAO/PaymentProcessor.php";
aba1cd8b
EM
3
4/**
5 * Class PaypalPro
6 */
6a488035
TO
7class PaypalPro extends PHPUnit_Framework_Testcase {
8 /**
9 * Helper function to create
10 * a payment processor of type Paypal Pro
11 *
2a6da8d7 12 * @return int $paymentProcessor id of created payment processor@todo this appears not to be working but because it doesn't extend the test class
a86d27fc 13 * callAPISuccess won't work
14 * I have duplicated this on the main test class as a work around
6a488035 15 */
00be9182 16 public static function create() {
6a488035
TO
17
18 $paymentProcessor = new CRM_Financial_DAO_PaymentProcessor();
19 $paymentParams = array(
20 'name' => 'demo',
21 'domain_id' => CRM_Core_Config::domainID(),
22 'payment_processor_type' => 'PayPal',
23 'is_active' => 1,
24 'is_default' => 0,
25 'is_test' => 1,
26 'user_name' => 'sunil._1183377782_biz_api1.webaccess.co.in',
27 'password' => '1183377788',
28 'signature' => 'APixCoQ-Zsaj-u3IH7mD5Do-7HUqA9loGnLSzsZga9Zr-aNmaJa3WGPH',
29 'url_site' => 'https://www.sandbox.paypal.com/',
30 'url_api' => 'https://api-3t.sandbox.paypal.com/',
31 'url_button' => 'https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif',
32 'class_name' => 'Payment_PayPalImpl',
33 'billing_mode' => 3,
34 'financial_type_id' => 1,
35 );
36 $paymentProcessor->copyValues($paymentParams);
37 $paymentProcessor->save();
38 return $paymentProcessor->id;
39 }
40
41 /**
42 * Helper function to delete a PayPal Pro
43 * payment processor
e16033b4
TO
44 * @param int $id
45 * Id of the PayPal Pro payment processor.
6a488035
TO
46 * to be deleted
47 * @return boolean true if payment processor deleted, false otherwise
48 */
00be9182 49 public static function delete($id) {
6a488035
TO
50 $pp = new CRM_Financial_DAO_PaymentProcessor();
51 $pp->id = $id;
52 if ($pp->find(TRUE)) {
53 $result = $pp->delete();
54 }
55 return $result;
56 }
57}