NullPaymentProvider.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Vault\Model\Method;
  7. use Magento\Framework\DataObject;
  8. use Magento\Payment\Model\InfoInterface;
  9. use Magento\Payment\Model\MethodInterface;
  10. use Magento\Quote\Api\Data\CartInterface;
  11. class NullPaymentProvider implements MethodInterface
  12. {
  13. /**
  14. * Retrieve payment method code
  15. *
  16. * @return string
  17. *
  18. */
  19. public function getCode()
  20. {
  21. return null;
  22. }
  23. /**
  24. * Retrieve block type for method form generation
  25. *
  26. * @return string
  27. *
  28. * @deprecated 100.1.0
  29. */
  30. public function getFormBlockType()
  31. {
  32. return null;
  33. }
  34. /**
  35. * Retrieve payment method title
  36. *
  37. * @return string
  38. *
  39. */
  40. public function getTitle()
  41. {
  42. return null;
  43. }
  44. /**
  45. * Store id setter
  46. * @param int $storeId
  47. * @return void
  48. */
  49. public function setStore($storeId)
  50. {
  51. return null;
  52. }
  53. /**
  54. * Store id getter
  55. * @return int
  56. */
  57. public function getStore()
  58. {
  59. return null;
  60. }
  61. /**
  62. * Check order availability
  63. *
  64. * @return bool
  65. *
  66. */
  67. public function canOrder()
  68. {
  69. return false;
  70. }
  71. /**
  72. * Check authorize availability
  73. *
  74. * @return bool
  75. *
  76. */
  77. public function canAuthorize()
  78. {
  79. return false;
  80. }
  81. /**
  82. * Check capture availability
  83. *
  84. * @return bool
  85. *
  86. */
  87. public function canCapture()
  88. {
  89. return false;
  90. }
  91. /**
  92. * Check partial capture availability
  93. *
  94. * @return bool
  95. *
  96. */
  97. public function canCapturePartial()
  98. {
  99. return false;
  100. }
  101. /**
  102. * Check whether capture can be performed once and no further capture possible
  103. *
  104. * @return bool
  105. *
  106. */
  107. public function canCaptureOnce()
  108. {
  109. return false;
  110. }
  111. /**
  112. * Check refund availability
  113. *
  114. * @return bool
  115. *
  116. */
  117. public function canRefund()
  118. {
  119. return false;
  120. }
  121. /**
  122. * Check partial refund availability for invoice
  123. *
  124. * @return bool
  125. *
  126. */
  127. public function canRefundPartialPerInvoice()
  128. {
  129. return false;
  130. }
  131. /**
  132. * Check void availability
  133. * @return bool
  134. *
  135. */
  136. public function canVoid()
  137. {
  138. return false;
  139. }
  140. /**
  141. * Using internal pages for input payment data
  142. * Can be used in admin
  143. *
  144. * @return bool
  145. */
  146. public function canUseInternal()
  147. {
  148. return false;
  149. }
  150. /**
  151. * Can be used in regular checkout
  152. *
  153. * @return bool
  154. */
  155. public function canUseCheckout()
  156. {
  157. return false;
  158. }
  159. /**
  160. * Can be edit order (renew order)
  161. *
  162. * @return bool
  163. *
  164. */
  165. public function canEdit()
  166. {
  167. return false;
  168. }
  169. /**
  170. * Check fetch transaction info availability
  171. *
  172. * @return bool
  173. *
  174. */
  175. public function canFetchTransactionInfo()
  176. {
  177. return false;
  178. }
  179. /**
  180. * Fetch transaction info
  181. *
  182. * @param InfoInterface $payment
  183. * @param string $transactionId
  184. * @return array
  185. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  186. *
  187. */
  188. public function fetchTransactionInfo(InfoInterface $payment, $transactionId)
  189. {
  190. return [];
  191. }
  192. /**
  193. * Retrieve payment system relation flag
  194. *
  195. * @return bool
  196. *
  197. */
  198. public function isGateway()
  199. {
  200. return false;
  201. }
  202. /**
  203. * Retrieve payment method online/offline flag
  204. *
  205. * @return bool
  206. *
  207. */
  208. public function isOffline()
  209. {
  210. return false;
  211. }
  212. /**
  213. * Flag if we need to run payment initialize while order place
  214. *
  215. * @return bool
  216. *
  217. */
  218. public function isInitializeNeeded()
  219. {
  220. return false;
  221. }
  222. /**
  223. * To check billing country is allowed for the payment method
  224. *
  225. * @param string $country
  226. * @return bool
  227. */
  228. public function canUseForCountry($country)
  229. {
  230. return false;
  231. }
  232. /**
  233. * Check method for processing with base currency
  234. *
  235. * @param string $currencyCode
  236. * @return bool
  237. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  238. */
  239. public function canUseForCurrency($currencyCode)
  240. {
  241. return false;
  242. }
  243. /**
  244. * Retrieve block type for display method information
  245. *
  246. * @return string
  247. *
  248. * @deprecated 100.1.0
  249. */
  250. public function getInfoBlockType()
  251. {
  252. return null;
  253. }
  254. /**
  255. * Retrieve payment information model object
  256. *
  257. * @return InfoInterface
  258. * @throws \Magento\Framework\Exception\LocalizedException
  259. *
  260. * @deprecated 100.1.0
  261. */
  262. public function getInfoInstance()
  263. {
  264. return null;
  265. }
  266. /**
  267. * Retrieve payment information model object
  268. *
  269. * @param InfoInterface $info
  270. * @return void
  271. *
  272. * @deprecated 100.1.0
  273. */
  274. public function setInfoInstance(InfoInterface $info)
  275. {
  276. return null;
  277. }
  278. /**
  279. * Validate payment method information object
  280. *
  281. * @return $this
  282. * @throws \Magento\Framework\Exception\LocalizedException
  283. *
  284. */
  285. public function validate()
  286. {
  287. return $this;
  288. }
  289. /**
  290. * Order payment method
  291. *
  292. * @param InfoInterface $payment
  293. * @param float $amount
  294. * @return $this
  295. *
  296. */
  297. public function order(\Magento\Payment\Model\InfoInterface $payment, $amount)
  298. {
  299. return $this;
  300. }
  301. /**
  302. * Authorize payment method
  303. *
  304. * @param InfoInterface $payment
  305. * @param float $amount
  306. * @return $this
  307. *
  308. */
  309. public function authorize(\Magento\Payment\Model\InfoInterface $payment, $amount)
  310. {
  311. return $this;
  312. }
  313. /**
  314. * Capture payment method
  315. *
  316. * @param InfoInterface $payment
  317. * @param float $amount
  318. * @return $this
  319. *
  320. */
  321. public function capture(\Magento\Payment\Model\InfoInterface $payment, $amount)
  322. {
  323. return $this;
  324. }
  325. /**
  326. * Refund specified amount for payment
  327. *
  328. * @param InfoInterface $payment
  329. * @param float $amount
  330. * @return $this
  331. *
  332. */
  333. public function refund(\Magento\Payment\Model\InfoInterface $payment, $amount)
  334. {
  335. return $this;
  336. }
  337. /**
  338. * Cancel payment method
  339. *
  340. * @param InfoInterface $payment
  341. * @return $this
  342. *
  343. */
  344. public function cancel(\Magento\Payment\Model\InfoInterface $payment)
  345. {
  346. return $this;
  347. }
  348. /**
  349. * Void payment method
  350. *
  351. * @param InfoInterface $payment
  352. * @return $this
  353. *
  354. */
  355. public function void(\Magento\Payment\Model\InfoInterface $payment)
  356. {
  357. return $this;
  358. }
  359. /**
  360. * Whether this method can accept or deny payment
  361. * @return bool
  362. *
  363. */
  364. public function canReviewPayment()
  365. {
  366. return false;
  367. }
  368. /**
  369. * Attempt to accept a payment that us under review
  370. *
  371. * @param InfoInterface $payment
  372. * @return false
  373. * @throws \Magento\Framework\Exception\LocalizedException
  374. *
  375. */
  376. public function acceptPayment(InfoInterface $payment)
  377. {
  378. return false;
  379. }
  380. /**
  381. * Attempt to deny a payment that us under review
  382. *
  383. * @param InfoInterface $payment
  384. * @return false
  385. * @throws \Magento\Framework\Exception\LocalizedException
  386. *
  387. */
  388. public function denyPayment(InfoInterface $payment)
  389. {
  390. return false;
  391. }
  392. /**
  393. * Retrieve information from payment configuration
  394. *
  395. * @param string $field
  396. * @param int|string|null|\Magento\Store\Model\Store $storeId
  397. *
  398. * @return mixed
  399. */
  400. public function getConfigData($field, $storeId = null)
  401. {
  402. return null;
  403. }
  404. /**
  405. * Assign data to info model instance
  406. *
  407. * @param DataObject $data
  408. * @return $this
  409. *
  410. */
  411. public function assignData(DataObject $data)
  412. {
  413. return $this;
  414. }
  415. /**
  416. * Check whether payment method can be used
  417. *
  418. * @param CartInterface|null $quote
  419. * @return bool
  420. */
  421. public function isAvailable(CartInterface $quote = null)
  422. {
  423. return false;
  424. }
  425. /**
  426. * Is active
  427. *
  428. * @param int|null $storeId
  429. * @return bool
  430. */
  431. public function isActive($storeId = null)
  432. {
  433. return false;
  434. }
  435. /**
  436. * Method that will be executed instead of authorize or capture
  437. * if flag isInitializeNeeded set to true
  438. *
  439. * @param string $paymentAction
  440. * @param object $stateObject
  441. *
  442. * @return $this
  443. * @SuppressWarnings(PHPMD.UnusedFormalParameter)
  444. *
  445. * @deprecated 100.1.0
  446. */
  447. public function initialize($paymentAction, $stateObject)
  448. {
  449. return $this;
  450. }
  451. /**
  452. * Get config payment action url
  453. * Used to universalize payment actions when processing payment place
  454. *
  455. * @return string
  456. *
  457. */
  458. public function getConfigPaymentAction()
  459. {
  460. return null;
  461. }
  462. }