Advertisement
Guest User

Untitled

a guest
Mar 6th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ This file is created by http://DeZender.Net
  5. * @ deZender (PHP5 Decoder for Zend Guard Encoder)
  6. *
  7. * @ Version : 3.0.4.0
  8. * @ Author : DeZender
  9. * @ Release on : 02.04.2017
  10. * @ Official site : http://DeZender.Net
  11. *
  12. */
  13.  
  14. namespace Gate\Squareup;
  15.  
  16. class SquareupGateway extends Gate\Common\Gateway
  17. {
  18. public function __construct()
  19. {
  20. parent::__construct('squareup');
  21. }
  22.  
  23. public function purchase()
  24. {
  25. $access_token = $this->getPersonalAccessToken();
  26. $request = new Libs\SquareConnect\Api\Location($access_token);
  27. $locations = $request->getLocations();
  28.  
  29. if (!empty($locations)) {
  30. $transaction = new Libs\SquareConnect\Api\TransactionApi($access_token, $request->getLocationId(), $this->getPurchaseOptions());
  31. return $transaction->getStatus();
  32. }
  33. }
  34.  
  35. public function getPurchaseOptions()
  36. {
  37. $idempotencyKey = uniqid();
  38. return array(
  39. 'idempotency_key' => $idempotencyKey,
  40. 'shipping_address' => array('address_line_1' => $this->getAddress(), 'locality' => $this->getCity(), 'administrative_district_level_1' => $this->getState(), 'postal_code' => $this->getPostalCode(), 'country' => $this->getCountry()),
  41. 'billing_address' => array('address_line_1' => $this->getAddress(), 'address_line_2' => $this->getAddress(), 'administrative_district_level_1' => $this->getState(), 'locality' => $this->getCity(), 'postal_code' => $this->getPostalCode(), 'country' => $this->getCountry()),
  42. 'amount_money' => array('amount' => $this->getAmount(), 'currency' => $this->getCurrency()),
  43. 'card_nonce' => $this->getCardNonse(),
  44. 'reference_id' => $this->getHash(),
  45. ...........................................................................
  46. .......................................
  47. ...........
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement