Make a purchase API call with incomplete flag
@link http://docs.sailthru.com/api/purchase
@return array API result
514979
public function purchaseIncomplete($email, array $items, $message_id, array $options = [ ]) {
        return $this->purchase($email, $items, 1, $message_id, $options);
    }
324128
protected function __apiStore ()
    {
        $data = $this->getInputData ();

        $record = HCAppsTokens::create (array_get ($data, 'record'));

        return $this->apiShow ($record->id);
    }
644676
def get_purchase(self, purchase_id, purchase_key='sid'):
        
        data = {'purchase_id': purchase_id,
                'purchase_key': purchase_key}
        return self.api_get('purchase', data)
119779
protected function getPaymentTransactionStructure()
    {
        return [
            'usage'              => $this->usage,
            'remote_ip'          => $this->remote_ip,
            'return_success_url' => $this->return_success_url,
            'return_failure_url' => $this->return_failure_url,
            'amount'             => $this->transformAmount($this->amount, $this->currency),
            'currency'           => $this->currency,
            'consumer_reference' => $this->consumer_reference,
            'national_id'        => $this->national_id,
            'birth_date'         => $this->birth_date,
            'customer_email'     => $this->customer_email,
            'billing_address'    => $this->getBillingAddressParamsStructure(),
            'shipping_address'   => $this->getShippingAddressParamsStructure()
        ];
    }
1138126
public function getData ()
	{
		
		// PaymentMethod independant checks
		$this->validate( 'transactionReference', 'currency', 'siteId', 'amount', 'description', 'returnUrl', 
				'notifyUrl', 'ipaddress' );
		
		// PaymentMethod specific checks
		$this->validatePaymentMethodSpecific();
		
		// Transaction data
		$data = array( 
				'ref' => $this->getTransactionReference(), 
				'currency' => $this->getCurrency(), 
				'site_id' => $this->getSiteId(), 
				'amount' => $this->getAmountInteger(), 
				'description' => $this->getDescription(), 
				'control_url' => $this->getNotifyUrl(), 
				'return_url' => $this->getReturnUrl(), 
				'return_url_failed' => $this->getCancelUrl(), 
				'ip_address' => $this->getIpAddress(), 
				'language' => $this->getLanguage() 
		);
		if ( $this->getPaymentMethod() == 'ideal' ) {
			$data['issuer_id'] = $this->getIssuer();
		}
		
		// Customer data
		$customerData = new CreditCard( $_POST );
		if ( $customerData && strlen( $customerData->getFirstName() ) && strlen( $customerData->getLastName() ) ) {
			$data['customer'] = array( 
					'first_name' => $customerData->getFirstName(), 
					'last_name' => $customerData->getLastName(), 
					'company_name' => $customerData->getCompany(), 
					'address' => $customerData->getAddress1(), 
					'city' => $customerData->getCity(), 
					'state' => $customerData->getState(), 
					'postal_code' => $customerData->getPostcode(), 
					'country_code' => $customerData->getCountry(), 
					'phone_number' => $customerData->getPhone(), 
					'email' => $customerData->getEmail() 
			);
		}
		
		return $data;
	}
706909
protected function getPurchaseParams()
    {
        $url = "checkout/complete/{$this->data_order['order_id']}";

        return array(
            'currency' => $this->data_order['currency'],
            'amount' => $this->data_order['total_formatted_number'],
            'returnUrl' => $this->controller->url($url, array('authorize_return' => true), true),
            'cancelUrl' => $this->controller->url($url, array('authorize_return' => true, 'cancel' => true), true)
        );
    }
1070583
public function transaction()
    {
        $options = array(
            'order' => 'desc',
            'sort' => 'created',
            'limit' => array(0, $this->config->get('dashboard_limit', 10)));

        $items = $this->transaction->getList($options);

        array_walk($items, function (&$item) {
            $this->setItemTotalFormatted($item, $this->price);
        });

        return $items;
    }
441342
public function getData()
    {
        $this->validate('transactionReference', 'MD', 'PaRes');

        return [
            'opcode'     => 3,
            'payment_id' => $this->getTransactionReference(),
            'PaRes'      => $this->getPaRes(),
            'MD'         => $this->getMD(),
            'token'      => $this->getRequestToken(),
        ];
    }
868726
public function closeBillingAgreement ()
    {
        $closeBillingAgreementRequest = new OffAmazonPaymentsService_Model_CloseBillingAgreementRequest();
        $closeBillingAgreementRequest->setSellerId($this->_sellerId);
        $closeBillingAgreementRequest->setAmazonBillingAgreementId($this->_amazonBillingAgreementId);
        $closeBillingAgreementRequest->setClosureReason("Automatic payment complete");
        
        return $this->_service->closeBillingAgreement($closeBillingAgreementRequest);
    }
1150617
protected function completePayment()
    {
        if ($this->controller->isQuery('paid')) {
            $gateway = $this->getGateway();
            $this->response = $gateway->completePurchase($this->getPurchaseParams())->send();
            $this->processResponse();
        }
    }
