public function build(AbstractGateway $gateway, array $parameters)
 {
     if (!$gateway instanceof Gateway) {
         throw new \InvalidArgumentException('BitPayGatewayBuilder is responsible for set-up Omnipay\\Bitpay\\Gateway classes only');
     }
     $gateway->setApiKey($parameters['api_key']);
     return $gateway;
 }
Example #2
0
 /**
  * @param ClientInterface $httpClient
  * @param HttpRequest $httpRequest
  */
 public function __construct(ClientInterface $httpClient = null, HttpRequest $httpRequest = null)
 {
     parent::__construct($httpClient, $httpRequest);
     $this->setCurrency('USD');
     $this->setTestMode(false);
     $this->setLang('en');
 }
Example #3
0
 public function __construct(ClientInterface $httpClient = null, HttpRequest $httpRequest = null)
 {
     parent::__construct($httpClient, $httpRequest);
     $this->httpClient->getEventDispatcher()->addListener('request.error', function ($event) {
         if ($event['response']->isClientError()) {
             $event->stopPropagation();
         }
     });
 }
Example #4
0
 public function getDefaultParameters()
 {
     $settings = parent::getDefaultParameters();
     $settings['signature'] = '';
     $settings['min'] = '';
     $settings['encoded'] = '';
     $settings['checksum'] = '';
     $settings['endpoint'] = '';
     return $settings;
 }
Example #5
0
 protected function createRequest($class, array $parameters)
 {
     if (!$this->signator instanceof DataSignator) {
         throw new \Exception('Cannot create request, Signator is not set');
     }
     if ($this->timezone === null) {
         $this->timezone = new \DateTimeZone('UTC');
     }
     $request = parent::createRequest($class, $parameters);
     $request->setSignator($this->signator);
     $request->setTimestamp((new \DateTime(null, $this->timezone))->format('dmYHis'));
     return $request;
 }
 public function getDefaultParameters()
 {
     $settings = parent::getDefaultParameters();
     $settings['sid'] = '';
     $settings['rcode'] = '';
     $settings['tid'] = '';
     $settings['postback_url'] = '';
     $settings['redirect_url'] = '';
     $settings['timestamp'] = '';
     $settings['firstname'] = '';
     $settings['lastname'] = '';
     $settings['address'] = '';
     $settings['suburb_city'] = '';
     $settings['state'] = '';
     $settings['postcode'] = '';
     $settings['country'] = '';
     $settings['email'] = '';
     $settings['phone'] = '';
     $settings['currency'] = '';
     $settings['shipping_firstname'] = '';
     $settings['shipping_lastname'] = '';
     $settings['shipping_address'] = '';
     $settings['shipping_suburb_city'] = '';
     $settings['shipping_state'] = '';
     $settings['shipping_postcode'] = '';
     $settings['shipping_country'] = '';
     $settings['amount_shipping'] = '0.00';
     $settings['amount_coupon'] = '0.00';
     $settings['amount_tax'] = '0.00';
     $settings['item_quantity[]'] = '1';
     $settings['item_name[]'] = '';
     $settings['item_no[]'] = '';
     $settings['item_desc[]'] = '';
     $settings['item_amount_unit[]'] = '0.00';
     $settings['tx_action'] = array('PREAUTH', 'PAYMENT');
     $settings['campaignid'] = '';
     $settings['affiliateid'] = '';
     $settings['ref1'] = '';
     $settings['ref2'] = '';
     $settings['ref3'] = '';
     $settings['ref4'] = '';
     return $settings;
 }
