Skip to content

Commit

Permalink
Merge pull request #17278 from mattwire/paymentcreateorderreference
Browse files Browse the repository at this point in the history
Support order_reference param in API3 Payment.create
  • Loading branch information
seamuslee001 authored May 30, 2020
2 parents 5bbbc7f + 9ed56e2 commit 48b3a75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CRM/Financial/BAO/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static function create($params) {
$isPaymentCompletesContribution = self::isPaymentCompletesContribution($params['contribution_id'], $params['total_amount'], $contributionStatus);
$lineItems = self::getPayableLineItems($params);

$whiteList = ['check_number', 'payment_processor_id', 'fee_amount', 'total_amount', 'contribution_id', 'net_amount', 'card_type_id', 'pan_truncation', 'trxn_result_code', 'payment_instrument_id', 'trxn_id', 'trxn_date'];
$whiteList = ['check_number', 'payment_processor_id', 'fee_amount', 'total_amount', 'contribution_id', 'net_amount', 'card_type_id', 'pan_truncation', 'trxn_result_code', 'payment_instrument_id', 'trxn_id', 'trxn_date', 'order_reference'];
$paymentTrxnParams = array_intersect_key($params, array_fill_keys($whiteList, 1));
$paymentTrxnParams['is_payment'] = 1;
// Really we should have a DB default.
Expand Down
16 changes: 16 additions & 0 deletions api/v3/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,22 @@ function _civicrm_api3_payment_create_spec(&$params) {
'type' => 'Text',
],
],
'order_reference' => [
'name' => 'order_reference',
'type' => CRM_Utils_Type::T_STRING,
'title' => 'Order Reference',
'description' => 'Payment Processor external order reference',
'maxlength' => 255,
'size' => 25,
'where' => 'civicrm_financial_trxn.order_reference',
'table_name' => 'civicrm_financial_trxn',
'entity' => 'FinancialTrxn',
'bao' => 'CRM_Financial_DAO_FinancialTrxn',
'localizable' => 0,
'html' => [
'type' => 'Text',
],
],
'check_number' => [
'name' => 'check_number',
'type' => CRM_Utils_Type::T_STRING,
Expand Down

0 comments on commit 48b3a75

Please sign in to comment.