+--------------------------------------------------------------------+
| CiviCRM version 4.7 |
+--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2016 |
+ | Copyright CiviCRM LLC (c) 2004-2017 |
+--------------------------------------------------------------------+
| This file is a part of CiviCRM. |
| |
/**
*
* @package CRM
- * @copyright CiviCRM LLC (c) 2004-2016
+ * @copyright CiviCRM LLC (c) 2004-2017
*/
class CRM_Core_Payment_Manual extends CRM_Core_Payment {
* @return array
*/
public function getPaymentFormFields() {
+ if (!$this->isBackOffice()) {
+ return array();
+ }
+
+ $paymentInstrument = CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'payment_instrument_id', $this->getPaymentInstrumentID());
+ if ($paymentInstrument === 'Credit Card') {
+ // @todo - return credit_card_type field once the underlying code works to extract this field.
+ // Note the problem is this should be stored in civicrm_financial_trxn.credit_card_type.
+ // However there is an ambiguity as that field is an integer & should hence be called
+ // credit_card_type_id, or it should store 'visa' It probably makes sense to fix that before going much
+ // further as the code I've seen makes it clear that it will require work arounds.
+ return array('credit_card_type', 'pan_truncation');
+ }
+ elseif ($paymentInstrument === 'Check') {
+ // Really we should render check_number here, but we need to review how we edit
+ // check_numebr since we expose it as editable on the contribution form,
+ // even though it should only be editable from a transation specific form.
+ return array();
+ }
return array();
}
+
/**
* Process payment.
*
$this->result = $result;
}
+ /**
+ * Set payment instrument id.
+ *
+ * @param int $paymentInstrumentID
+ */
+ public function setPaymentInstrumentID($paymentInstrumentID) {
+ $this->paymentInstrumentID = $paymentInstrumentID;
+ }
+
/**
* Get the name of the payment type.
*
* @return string
*/
public function getPaymentTypeLabel() {
- return '';
+ return CRM_Core_PseudoConstant::getName('CRM_Contribute_BAO_Contribution', 'payment_instrument_id', $this->getPaymentInstrumentID());
}
/**
return TRUE;
}
+ /**
+ * Are back office payments supported.
+ *
+ * @return bool
+ */
+ protected function supportsBackOffice() {
+ return TRUE;
+ }
+
/**
* Submit a manual payment.
*