Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Purchaseorder.php
Go to the documentation of this file.
1 <?php
7 
9 
19 {
20  const PAYMENT_METHOD_PURCHASEORDER_CODE = 'purchaseorder';
21 
28 
32  protected $_formBlockType = \Magento\OfflinePayments\Block\Form\Purchaseorder::class;
33 
37  protected $_infoBlockType = \Magento\OfflinePayments\Block\Info\Purchaseorder::class;
38 
44  protected $_isOffline = true;
45 
53  public function assignData(\Magento\Framework\DataObject $data)
54  {
55  $this->getInfoInstance()->setPoNumber($data->getPoNumber());
56  return $this;
57  }
58 
66  public function validate()
67  {
68  parent::validate();
69 
70  if (empty($this->getInfoInstance()->getPoNumber())) {
71  throw new LocalizedException(__('Purchase order number is a required field.'));
72  }
73 
74  return $this;
75  }
76 }
assignData(\Magento\Framework\DataObject $data)
__()
Definition: __.php:13