|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Gvp Class using API |
| 4 | + */ |
| 5 | + |
| 6 | +namespace Omnipay\Gvp; |
| 7 | + |
| 8 | +use Omnipay\Common\AbstractGateway; |
| 9 | +use Omnipay\Common\Message\AbstractRequest; |
| 10 | +use Omnipay\Common\Message\RequestInterface; |
| 11 | +use Omnipay\Gvp\Messages\AuthorizeRequest; |
| 12 | +use Omnipay\Gvp\Messages\CaptureRequest; |
| 13 | +use Omnipay\Gvp\Messages\CompletePurchaseRequest; |
| 14 | +use Omnipay\Gvp\Messages\PurchaseRequest; |
| 15 | + |
| 16 | + |
| 17 | +/** |
| 18 | + * @method \Omnipay\Common\Message\NotificationInterface acceptNotification(array $options = array()) |
| 19 | + * @method \Omnipay\Common\Message\RequestInterface completeAuthorize(array $options = array()) |
| 20 | + * @method \Omnipay\Common\Message\RequestInterface refund(array $options = array()) |
| 21 | + * @method \Omnipay\Common\Message\RequestInterface fetchTransaction(array $options = []) |
| 22 | + * @method \Omnipay\Common\Message\RequestInterface void(array $options = array()) |
| 23 | + * @method \Omnipay\Common\Message\RequestInterface createCard(array $options = array()) |
| 24 | + * @method \Omnipay\Common\Message\RequestInterface updateCard(array $options = array()) |
| 25 | + * @method \Omnipay\Common\Message\RequestInterface deleteCard(array $options = array()) |
| 26 | + */ |
| 27 | +class Gateway extends AbstractGateway |
| 28 | +{ |
| 29 | + /** |
| 30 | + * Get gateway display name |
| 31 | + * |
| 32 | + * This can be used by carts to get the display name for each gateway. |
| 33 | + * @return string |
| 34 | + */ |
| 35 | + public function getName(): string |
| 36 | + { |
| 37 | + return 'Gvp'; |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * @return string |
| 42 | + */ |
| 43 | + public function getMerchantId(): string |
| 44 | + { |
| 45 | + return $this->getParameter('merchantId'); |
| 46 | + } |
| 47 | + |
| 48 | + /** |
| 49 | + * @param string $value |
| 50 | + * @return Gateway |
| 51 | + */ |
| 52 | + public function setMerchantId(string $value): Gateway |
| 53 | + { |
| 54 | + return $this->setParameter('merchantId', $value); |
| 55 | + } |
| 56 | + |
| 57 | + /** |
| 58 | + * @return string |
| 59 | + */ |
| 60 | + public function getTerminalId(): string |
| 61 | + { |
| 62 | + return $this->getParameter('terminalId'); |
| 63 | + } |
| 64 | + |
| 65 | + /** |
| 66 | + * @param string $value |
| 67 | + * @return Gateway |
| 68 | + */ |
| 69 | + public function setTerminalId(string $value): Gateway |
| 70 | + { |
| 71 | + return $this->setParameter('terminalId', $value); |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * @param array $parameters |
| 76 | + * @return AbstractRequest|RequestInterface |
| 77 | + */ |
| 78 | + public function authorize(array $parameters = []): RequestInterface |
| 79 | + { |
| 80 | + return $this->createRequest(AuthorizeRequest::class, $parameters); |
| 81 | + } |
| 82 | + |
| 83 | + /** |
| 84 | + * @param array $parameters |
| 85 | + * @return AbstractRequest|RequestInterface |
| 86 | + */ |
| 87 | + public function capture(array $parameters = []): RequestInterface |
| 88 | + { |
| 89 | + return $this->createRequest(CaptureRequest::class, $parameters); |
| 90 | + } |
| 91 | + |
| 92 | + /** |
| 93 | + * @param array $parameters |
| 94 | + * @return RequestInterface |
| 95 | + */ |
| 96 | + public function purchase(array $parameters = []): RequestInterface |
| 97 | + { |
| 98 | + return $this->createRequest(PurchaseRequest::class, $parameters); |
| 99 | + } |
| 100 | + |
| 101 | + /** |
| 102 | + * @param array $parameters |
| 103 | + * @return RequestInterface |
| 104 | + */ |
| 105 | + public function completePurchase(array $parameters = []): RequestInterface |
| 106 | + { |
| 107 | + return $this->createRequest(CompletePurchaseRequest::class, $parameters); |
| 108 | + } |
| 109 | +} |
0 commit comments