Config.php 1.38 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
<?php

class CRM_Accountsync_BAO_Config extends CRM_Accountsync_DAO_AccountContact {


  public static function getSupportedContributionEntities() {
    return [
      'Contact' => 'Contact',
      'Contribution' => 'Contribution',
      'ContributionRecur' => 'Recurring Contribution',
    ];
  }

  public static function getSupportedContributionCreateEntities() {
    return [
      'Contribution' => 'Contribution',
    ];
  }

  public static function getSupportedContactUpdateEntities() {
    return [
      'Contact' => 'Contact',
      'Contribution' => 'Contribution',
      'ContributionRecur' => 'Recurring Contribution',
      'Address' => 'Address',
      'Email' => 'Email',
      'Phone' => 'Phone',
    ];
  }

  /**
   * Get payment processors.
   *
   * This differs from the option value in that we append description for disambiguation.
   *
   * @return array
   */
  public static function getPaymentProcessors() {
    $results = civicrm_api3('PaymentProcessor', 'get', array(
      'sequential' => 0,
      'is_test' => 0,
      'return' => ['id', 'name', 'description', 'domain_id'],
    ));

    $processors = array();
    foreach ($results['values'] as $processorID => $details) {
      $processors[$processorID] = $details['name'];
      if (!empty($details['description'])) {
        $processors[$processorID] .= ' : ' . $details['description'];
      }
    }
    return $processors;
  }

}