217587
public function getIssues()
	{
		if ( isset($this->result['issues']) ) {
			$result = array();

			foreach ( $this->result['issues'] as $issue ) {
				$result[] = new Issue($issue);
			}

			return $result;
		}

		return array();
	}
656333
public function getProbes()
	{
		$client = new \Guzzle\Service\Client('https://api.pingdom.com/api/2.0');

		/** @var $request \Guzzle\Http\Message\Request */
		$request = $client->get('probes', array('App-Key' => $this->token));
		$request->setAuth($this->username, $this->password);
		$response = $request->send();
		$response = json_decode($response->getBody(), true);
		$probes   = array();

		foreach ($response['probes'] as $attributes) {
			$probes[] = new Probe\Server($attributes);
		}

		return $probes;
	}
901002
public function getItemsApi()
    {
        if (!$this->apis->has('items')) {
            $this->apis->set('items', new Items($this));
        }

        return $this->apis->get('items');
    }
1343624
public function request()
    {
        //load payments by date
        $this->getPagSeguroAbandoned();

        if ($this->_PagSeguroPaymentList->getTransactions()) {
            foreach ($this->_PagSeguroPaymentList->getTransactions() as $payment) {
                date_default_timezone_set('UTC');
                $order = \UOL\PagSeguro\Helper\Data::getReferenceDecryptOrderID($payment->getReference());
                $order = $this->_order->load($order);
                if ($this->getStoreReference() == \UOL\PagSeguro\Helper\Data::getReferenceDecrypt(
                        $payment->getReference())
                ) {
                    if (!is_null($this->_session->getData('store_id'))) {
                        array_push($this->_arrayPayments, $this->build($payment, $order));
                    }
                    if ($order) {
                        array_push($this->_arrayPayments, $this->build($payment, $order));
                    }
                }
            }
        }
        date_default_timezone_set($this->_timezone->getConfigTimezone());

        return $this->_arrayPayments;
    }
351658
public function usediscount()
    {   
        $code_to_search = $this->request->param("ID");
        $code = false;
        $curr = $this->getDiscount();
        
        if (!$code_to_search) {
            return $this->httpError(404, "Page not found");
        }
        
        // First check if the discount is already added (so we don't
        // query the DB if we don't have to).
        if (!$curr || ($curr && $curr->Code != $code_to_search)) {
            $this->setDiscount($code_to_search);
            ShoppingCartFactory::create()->save();
        } elseif ($curr && $code->Code == $code_to_search) {
            $code = $this->getDiscount();
        }

        $this->extend("onBeforeUseDiscount");

        return $this
            ->customise([
                "Discount" => $code
            ])->render();
    }
1372217
public static function paymentReceived(Purchase $purchase, $amount)
    {
        $purchase->received += $amount;

        if ($purchase->received >= $purchase->grandTotal) {
            $purchase->paid = time();

            $purchase->item->seller->sendEmail(
                'You have received a payment',
                'emails.item.paid',
                [
                    'total' => $purchase->received,
                    'item_name' => $purchase->item->name,
                    'buyer_name' => $purchase->name,
                    'buyer_street1' => $purchase->street1,
                    'buyer_street2' => $purchase->street2,
                    'buyer_city' => $purchase->city,
                    'buyer_county' => $purchase->county,
                    'buyer_postcode' => $purchase->postcode,
                    'buyer_country' => Iso3166::get($purchase->country)->name,
                    'has_delivery' => $purchase->hasDelivery(),
                    'has_address' => $purchase->hasAddress(),
                    'purchase_id' => $purchase->purchaseId,
                    'full' => $purchase->received == 0,
                ]
            );

            $purchase->buyer->sendEmail(
                'Receipt for your item',
                'emails.item.receipt',
                [
                    'total' => $purchase->received,
                    'item_name' => $purchase->item->name,
                    'seller_name' => $purchase->name,
                    'seller_street1' => $purchase->street1,
                    'seller_street2' => $purchase->street2,
                    'seller_city' => $purchase->city,
                    'seller_county' => $purchase->county,
                    'seller_postcode' => $purchase->postcode,
                    'seller_country' => Iso3166::get($purchase->country)->name,
                    'full' => $purchase->received == 0,
                    'has_delivery' => $purchase->hasDelivery(),
                    'has_address' => $purchase->hasAddress(),
                    'is_paid' => $purchase->isPaid()
                ]
            );
        }

        $purchase->save();
    }
559713
public function buy($params = null)
    {
        $requestor = new Requestor($this->_apiKey);
        $url = $this->instanceUrl() . '/buy';

        if ($params instanceof Rate) {
            $clone = $params;
            unset($params);
            $params['carrier'] = $clone->carrier;
            $params['service'] = $clone->service;
        }

        list($response, $apiKey) = $requestor->request('post', $url, $params);
        $this->refreshFrom($response, $apiKey, false);

        return $this;
    }