/** * Return method title for payment selection page * * @param \Magento\Payment\Model\MethodInterface $method * @return string */ public function getMethodTitle(\Magento\Payment\Model\MethodInterface $method) { $form = $this->getChildBlock('payment.method.' . $method->getCode()); if ($form && $form->hasMethodTitle()) { return $form->getMethodTitle(); } return $method->getTitle(); }
/** * Convert quote payment object to payment data object * * @param \Magento\Payment\Model\MethodInterface $object * @return \Magento\Checkout\Service\V1\Data\Cart\PaymentMethod */ public function toDataObject(\Magento\Payment\Model\MethodInterface $object) { $data = [QuotePaymentMethod::CODE => $object->getCode(), QuotePaymentMethod::TITLE => $object->getTitle()]; return $this->builder->populateWithArray($data)->create(); }