$config->defaultCurrency
);
- if (!empty($this->_params['trxn_date'])) {
- $this->_params['receive_date'] = $this->_params['trxn_date'];
- }
-
- if (empty($this->_params['receive_date'])) {
- $this->_params['receive_date'] = date('YmdHis');
- }
-
if (empty($this->_params['invoice_id'])) {
$this->_params['invoiceID'] = md5(uniqid(rand(), TRUE));
}
$this->_params = array_merge($this->_params, $result);
}
- if (empty($this->_params['receive_date'])) {
- $this->_params['receive_date'] = $now;
- }
-
$this->set('params', $this->_params);
// set source if not set
$isPaymentCompletesContribution = self::isPaymentCompletesContribution($params['contribution_id'], $params['total_amount']);
$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'];
+ $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'];
$paymentTrxnParams = array_intersect_key($params, array_fill_keys($whiteList, 1));
$paymentTrxnParams['is_payment'] = 1;
if (!empty($params['payment_processor'])) {
if ($params['total_amount'] > 0) {
$paymentTrxnParams['to_financial_account_id'] = CRM_Contribute_BAO_Contribution::getToFinancialAccount($contribution, $params);
$paymentTrxnParams['from_financial_account_id'] = CRM_Financial_BAO_FinancialAccount::getFinancialAccountForFinancialTypeByRelationship($contribution['financial_type_id'], 'Accounts Receivable Account is');
- $paymentTrxnParams['trxn_date'] = CRM_Utils_Array::value('trxn_date', $params, CRM_Utils_Array::value('contribution_receive_date', $params, date('YmdHis')));
$paymentTrxnParams['currency'] = $contribution['currency'];
$paymentTrxnParams['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Core_BAO_FinancialTrxn', 'status_id', 'Completed');
'api.aliases' => ['payment_id'],
],
'trxn_date' => [
- 'title' => ts('Cancel Date'),
+ 'title' => ts('Payment Date'),
'type' => CRM_Utils_Type::T_DATE + CRM_Utils_Type::T_TIME,
+ 'api.default' => 'now',
+ 'api.required' => TRUE,
],
'is_send_contribution_notification' => [
'title' => ts('Send out notifications based on contribution status change?'),
function _civicrm_api3_payment_get_spec(&$params) {
$params = [
'contribution_id' => [
- 'title' => 'Contribution ID',
+ 'title' => ts('Contribution ID'),
'type' => CRM_Utils_Type::T_INT,
],
'entity_table' => [
- 'title' => 'Entity Table',
+ 'title' => ts('Entity Table'),
'api.default' => 'civicrm_contribution',
],
'entity_id' => [
- 'title' => 'Entity ID',
+ 'title' => ts('Entity ID'),
'type' => CRM_Utils_Type::T_INT,
'api.aliases' => ['contribution_id'],
],
'trxn_id' => [
- 'title' => 'Transaction ID',
+ 'title' => ts('Transaction ID'),
'type' => CRM_Utils_Type::T_STRING,
],
+ 'trxn_date' => [
+ 'title' => ts('Payment Date'),
+ 'type' => CRM_Utils_Type::T_TIMESTAMP,
+ ],
];
}
$this->submitPayment(70);
$contribution = $this->callAPISuccessGetSingle('Contribution', ['id' => $this->_contributionId]);
$this->assertEquals('Partially paid', $contribution['contribution_status']);
+ $this->assertEquals('2019-04-01 00:00:00', $contribution['receive_date']);
+ $payment = $this->callAPISuccessGetSingle('Payment', ['contribution_id' => $contribution['id']]);
+ $this->assertEquals('2017-04-11 13:05:11', $payment['trxn_date']);
// pay additional amount
$this->submitPayment(30);
'total_amount' => $amount,
'currency' => 'USD',
'financial_type_id' => 1,
- 'receive_date' => '04/21/2015',
- 'receive_date_time' => '11:27PM',
'trxn_date' => '2017-04-11 13:05:11',
'payment_processor_id' => 0,
'is_email_receipt' => $isEmailReceipt,
$orderParams = array_merge($this->_params, [
'contribution_status_id' => 'Pending',
'is_pay_later' => 1,
+ 'receive_date' => '2019-04-01',
]);
$contribution = $this->callAPISuccess('Order', 'create', $orderParams);
$contribution = $this->callAPISuccessGetSingle('Contribution', ['id' => $contribution['id']]);