<commit_before><?php
/*-------------------------------------------------------+
| ICA Event Registration Module                          |
| Copyright (C) 2016 SYSTOPIA                            |
+--------------------------------------------------------+
| This program is released as free software under the    |
| Affero GPL license. You can redistribute it and/or     |
| modify it under the terms of this license which you    |
| can read by viewing the included agpl.txt or online    |
| at www.gnu.org/licenses/agpl.html. Removal of this     |
| copyright header is strictly prohibited without        |
| written permission from the original author(s).        |
+--------------------------------------------------------*/



/**
 * API entry for event registration
 *
 * This will process changes to the registration fee payment
 * 
 * @return array API result array
 * @access public
 */
function civicrm_api3_registration_payment($params) { 
  // check input
  error_log("REGISTRATION:PAYMENT: " . json_encode($params));
  $status_id = CRM_Core_OptionGroup::getValue('contribution_status', $params['status'], 'name');
  if (!$status_id) {
    return civicrm_api3_create_error("Invalid status '{$params['status']}'!");
  }

  if (empty($params['timestamp']) /* TODO: || !parsedate */ ) {
    $params['timestamp'] = date('YmdHis');
  }

  // get the contribution (throws exception if not found)
  $contribution = civicrm_api3('Contribution', 'getsingle', array('trxn_id' => $params['registration_id']));

  // set the status ID
  try {
    _civicrm_api3_fix_API_UID();
    civicrm_api3('Contribution', 'create', array(
      'id'                     => $contribution['id'], 
      'contribution_status_id' => $status_id,
      'receive_date'           => $params['timestamp']));    
  } catch (Exception $e) {
    error_log("Exception: " . $e->getMessage());
    civicrm_api3_create_error($e->getMessage());
  }
<commit_msg>removed debug messages<commit_after><?php
/*-------------------------------------------------------+
| ICA Event Registration Module                          |
| Copyright (C) 2016 SYSTOPIA                            |
+--------------------------------------------------------+
| This program is released as free software under the    |
| Affero GPL license. You can redistribute it and/or     |
| modify it under the terms of this license which you    |
| can read by viewing the included agpl.txt or online    |
| at www.gnu.org/licenses/agpl.html. Removal of this     |
| copyright header is strictly prohibited without        |
| written permission from the original author(s).        |
+--------------------------------------------------------*/



/**
 * API entry for event registration
 *
 * This will process changes to the registration fee payment
 * 
 * @return array API result array
 * @access public
 */
function civicrm_api3_registration_payment($params) { 
  // check input
  $status_id = CRM_Core_OptionGroup::getValue('contribution_status', $params['status'], 'name');
  if (!$status_id) {
    return civicrm_api3_create_error("Invalid status '{$params['status']}'!");
  }

  if (empty($params['timestamp']) /* TODO: || !parsedate */ ) {
    $params['timestamp'] = date('YmdHis');
  }

  // get the contribution (throws exception if not found)
  $contribution = civicrm_api3('Contribution', 'getsingle', array('trxn_id' => $params['registration_id']));

  // set the status ID
  try {
    _civicrm_api3_fix_API_UID();
    civicrm_api3('Contribution', 'create', array(
      'id'                     => $contribution['id'], 
      'contribution_status_id' => $status_id,
      'receive_date'           => $params['timestamp']));    
  } catch (Exception $e) {
    civicrm_api3_create_error($e->getMessage());
  }

{'fraction_non_alphanumeric': 0.209197235513025, 'fraction_numerical': 0.00531632110579479, 'mean_word_length': 2.2328178694158076, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5372009', 'n_tokens_mistral': 1053, 'n_tokens_neox': 1008, 'n_words': 276}