Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. /**
  2. *
  3. * @ This file is created by http://DeZender.Net
  4. * @ deZender (PHP7 Decoder for ionCube Encoder)
  5. *
  6. * @ Version : 4.0.9.0
  7. * @ Author : DeZender
  8. * @ Release on : 08.08.2019
  9. * @ Official site : http://DeZender.Net
  10. *
  11. */
  12.  
  13. namespace Gate\Pagseguro\Message;
  14.  
  15. class CompletePurchaseRequest extends \Gate\Common\Request
  16. {
  17. protected $endpoint = 'https://ws.pagseguro.uol.com.br/v2/transactions/';
  18. protected $test_endpoint = 'https://ws.sandbox.pagseguro.uol.com.br/v2/transactions/';
  19.  
  20. public function getSellerEmail()
  21. {
  22. return $this->getParameter('seller_email');
  23. }
  24.  
  25. public function getToken()
  26. {
  27. return $this->getParameter('token');
  28. }
  29.  
  30. public function getIsTest()
  31. {
  32. return $this->getParameter('isTest');
  33. }
  34.  
  35. public function call()
  36. {
  37. if ($this->getIsTest()) {
  38. $this->endpoint = $this->test_endpoint;
  39. }
  40.  
  41. $response = $this->sendData(['email' => $this->getSellerEmail(), 'token' => $this->getToken(), 'reference' => $this->getHash()], ['Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'], 'GET');
  42.  
  43. if (is_array($response)) {
  44. return $response;
  45. }
  46.  
  47. $result = ads_xml_to_array($response);
  48.  
  49. if (isset($result['error'])) {
  50. return ['error' => $result['error']['code'] . ': ' . $result['error']['message']];
  51. }
  52.  
  53. $this->endpoint .= $result['transactions']['transaction']['code'] . '?email=' . $this->getSellerEmail() . '&token=' . $this->getToken();
  54. $response = $this->sendData([], ['Content-Type' => 'application/x-www-form-urlencoded; charset=UTF-8'], 'GET');
  55.  
  56. if (is_array($response)) {
  57. return $response;
  58. ..............................................................
  59. ........................................
  60. ................
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement