Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-16402

Implement new factory class for instantiating a payment object throughout core

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.6.2
    • Fix Version/s: 4.7
    • Component/s: None
    • Labels:
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code

      Description

      OLD

      $paymentProcessor =CRM_Financial_BAO_PaymentProcessor::getPayment($payment_processor_id, 'live');
      $paymentObject = CRM_Core_Payment::singleton('test', $paymentProcessor);

      NEW
      Preferred -
      Civi\Payment\System::singleton()->getById($paymentProcessorID)

      or if you already have the array call getByProcessor - (getByID actually does this call internally)

      Civi\Payment\System::singleton()->getByProcessor($paymentProcessor)

      You can resort to getByName if you REALLY have to - but I can't think of a case where you should have the payment processor name and NOT the ID

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: