Esempio n. 1
0
 /**
  * Constructor.
  *
  * @param  \Cartalyst\Stripe\ConfigInterface  $config
  * @return void
  */
 public function __construct(ConfigInterface $config)
 {
     parent::__construct(['base_url' => $config->base_url]);
     // Set the Config repository instance
     $this->config = $config;
     // Prepare the request headers
     $this->prepareRequestHeaders();
     // Register some before events
     $this->getEmitter()->on('before', function (BeforeEvent $event) {
         // Get the event request
         $request = $event->getRequest();
         // Set the Stripe API key
         $request->setHeader('Authorization', "Basic " . base64_encode($this->config->api_key));
         // Set the query aggregator
         $request->getQuery()->setAggregator(Query::phpAggregator(false));
     });
 }
Esempio n. 2
0
    /**
     * Get the aggregator used to join multi-valued field parameters
     *
     * @return callable
     */
    final protected function getAggregator()
    {
        if (!$this->aggregator) {
            $this->aggregator = Query::phpAggregator();
        }

        return $this->aggregator;
    }
Esempio n. 3
0
 public function testPhpEncodesNoNumericIndices()
 {
     $agg = Query::phpAggregator(false);
     $result = $agg($this->encodeData);
     $this->assertEquals(array('t[v1][]' => ['a', '1'], 't[v2]' => ['b'], 't[v3][v4]' => ['c'], 't[v3][v5]' => ['d']), $result);
 }