Details
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