123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Payment\Gateway\Http;
- /**
- * Class Transfer
- */
- class Transfer implements TransferInterface
- {
- /**
- * Name of Auth username field
- */
- const AUTH_USERNAME = 'username';
- /**
- * Name of Auth password field
- */
- const AUTH_PASSWORD = 'password';
- /**
- * @var array
- */
- private $clientConfig;
- /**
- * @var array
- */
- private $headers;
- /**
- * @var string
- */
- private $method;
- /**
- * @var array|string
- */
- private $body;
- /**
- * @var string
- */
- private $uri;
- /**
- * @var bool
- */
- private $encode;
- /**
- * @var array
- */
- private $auth;
- /**
- * @param array $clientConfig
- * @param array $headers
- * @param array|string $body
- * @param array $auth
- * @param string $method
- * @param string $uri
- * @param bool $encode
- */
- public function __construct(
- array $clientConfig,
- array $headers,
- $body,
- array $auth,
- $method,
- $uri,
- $encode
- ) {
- $this->clientConfig = $clientConfig;
- $this->headers = $headers;
- $this->body = $body;
- $this->auth = $auth;
- $this->method = $method;
- $this->uri = $uri;
- $this->encode = $encode;
- }
- /**
- * Returns gateway client configuration
- *
- * @return array
- */
- public function getClientConfig()
- {
- return $this->clientConfig;
- }
- /**
- * Returns method used to place request
- *
- * @return string|int
- */
- public function getMethod()
- {
- return (string)$this->method;
- }
- /**
- * Returns headers
- *
- * @return array
- */
- public function getHeaders()
- {
- return $this->headers;
- }
- /**
- * Returns request body
- *
- * @return array|string
- */
- public function getBody()
- {
- return $this->body;
- }
- /**
- * Returns URI
- *
- * @return string
- */
- public function getUri()
- {
- return (string)$this->uri;
- }
- /**
- * @return boolean
- */
- public function shouldEncode()
- {
- return $this->encode;
- }
- /**
- * Returns Auth username
- *
- * @return string
- */
- public function getAuthUsername()
- {
- return $this->auth[self::AUTH_USERNAME];
- }
- /**
- * Returns Auth password
- *
- * @return string
- */
- public function getAuthPassword()
- {
- return $this->auth[self::AUTH_PASSWORD];
- }
- }
|