/** * @param Payment $payment * @param bool $convertForFind * * @return array */ protected function convertPaymentToRequest(Payment $payment, $convertForFind = false) { $common = ['currency' => $payment->getCurrency(), 'amount' => $payment->getAmount(), 'reason' => $payment->getReason(), 'beneficiary_id' => $payment->getBeneficiaryId(), 'conversion_id' => $payment->getConversionId()]; if ($convertForFind) { return $common + ['short_reference' => $payment->getShortReference(), 'status' => $payment->getStatus()]; } $paymentDate = $payment->getPaymentDate(); return $common + ['reference' => $payment->getReference(), 'payment_date' => null === $paymentDate ? $paymentDate : $paymentDate->format(DateTime::RFC3339), 'payment_type' => $payment->getPaymentType()]; }