Example #7
0
 /**
  * Create Request
  *
  * This overrides the parent createRequest function ensuring that the OAuth
  * 2.0 access token is passed along with the request data -- unless the
  * request is a RestTokenRequest in which case no token is needed.  If no
  * token is available then a new one is created (e.g. if there has been no
  * token request or the current token has expired).
  *
  * @param string $class
  * @param array $parameters
  * @return \Omnipay\PayPal\Message\AbstractRestRequest
  */
 public function createRequest($class, array $parameters = array())
 {
     if (!$this->hasToken() && $class != '\\Omnipay\\PayPal\\Message\\RestTokenRequest') {
         // This will set the internal token parameter which the parent
         // createRequest will find when it calls getParameters().
         $this->getToken(true);
     }
     return parent::createRequest($class, $parameters);
 }
Example #8
0
 /**
  * Create a new gateway instance
  *
  * @param ClientInterface $httpClient  A Guzzle client to make API calls with
  * @param HttpRequest     $httpRequest A Symfony HTTP request object
  * @param Braintree_Gateway $braintree The Braintree gateway
  */
 public function __construct(ClientInterface $httpClient = null, HttpRequest $httpRequest = null, Braintree_Gateway $braintree = null)
 {
     $this->braintree = $braintree ?: Braintree_Configuration::gateway();
     parent::__construct($httpClient, $httpRequest);
 }
Example #9
0
 public function acceptNotification()
 {
     $this->setToken($this->getAccessToken()->getToken());
     $parameters = ['transactionReference' => $this->httpRequest->query->get('id')];
     $request = parent::createRequest(StatusRequest::class, $parameters);
     /** @var PurchaseResponse $response */
     $response = $request->send();
     $parameters = ['code' => $response->getCode(), 'transactionReference' => $response->getTransactionReference(), 'transactionId' => $response->getTransactionId(), 'data' => $response->getData()];
     return new Notification($this->httpRequest, $this->httpClient, $parameters);
 }
Example #10
0
 /**
  * Provider constructor.
  * @param $gateway
  * @param array $settings
  */
 public function __construct($gateway, array $settings)
 {
     $this->gateway = $gateway;
     $this->settings = $settings;
     $this->gateway->initialize($settings);
 }
Example #11
0
 /**
  * Purchase.
  *
  * @param  array  $parameters
  *
  * @return Omnipay\Common\Message\AbstractResponse
  */
 public function purchase(array $parameters)
 {
     $this->setPaymentData($parameters);
     return $this->gateway->purchase($parameters)->send();
 }
 public function getDefaultParameters()
 {
     return parent::getDefaultParameters() + array('testMode' => false, 'goId' => '', 'secureKey' => '');
 }
Example #13
0
 protected function createRequest($class, array $parameters)
 {
     if (!$this->signator instanceof DataSignator) {
         throw new \Exception('Cannot create request, Signator is not set');
     }
     if (!$this->verifier instanceof DataVerifier) {
         throw new \Exception('Cannot create request, Verifier is not set');
     }
     /** @var \Omnipay\Csob\Message\AbstractRequest $request */
     $request = parent::createRequest($class, $parameters);
     $request->setSignator($this->signator);
     $request->setVerifier($this->verifier);
     $apiUrl = $this->getApiUrl();
     $request->setApiUrl($apiUrl);
     return $request;
 }
Example #14
0
 /**
  * @return array
  */
 public function getDefaultParameters()
 {
     parent::getDefaultParameters();
     return array('type' => '', 'merchant' => '', 'agreement' => '', 'apikey' => '', 'privatekey' => '', 'language' => '', 'google_analytics_tracking_id' => '', 'google_analytics_client_id' => '', 'description' => '', 'order_id' => '', 'payment_methods' => array());
 }
 /**
  * Create a new gateway instance
  *
  * @param ClientInterface $httpClient  A Guzzle client to make API calls with
  * @param HttpRequest     $httpRequest A Symfony HTTP request object
  * @param \SoapClient     $soapClient
  */
 public function __construct(ClientInterface $httpClient = null, HttpRequest $httpRequest = null, \SoapClient $soapClient = null)
 {
     parent::__construct($httpClient, $httpRequest);
     $this->soapClient = $soapClient;
 }