@@ -8,93 +8,93 @@  | 
                                                    ||
| 8 | 8 | class Gateway  | 
                                                        
| 9 | 9 |  { | 
                                                        
| 10 | 10 | |
| 11 | - /**  | 
                                                        |
| 12 | - * @param Client  | 
                                                        |
| 13 | - */  | 
                                                        |
| 14 | - private $client;  | 
                                                        |
| 15 | -  | 
                                                        |
| 16 | -  | 
                                                        |
| 17 | - /**  | 
                                                        |
| 18 | - *  | 
                                                        |
| 19 | - * @var String  | 
                                                        |
| 20 | - */  | 
                                                        |
| 21 | - private $merchantID;  | 
                                                        |
| 22 | -  | 
                                                        |
| 23 | -  | 
                                                        |
| 24 | - /**  | 
                                                        |
| 25 | - *  | 
                                                        |
| 26 | - * @var String  | 
                                                        |
| 27 | - */  | 
                                                        |
| 28 | - private $merchantAccessCode;  | 
                                                        |
| 29 | -  | 
                                                        |
| 30 | - /**  | 
                                                        |
| 31 | - * @var string  | 
                                                        |
| 32 | - */  | 
                                                        |
| 33 | - private $url;  | 
                                                        |
| 34 | -  | 
                                                        |
| 35 | -  | 
                                                        |
| 36 | - /**  | 
                                                        |
| 37 | - *  | 
                                                        |
| 38 | - * @var array  | 
                                                        |
| 39 | - */  | 
                                                        |
| 40 | - private $data = [];  | 
                                                        |
| 41 | -  | 
                                                        |
| 42 | - public function __construct(Client $client, $url = 'https://migs.mastercard.com.au/vpcdps')  | 
                                                        |
| 43 | -	{ | 
                                                        |
| 44 | - $this->client = $client;  | 
                                                        |
| 45 | - $this->url = $url;  | 
                                                        |
| 46 | - }  | 
                                                        |
| 47 | -  | 
                                                        |
| 48 | - public static function create() : self  | 
                                                        |
| 49 | -	{ | 
                                                        |
| 50 | -  | 
                                                        |
| 51 | - return new self(new Client([  | 
                                                        |
| 52 | - 'base_uri' => 'https://migs.mastercard.com.au/vpcdps',  | 
                                                        |
| 53 | - ]));  | 
                                                        |
| 54 | - }  | 
                                                        |
| 55 | -  | 
                                                        |
| 56 | - public function setUrl(string $url) : void  | 
                                                        |
| 57 | -	{ | 
                                                        |
| 58 | - $this->url = $url;  | 
                                                        |
| 59 | - }  | 
                                                        |
| 60 | -  | 
                                                        |
| 61 | - public function setMerchantID(string $id) : void  | 
                                                        |
| 62 | -	{ | 
                                                        |
| 63 | - $this->merchantID = $id;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 65 | -  | 
                                                        |
| 66 | - public function setAccessCode(string $code) : void  | 
                                                        |
| 67 | -	{ | 
                                                        |
| 68 | - $this->merchantAccessCode = $code;  | 
                                                        |
| 69 | - }  | 
                                                        |
| 70 | -  | 
                                                        |
| 71 | - public function purchase(array $data) : self  | 
                                                        |
| 72 | -	{ | 
                                                        |
| 73 | - $this->data = $data;  | 
                                                        |
| 74 | - return $this;  | 
                                                        |
| 75 | - }  | 
                                                        |
| 76 | -  | 
                                                        |
| 77 | - public function send() : Charge  | 
                                                        |
| 78 | -	{ | 
                                                        |
| 79 | - $request = ChargeRequest::create($this->getData());  | 
                                                        |
| 80 | - return $this->charge($request);  | 
                                                        |
| 81 | - }  | 
                                                        |
| 82 | -  | 
                                                        |
| 83 | - private function getData() : array  | 
                                                        |
| 84 | -	{ | 
                                                        |
| 85 | - return array_merge(  | 
                                                        |
| 86 | - $this->data,  | 
                                                        |
| 87 | - [  | 
                                                        |
| 88 | - MerchantFields::MERCHANT_ID => $this->merchantID,  | 
                                                        |
| 89 | - MerchantFields::MERCHANT_ACCESSCODE => $this->merchantAccessCode,  | 
                                                        |
| 90 | - ]  | 
                                                        |
| 91 | - );  | 
                                                        |
| 92 | - }  | 
                                                        |
| 93 | -  | 
                                                        |
| 94 | - public function charge(ChargeRequest $charge) : Charge  | 
                                                        |
| 95 | -	{ | 
                                                        |
| 96 | -		$response = $this->client->request('POST', $this->url, ['form_params' => $charge->toArray()]); | 
                                                        |
| 97 | -  | 
                                                        |
| 98 | - return new Charge($response->getBody()->getContents());  | 
                                                        |
| 99 | - }  | 
                                                        |
| 11 | + /**  | 
                                                        |
| 12 | + * @param Client  | 
                                                        |
| 13 | + */  | 
                                                        |
| 14 | + private $client;  | 
                                                        |
| 15 | +  | 
                                                        |
| 16 | +  | 
                                                        |
| 17 | + /**  | 
                                                        |
| 18 | + *  | 
                                                        |
| 19 | + * @var String  | 
                                                        |
| 20 | + */  | 
                                                        |
| 21 | + private $merchantID;  | 
                                                        |
| 22 | +  | 
                                                        |
| 23 | +  | 
                                                        |
| 24 | + /**  | 
                                                        |
| 25 | + *  | 
                                                        |
| 26 | + * @var String  | 
                                                        |
| 27 | + */  | 
                                                        |
| 28 | + private $merchantAccessCode;  | 
                                                        |
| 29 | +  | 
                                                        |
| 30 | + /**  | 
                                                        |
| 31 | + * @var string  | 
                                                        |
| 32 | + */  | 
                                                        |
| 33 | + private $url;  | 
                                                        |
| 34 | +  | 
                                                        |
| 35 | +  | 
                                                        |
| 36 | + /**  | 
                                                        |
| 37 | + *  | 
                                                        |
| 38 | + * @var array  | 
                                                        |
| 39 | + */  | 
                                                        |
| 40 | + private $data = [];  | 
                                                        |
| 41 | +  | 
                                                        |
| 42 | + public function __construct(Client $client, $url = 'https://migs.mastercard.com.au/vpcdps')  | 
                                                        |
| 43 | +    { | 
                                                        |
| 44 | + $this->client = $client;  | 
                                                        |
| 45 | + $this->url = $url;  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | +  | 
                                                        |
| 48 | + public static function create() : self  | 
                                                        |
| 49 | +    { | 
                                                        |
| 50 | +  | 
                                                        |
| 51 | + return new self(new Client([  | 
                                                        |
| 52 | + 'base_uri' => 'https://migs.mastercard.com.au/vpcdps',  | 
                                                        |
| 53 | + ]));  | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | +  | 
                                                        |
| 56 | + public function setUrl(string $url) : void  | 
                                                        |
| 57 | +    { | 
                                                        |
| 58 | + $this->url = $url;  | 
                                                        |
| 59 | + }  | 
                                                        |
| 60 | +  | 
                                                        |
| 61 | + public function setMerchantID(string $id) : void  | 
                                                        |
| 62 | +    { | 
                                                        |
| 63 | + $this->merchantID = $id;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | +  | 
                                                        |
| 66 | + public function setAccessCode(string $code) : void  | 
                                                        |
| 67 | +    { | 
                                                        |
| 68 | + $this->merchantAccessCode = $code;  | 
                                                        |
| 69 | + }  | 
                                                        |
| 70 | +  | 
                                                        |
| 71 | + public function purchase(array $data) : self  | 
                                                        |
| 72 | +    { | 
                                                        |
| 73 | + $this->data = $data;  | 
                                                        |
| 74 | + return $this;  | 
                                                        |
| 75 | + }  | 
                                                        |
| 76 | +  | 
                                                        |
| 77 | + public function send() : Charge  | 
                                                        |
| 78 | +    { | 
                                                        |
| 79 | + $request = ChargeRequest::create($this->getData());  | 
                                                        |
| 80 | + return $this->charge($request);  | 
                                                        |
| 81 | + }  | 
                                                        |
| 82 | +  | 
                                                        |
| 83 | + private function getData() : array  | 
                                                        |
| 84 | +    { | 
                                                        |
| 85 | + return array_merge(  | 
                                                        |
| 86 | + $this->data,  | 
                                                        |
| 87 | + [  | 
                                                        |
| 88 | + MerchantFields::MERCHANT_ID => $this->merchantID,  | 
                                                        |
| 89 | + MerchantFields::MERCHANT_ACCESSCODE => $this->merchantAccessCode,  | 
                                                        |
| 90 | + ]  | 
                                                        |
| 91 | + );  | 
                                                        |
| 92 | + }  | 
                                                        |
| 93 | +  | 
                                                        |
| 94 | + public function charge(ChargeRequest $charge) : Charge  | 
                                                        |
| 95 | +    { | 
                                                        |
| 96 | +        $response = $this->client->request('POST', $this->url, ['form_params' => $charge->toArray()]); | 
                                                        |
| 97 | +  | 
                                                        |
| 98 | + return new Charge($response->getBody()->getContents());  | 
                                                        |
| 99 | + }  | 
                                                        |
| 100 | 100 | }  |