Plugin Directory

Changeset 2052715


Ignore:
Timestamp:
03/18/2019 02:32:55 PM (7 years ago)
Author:
danillonunes
Message:

Add API function to load donations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • makemydonation-imo/trunk/api.php

    r1498447 r2052715  
    9393
    9494/**
     95 * Load donations from a single case using the API.
     96 *
     97 * @param $case_id
     98 *   The case id.
     99 * @return
     100 *   Array with the donation data as in the API description.
     101 */
     102function mmdimo_api_case_donations_load( $case_id, $count = FALSE ) {
     103  $count = (int) $count;
     104  $response = mmdimo_api_request( 'get', "donation?funeral_home_case=$case_id&count=$count" );
     105
     106  if ( is_array( $response ) && isset( $response['response'] ) ) {
     107    switch ($response['response']['code']) {
     108      case 200:
     109        return (array) json_decode( $response['body'] );
     110    }
     111  }
     112
     113  return FALSE;
     114}
     115
     116/**
    95117 * Create a case using the API.
    96118 *
Note: See TracChangeset for help on using the changeset viewer.