function _civicrm_entity_price_set_field_run_cc_transaction in CiviCRM Entity 7.2
Run the credit card transaction. Find a handler for the payment processor type if one is available and invoke its callback
Parameters
$price_set_data:
$entity_type:
$entity:
$form_state:
Return value
bool|mixed
1 call to _civicrm_entity_price_set_field_run_cc_transaction()
- civicrm_entity_price_set_field_display_form_event_submit in modules/
civicrm_entity_price_set_field/ includes/ civicrm_entity_price_set_field.event_registration.inc - Submit handler for event registration form 'Register' button
File
- modules/
civicrm_entity_price_set_field/ includes/ civicrm_entity_price_set_field.transaction.inc, line 173 - CiviCRM Entity Price Set Field, Credit Card Transaction code
Code
function _civicrm_entity_price_set_field_run_cc_transaction($display, $price_set_data, $entity_type, $entity, $contacts, $form_state) {
$civicrm_entity_prise_set_field_processor_types = civicrm_entity_price_set_field_get_processor_handler_info();
if (!empty($entity->payment_processor)) {
if (!empty($form_state['registration_cc_block']['payment_processor_selection'])) {
$processor = entity_load_single('civicrm_payment_processor', $form_state['registration_cc_block']['payment_processor_selection']);
}
else {
return FALSE;
}
if (!empty($processor->payment_processor_type_id)) {
$processor_type = entity_load_single('civicrm_payment_processor_type', $processor->payment_processor_type_id);
foreach ($civicrm_entity_prise_set_field_processor_types as $id => $type) {
if ($type['payment_processor_type'] == $processor_type->name) {
$invoke_type = $type;
}
}
if (!empty($invoke_type)) {
$result = call_user_func($invoke_type['callback'], $display, $processor, $processor_type, $price_set_data, $entity_type, $entity, $contacts, $form_state);
}
if (!empty($result)) {
// trigger rule event with all the pertinent data here
if (!empty($result['contribution']->id)) {
if (module_exists('rules')) {
$rule_variables = [
'contribution' => $result['contribution'],
];
rules_invoke_event_by_args('civicrm_entity_price_set_field_successful_cc_transaction', $rule_variables);
}
}
return $result;
}
}
}
return FALSE;
}