allow vendord
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
All checks were successful
Build, Push and Deploy / build-and-push (push) Successful in 3m3s
Gitea Actions Demo / Explore-Gitea-Actions (push) Successful in 16s
Build, Push and Deploy / deploy-staging (push) Successful in 32s
Build, Push and Deploy / deploy-production (push) Has been skipped
Build, Push and Deploy / cleanup (push) Successful in 1s
This commit is contained in:
390
vendor/omnipay/stripe/src/Message/AbstractRequest.php
vendored
Normal file
390
vendor/omnipay/stripe/src/Message/AbstractRequest.php
vendored
Normal file
@@ -0,0 +1,390 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Abstract Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
use Money\Currency;
|
||||
use Money\Money;
|
||||
use Money\Number;
|
||||
use Money\Parser\DecimalMoneyParser;
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
|
||||
/**
|
||||
* Stripe Abstract Request.
|
||||
*
|
||||
* This is the parent class for all Stripe requests.
|
||||
*
|
||||
* Test modes:
|
||||
*
|
||||
* Stripe accounts have test-mode API keys as well as live-mode
|
||||
* API keys. These keys can be active at the same time. Data
|
||||
* created with test-mode credentials will never hit the credit
|
||||
* card networks and will never cost anyone money.
|
||||
*
|
||||
* Unlike some gateways, there is no test mode endpoint separate
|
||||
* to the live mode endpoint, the Stripe API endpoint is the same
|
||||
* for test and for live.
|
||||
*
|
||||
* Setting the testMode flag on this gateway has no effect. To
|
||||
* use test mode just use your test mode API key.
|
||||
*
|
||||
* You can use any of the cards listed at https://stripe.com/docs/testing
|
||||
* for testing.
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api
|
||||
*/
|
||||
abstract class AbstractRequest extends \Omnipay\Common\Message\AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Live or Test Endpoint URL.
|
||||
*
|
||||
* @var string URL
|
||||
*/
|
||||
protected $endpoint = 'https://api.stripe.com/v1';
|
||||
|
||||
/**
|
||||
* Get the gateway API Key.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApiKey()
|
||||
{
|
||||
return $this->getParameter('apiKey');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the gateway API Key.
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setApiKey($value)
|
||||
{
|
||||
return $this->setParameter('apiKey', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getCardToken()
|
||||
{
|
||||
return $this->getCardReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function setCardToken($value)
|
||||
{
|
||||
return $this->setCardReference($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the customer reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCustomerReference()
|
||||
{
|
||||
return $this->getParameter('customerReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the customer reference.
|
||||
*
|
||||
* Used when calling CreateCard on an existing customer. If this
|
||||
* parameter is not set then a new customer is created.
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setCustomerReference($value)
|
||||
{
|
||||
return $this->setParameter('customerReference', $value);
|
||||
}
|
||||
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->getParameter('metadata');
|
||||
}
|
||||
|
||||
public function setMetadata($value)
|
||||
{
|
||||
return $this->setParameter('metadata', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConnectedStripeAccountHeader()
|
||||
{
|
||||
return $this->getParameter('connectedStripeAccount');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest
|
||||
*/
|
||||
public function setConnectedStripeAccountHeader($value)
|
||||
{
|
||||
return $this->setParameter('connectedStripeAccount', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getIdempotencyKeyHeader()
|
||||
{
|
||||
return $this->getParameter('idempotencyKey');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStripeVersion()
|
||||
{
|
||||
return $this->getParameter('stripeVersion');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest
|
||||
*/
|
||||
public function setStripeVersion($value)
|
||||
{
|
||||
return $this->setParameter('stripeVersion', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest
|
||||
*/
|
||||
public function setIdempotencyKeyHeader($value)
|
||||
{
|
||||
return $this->setParameter('idempotencyKey', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getExpand()
|
||||
{
|
||||
return $this->getParameter('expand');
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies which object relations (IDs) in the response should be expanded to include the entire object.
|
||||
*
|
||||
* @see https://stripe.com/docs/api/expanding_objects
|
||||
*
|
||||
* @param array $value
|
||||
* @return AbstractRequest
|
||||
*/
|
||||
public function setExpand($value)
|
||||
{
|
||||
return $this->setParameter('expand', $value);
|
||||
}
|
||||
|
||||
abstract public function getEndpoint();
|
||||
|
||||
/**
|
||||
* Get HTTP Method.
|
||||
*
|
||||
* This is nearly always POST but can be over-ridden in sub classes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'POST';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHeaders()
|
||||
{
|
||||
$headers = array();
|
||||
|
||||
if ($this->getConnectedStripeAccountHeader()) {
|
||||
$headers['Stripe-Account'] = $this->getConnectedStripeAccountHeader();
|
||||
}
|
||||
|
||||
if ($this->getIdempotencyKeyHeader()) {
|
||||
$headers['Idempotency-Key'] = $this->getIdempotencyKeyHeader();
|
||||
}
|
||||
|
||||
if ($this->getStripeVersion()) {
|
||||
$headers['Stripe-Version'] = $this->getStripeVersion();
|
||||
}
|
||||
|
||||
return $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function sendData($data)
|
||||
{
|
||||
$headers = array_merge(
|
||||
$this->getHeaders(),
|
||||
array('Authorization' => 'Basic ' . base64_encode($this->getApiKey() . ':'))
|
||||
);
|
||||
|
||||
$body = $data ? http_build_query($data, '', '&') : null;
|
||||
$httpResponse = $this->httpClient->request(
|
||||
$this->getHttpMethod(),
|
||||
$this->getExpandedEndpoint(),
|
||||
$headers,
|
||||
$body
|
||||
);
|
||||
|
||||
return $this->createResponse($httpResponse->getBody()->getContents(), $httpResponse->getHeaders());
|
||||
}
|
||||
|
||||
/**
|
||||
* Appends the `expand` properties to the endpoint as a querystring.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getExpandedEndpoint()
|
||||
{
|
||||
$endpoint = $this->getEndpoint();
|
||||
$expand = $this->getExpand();
|
||||
if (is_array($expand) && count($expand) > 0) {
|
||||
$queryParams = [];
|
||||
foreach ($expand as $key) {
|
||||
$queryParams[] = 'expand[]=' . $key;
|
||||
}
|
||||
$queryString = join('&', $queryParams);
|
||||
$endpoint .= '?' . $queryString;
|
||||
}
|
||||
|
||||
return $endpoint;
|
||||
}
|
||||
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->getParameter('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
return $this->setParameter('source', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $parameterName
|
||||
*
|
||||
* @return null|Money
|
||||
* @throws InvalidRequestException
|
||||
*/
|
||||
public function getMoney($parameterName = 'amount')
|
||||
{
|
||||
$amount = $this->getParameter($parameterName);
|
||||
|
||||
if ($amount instanceof Money) {
|
||||
return $amount;
|
||||
}
|
||||
|
||||
if ($amount !== null) {
|
||||
$moneyParser = new DecimalMoneyParser($this->getCurrencies());
|
||||
$currencyCode = $this->getCurrency() ?: 'USD';
|
||||
$currency = new Currency($currencyCode);
|
||||
|
||||
$number = Number::fromString($amount);
|
||||
|
||||
// Check for rounding that may occur if too many significant decimal digits are supplied.
|
||||
$decimal_count = strlen($number->getFractionalPart());
|
||||
$subunit = $this->getCurrencies()->subunitFor($currency);
|
||||
if ($decimal_count > $subunit) {
|
||||
throw new InvalidRequestException('Amount precision is too high for currency.');
|
||||
}
|
||||
|
||||
$money = $moneyParser->parse((string) $number, $currency->getCode());
|
||||
|
||||
// Check for a negative amount.
|
||||
if (!$this->negativeAmountAllowed && $money->isNegative()) {
|
||||
throw new InvalidRequestException('A negative amount is not allowed.');
|
||||
}
|
||||
|
||||
// Check for a zero amount.
|
||||
if (!$this->zeroAmountAllowed && $money->isZero()) {
|
||||
throw new InvalidRequestException('A zero amount is not allowed.');
|
||||
}
|
||||
|
||||
return $money;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card data.
|
||||
*
|
||||
* Because the stripe gateway uses a common format for passing
|
||||
* card data to the API, this function can be called to get the
|
||||
* data from the associated card object in the format that the
|
||||
* API requires.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCardData()
|
||||
{
|
||||
$card = $this->getCard();
|
||||
$card->validate();
|
||||
|
||||
$data = array();
|
||||
$data['object'] = 'card';
|
||||
|
||||
// If track data is present, only return data relevant to a card present charge
|
||||
$tracks = $card->getTracks();
|
||||
$cvv = $card->getCvv();
|
||||
$postcode = $card->getPostcode();
|
||||
if (!empty($postcode)) {
|
||||
$data['address_zip'] = $postcode;
|
||||
}
|
||||
if (!empty($cvv)) {
|
||||
$data['cvc'] = $cvv;
|
||||
}
|
||||
if (!empty($tracks)) {
|
||||
$data['swipe_data'] = $tracks;
|
||||
return $data;
|
||||
}
|
||||
|
||||
// If we got here, it's a card not present transaction, so include everything we have
|
||||
$data['number'] = $card->getNumber();
|
||||
$data['exp_month'] = $card->getExpiryMonth();
|
||||
$data['exp_year'] = $card->getExpiryYear();
|
||||
$data['name'] = $card->getName();
|
||||
$data['address_line1'] = $card->getAddress1();
|
||||
$data['address_line2'] = $card->getAddress2();
|
||||
$data['address_city'] = $card->getCity();
|
||||
$data['address_state'] = $card->getState();
|
||||
$data['address_country'] = $card->getCountry();
|
||||
$data['email'] = $card->getEmail();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
35
vendor/omnipay/stripe/src/Message/AttachSourceRequest.php
vendored
Normal file
35
vendor/omnipay/stripe/src/Message/AttachSourceRequest.php
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
/**
|
||||
* CreateSourceRequest
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Class CreateSourceRequest
|
||||
*
|
||||
* @link https://stripe.com/docs/api/sources/attach
|
||||
*/
|
||||
class AttachSourceRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference', 'source');
|
||||
|
||||
$data['source'] = $this->getSource();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*
|
||||
* @return string The endpoint for the create token request.
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/customers/' . $this->getCustomerReference() . '/sources';
|
||||
}
|
||||
}
|
||||
379
vendor/omnipay/stripe/src/Message/AuthorizeRequest.php
vendored
Normal file
379
vendor/omnipay/stripe/src/Message/AuthorizeRequest.php
vendored
Normal file
@@ -0,0 +1,379 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Authorize Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
use Money\Formatter\DecimalMoneyFormatter;
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
use Omnipay\Common\ItemBag;
|
||||
use Omnipay\Stripe\StripeItem;
|
||||
use Omnipay\Stripe\StripeItemBag;
|
||||
|
||||
/**
|
||||
* Stripe Authorize Request.
|
||||
*
|
||||
* An Authorize request is similar to a purchase request but the
|
||||
* charge issues an authorization (or pre-authorization), and no money
|
||||
* is transferred. The transaction will need to be captured later
|
||||
* in order to effect payment. Uncaptured charges expire in 7 days.
|
||||
*
|
||||
* Either a customerReference or a card is required. If a customerReference
|
||||
* is passed in then the cardReference must be the reference of a card
|
||||
* assigned to the customer. Otherwise, if you do not pass a customer ID,
|
||||
* the card you provide must either be a token, like the ones returned by
|
||||
* Stripe.js, or a dictionary containing a user's credit card details.
|
||||
*
|
||||
* IN OTHER WORDS: You cannot just pass a card reference into this request,
|
||||
* you must also provide a customer reference if you want to use a stored
|
||||
* card.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* <code>
|
||||
* // Create a gateway for the Stripe Gateway
|
||||
* // (routes to GatewayFactory::create)
|
||||
* $gateway = Omnipay::create('Stripe');
|
||||
*
|
||||
* // Initialise the gateway
|
||||
* $gateway->initialize(array(
|
||||
* 'apiKey' => 'MyApiKey',
|
||||
* ));
|
||||
*
|
||||
* // Create a credit card object
|
||||
* // This card can be used for testing.
|
||||
* $card = new CreditCard(array(
|
||||
* 'firstName' => 'Example',
|
||||
* 'lastName' => 'Customer',
|
||||
* 'number' => '4242424242424242',
|
||||
* 'expiryMonth' => '01',
|
||||
* 'expiryYear' => '2020',
|
||||
* 'cvv' => '123',
|
||||
* 'email' => 'customer@example.com',
|
||||
* 'billingAddress1' => '1 Scrubby Creek Road',
|
||||
* 'billingCountry' => 'AU',
|
||||
* 'billingCity' => 'Scrubby Creek',
|
||||
* 'billingPostcode' => '4999',
|
||||
* 'billingState' => 'QLD',
|
||||
* ));
|
||||
*
|
||||
* // Do an authorize transaction on the gateway
|
||||
* $transaction = $gateway->authorize(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'currency' => 'USD',
|
||||
* 'description' => 'This is a test authorize transaction.',
|
||||
* 'card' => $card,
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Authorize transaction was successful!\n";
|
||||
* $sale_id = $response->getTransactionReference();
|
||||
* echo "Transaction reference = " . $sale_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#charges
|
||||
*/
|
||||
class AuthorizeRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDestination()
|
||||
{
|
||||
return $this->getParameter('destination');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setDestination($value)
|
||||
{
|
||||
return $this->setParameter('destination', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->getParameter('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
return $this->setParameter('source', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferGroup()
|
||||
{
|
||||
return $this->getParameter('transferGroup');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setTransferGroup($value)
|
||||
{
|
||||
return $this->setParameter('transferGroup', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOnBehalfOf()
|
||||
{
|
||||
return $this->getParameter('onBehalfOf');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setOnBehalfOf($value)
|
||||
{
|
||||
return $this->setParameter('onBehalfOf', $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws InvalidRequestException
|
||||
*/
|
||||
public function getApplicationFee()
|
||||
{
|
||||
$money = $this->getMoney('applicationFee');
|
||||
|
||||
if ($money !== null) {
|
||||
$moneyFormatter = new DecimalMoneyFormatter($this->getCurrencies());
|
||||
|
||||
return $moneyFormatter->format($money);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment amount as an integer.
|
||||
*
|
||||
* @return integer
|
||||
* @throws InvalidRequestException
|
||||
*/
|
||||
public function getApplicationFeeInteger()
|
||||
{
|
||||
$money = $this->getMoney('applicationFee');
|
||||
|
||||
if ($money !== null) {
|
||||
return (integer) $money->getAmount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setApplicationFee($value)
|
||||
{
|
||||
return $this->setParameter('applicationFee', $value);
|
||||
}
|
||||
|
||||
public function getStatementDescriptor()
|
||||
{
|
||||
return $this->getParameter('statementDescriptor');
|
||||
}
|
||||
|
||||
public function setStatementDescriptor($value)
|
||||
{
|
||||
$value = str_replace(array('<', '>', '"', '\''), '', $value);
|
||||
|
||||
return $this->setParameter('statementDescriptor', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getReceiptEmail()
|
||||
{
|
||||
return $this->getParameter('receipt_email');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $email
|
||||
* @return $this
|
||||
*/
|
||||
public function setReceiptEmail($email)
|
||||
{
|
||||
$this->setParameter('receipt_email', $email);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A list of items in this order
|
||||
*
|
||||
* @return StripeItemBag|StripeItem[]|null A bag containing items in this order
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
return $this->getParameter('items');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the items in this order
|
||||
*
|
||||
* @param array $items An array of items in this order
|
||||
* @return AuthorizeRequest
|
||||
*/
|
||||
public function setItems($items)
|
||||
{
|
||||
if ($items && !$items instanceof ItemBag) {
|
||||
$items = new StripeItemBag($items);
|
||||
}
|
||||
|
||||
return $this->setParameter('items', $items);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('amount', 'currency');
|
||||
|
||||
$data = array();
|
||||
|
||||
$data['amount'] = $this->getAmountInteger();
|
||||
$data['currency'] = strtolower($this->getCurrency());
|
||||
$data['description'] = $this->getDescription();
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
$data['capture'] = 'false';
|
||||
|
||||
if ($items = $this->getItems()) {
|
||||
if (empty($this->getDescription())) {
|
||||
$itemDescriptions = [];
|
||||
foreach ($items as $n => $item) {
|
||||
$itemDescriptions[] = $item->getDescription();
|
||||
}
|
||||
$data['description'] = implode(" + ", $itemDescriptions);
|
||||
}
|
||||
|
||||
if ($this->validateLineItemsForLevel3($items)) {
|
||||
$lineItems = [];
|
||||
foreach ($items as $item) {
|
||||
$lineItem = [
|
||||
'product_code' => substr($item->getName(), 0, 12),
|
||||
'product_description' => substr($item->getDescription(), 0, 26)
|
||||
];
|
||||
if ($item->getPrice()) {
|
||||
$lineItem['unit_cost'] = $this->getAmountWithCurrencyPrecision($item->getPrice());
|
||||
}
|
||||
if ($item->getQuantity()) {
|
||||
$lineItem['quantity'] = $item->getQuantity();
|
||||
}
|
||||
if ($item->getTaxes()) {
|
||||
$lineItem['tax_amount'] = $this->getAmountWithCurrencyPrecision($item->getTaxes());
|
||||
}
|
||||
if ($item->getDiscount()) {
|
||||
$lineItem['discount_amount'] = $this->getAmountWithCurrencyPrecision($item->getDiscount());
|
||||
}
|
||||
$lineItems[] = $lineItem;
|
||||
}
|
||||
$data['level3'] = [
|
||||
'merchant_reference' => $this->getTransactionId(),
|
||||
'line_items' => $lineItems
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->getStatementDescriptor()) {
|
||||
$data['statement_descriptor'] = $this->getStatementDescriptor();
|
||||
}
|
||||
if ($this->getDestination()) {
|
||||
$data['destination'] = $this->getDestination();
|
||||
}
|
||||
|
||||
if ($this->getOnBehalfOf()) {
|
||||
$data['on_behalf_of'] = $this->getOnBehalfOf();
|
||||
}
|
||||
|
||||
if ($this->getApplicationFee()) {
|
||||
$data['application_fee'] = $this->getApplicationFeeInteger();
|
||||
}
|
||||
|
||||
if ($this->getTransferGroup()) {
|
||||
$data['transfer_group'] = $this->getTransferGroup();
|
||||
}
|
||||
|
||||
if ($this->getReceiptEmail()) {
|
||||
$data['receipt_email'] = $this->getReceiptEmail();
|
||||
}
|
||||
|
||||
if ($this->getSource()) {
|
||||
$data['source'] = $this->getSource();
|
||||
} elseif ($this->getCardReference()) {
|
||||
$data['source'] = $this->getCardReference();
|
||||
if ($this->getCustomerReference()) {
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
}
|
||||
} elseif ($this->getToken()) {
|
||||
$data['source'] = $this->getToken();
|
||||
if ($this->getCustomerReference()) {
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
}
|
||||
} elseif ($this->getCard()) {
|
||||
$data['source'] = $this->getCardData();
|
||||
} elseif ($this->getCustomerReference()) {
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
} else {
|
||||
// one of cardReference, token, or card is required
|
||||
$this->validate('source');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
private function getAmountWithCurrencyPrecision($amount)
|
||||
{
|
||||
return (int)round($amount * pow(10, $this->getCurrencyDecimalPlaces()));
|
||||
}
|
||||
|
||||
/**
|
||||
* For Stripe to accept Level 3 data, the sum of all the line items should equal the request's `amount`. This
|
||||
* method validates that the summation adds up as expected.
|
||||
*
|
||||
* @param StripeItemBag $items
|
||||
* @return bool
|
||||
*/
|
||||
private function validateLineItemsForLevel3(StripeItemBag $items)
|
||||
{
|
||||
$actualAmount = 0;
|
||||
foreach ($items as $item) {
|
||||
$actualAmount += $item->getQuantity() * $item->getPrice() + $item->getTaxes() - $item->getDiscount();
|
||||
}
|
||||
return (string)$actualAmount == (string)$this->getAmount();
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/charges';
|
||||
}
|
||||
}
|
||||
87
vendor/omnipay/stripe/src/Message/CancelSubscriptionRequest.php
vendored
Normal file
87
vendor/omnipay/stripe/src/Message/CancelSubscriptionRequest.php
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Cancel Subscription Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Cancel Subscription Request.
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/#cancel_subscription
|
||||
*/
|
||||
class CancelSubscriptionRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the subscription reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubscriptionReference()
|
||||
{
|
||||
return $this->getParameter('subscriptionReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set subscription reference.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return CancelSubscriptionRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSubscriptionReference($value)
|
||||
{
|
||||
return $this->setParameter('subscriptionReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether or not to cancel the subscription at period end.
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return CancelSubscriptionRequest provides a fluent interface.
|
||||
*/
|
||||
public function setAtPeriodEnd($value)
|
||||
{
|
||||
return $this->setParameter('atPeriodEnd', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether or not to cancel the subscription at period end.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getAtPeriodEnd()
|
||||
{
|
||||
return $this->getParameter('atPeriodEnd');
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference', 'subscriptionReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
// NOTE: Boolean must be passed as string
|
||||
// Otherwise it will be converted to numeric 0 or 1
|
||||
// Causing an error with the API
|
||||
if ($this->getAtPeriodEnd()) {
|
||||
$data['at_period_end'] = 'true';
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint
|
||||
.'/customers/'.$this->getCustomerReference()
|
||||
.'/subscriptions/'.$this->getSubscriptionReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
}
|
||||
48
vendor/omnipay/stripe/src/Message/CaptureRequest.php
vendored
Normal file
48
vendor/omnipay/stripe/src/Message/CaptureRequest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Capture Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Capture Request.
|
||||
*
|
||||
* Use this request to capture and process a previously created authorization.
|
||||
*
|
||||
* Example -- note this example assumes that the authorization has been successful
|
||||
* and that the authorization ID returned from the authorization is held in $auth_id.
|
||||
* See AuthorizeRequest for the first part of this example transaction:
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->capture(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'currency' => 'AUD',
|
||||
* ));
|
||||
* $transaction->setTransactionReference($auth_id);
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @see AuthorizeRequest
|
||||
*/
|
||||
class CaptureRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transactionReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($amount = $this->getAmountInteger()) {
|
||||
$data['amount'] = $amount;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/charges/'.$this->getTransactionReference().'/capture';
|
||||
}
|
||||
}
|
||||
21
vendor/omnipay/stripe/src/Message/Checkout/AbstractRequest.php
vendored
Normal file
21
vendor/omnipay/stripe/src/Message/Checkout/AbstractRequest.php
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Abstract Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Checkout;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intent Abstract Request.
|
||||
*
|
||||
* This is the parent class for all Stripe payment intent requests.
|
||||
* It adds just a getter and setter.
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
* @see \Omnipay\Stripe\Message\AbstractRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents
|
||||
*/
|
||||
abstract class AbstractRequest extends \Omnipay\Stripe\Message\AbstractRequest
|
||||
{
|
||||
}
|
||||
47
vendor/omnipay/stripe/src/Message/Checkout/FetchTransactionRequest.php
vendored
Normal file
47
vendor/omnipay/stripe/src/Message/Checkout/FetchTransactionRequest.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transaction Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Checkout;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transaction Request.
|
||||
* Example -- note this example assumes that the purchase has been successful
|
||||
* and that the transaction ID returned from the purchase is held in $sale_id.
|
||||
* See PurchaseRequest for the first part of this example transaction:
|
||||
* <code>
|
||||
* // Fetch the transaction so that details can be found for refund, etc.
|
||||
* $transaction = $gateway->fetchTransaction();
|
||||
* $transaction->setTransactionReference($sale_id);
|
||||
* $response = $transaction->send();
|
||||
* $data = $response->getData();
|
||||
* echo "Gateway fetchTransaction response data == " . print_r($data, true) . "\n";
|
||||
* </code>
|
||||
*
|
||||
* @see PurchaseRequest
|
||||
* @see Omnipay\Stripe\CheckoutGateway
|
||||
* @link https://stripe.com/docs/api/checkout/sessions/retrieve
|
||||
*/
|
||||
class FetchTransactionRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transactionReference');
|
||||
|
||||
$data = [];
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/checkout/sessions/'. $this->getTransactionReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
166
vendor/omnipay/stripe/src/Message/Checkout/PurchaseRequest.php
vendored
Normal file
166
vendor/omnipay/stripe/src/Message/Checkout/PurchaseRequest.php
vendored
Normal file
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Checkout Session Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Checkout;
|
||||
|
||||
/**
|
||||
* Stripe Checkout Session Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/checkout/sessions
|
||||
*/
|
||||
class PurchaseRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Set the success url
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest
|
||||
*/
|
||||
public function setSuccessUrl($value)
|
||||
{
|
||||
return $this->setParameter('success_url', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSuccessUrl()
|
||||
{
|
||||
return $this->getParameter('success_url');
|
||||
}
|
||||
/**
|
||||
* Set the cancel url
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest
|
||||
*/
|
||||
public function setCancelUrl($value)
|
||||
{
|
||||
return $this->setParameter('cancel_url', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCancelUrl()
|
||||
{
|
||||
return $this->getParameter('cancel_url');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the payment method types accepted url
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest
|
||||
*/
|
||||
public function setPaymentMethodTypes($value)
|
||||
{
|
||||
return $this->setParameter('payment_method_types', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPaymentMethodTypes()
|
||||
{
|
||||
return $this->getParameter('payment_method_types');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the payment method types accepted url
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest
|
||||
*/
|
||||
public function setMode($value)
|
||||
{
|
||||
return $this->setParameter('mode', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMode()
|
||||
{
|
||||
return $this->getParameter('mode');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the payment method types accepted url
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest
|
||||
*/
|
||||
public function setLineItems($value)
|
||||
{
|
||||
return $this->setParameter('line_items', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success url
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getLineItems()
|
||||
{
|
||||
return $this->getParameter('line_items');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the payment method types accepted url
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|PurchaseRequest
|
||||
*/
|
||||
public function setClientReferenceId($value)
|
||||
{
|
||||
return $this->setParameter('client_reference_id', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success url
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getClientReferenceId()
|
||||
{
|
||||
return $this->getParameter('client_reference_id');
|
||||
}
|
||||
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$data = array(
|
||||
'success_url' => $this->getSuccessUrl(),
|
||||
'cancel_url' => $this->getCancelUrl(),
|
||||
'payment_method_types' => $this->getPaymentMethodTypes(),
|
||||
'mode' => $this->getMode(),
|
||||
'line_items' => $this->getLineItems()
|
||||
);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/checkout/sessions';
|
||||
}
|
||||
}
|
||||
20
vendor/omnipay/stripe/src/Message/CompletePurchaseRequest.php
vendored
Normal file
20
vendor/omnipay/stripe/src/Message/CompletePurchaseRequest.php
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* CreateSourceRequest
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Class CreateSourceRequest
|
||||
*
|
||||
* TODO : Add docblock
|
||||
*/
|
||||
class CompletePurchaseRequest extends PurchaseRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = parent::getData();
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
114
vendor/omnipay/stripe/src/Message/CreateCardRequest.php
vendored
Normal file
114
vendor/omnipay/stripe/src/Message/CreateCardRequest.php
vendored
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Credit Card Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Create Credit Card Request.
|
||||
*
|
||||
* In the stripe system, creating a credit card requires passing
|
||||
* a customer ID. The card is then added to the customer's account.
|
||||
* If the customer has no default card then the newly added
|
||||
* card becomes the customer's default card.
|
||||
*
|
||||
* This call can be used to create a new customer or add a card
|
||||
* to an existing customer. If a customerReference is passed in then
|
||||
* a card is added to an existing customer. If there is no
|
||||
* customerReference passed in then a new customer is created. The
|
||||
* response in that case will then contain both a customer token
|
||||
* and a card token, and is essentially the same as CreateCustomerRequest
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* This example assumes that you have already created a
|
||||
* customer, and that the customer reference is stored in $customer_id.
|
||||
* See CreateCustomerRequest for the first part of this transaction.
|
||||
*
|
||||
* <code>
|
||||
* // Create a credit card object
|
||||
* // This card can be used for testing.
|
||||
* // The CreditCard object is also used for creating customers.
|
||||
* $new_card = new CreditCard(array(
|
||||
* 'firstName' => 'Example',
|
||||
* 'lastName' => 'Customer',
|
||||
* 'number' => '5555555555554444',
|
||||
* 'expiryMonth' => '01',
|
||||
* 'expiryYear' => '2020',
|
||||
* 'cvv' => '456',
|
||||
* 'email' => 'customer@example.com',
|
||||
* 'billingAddress1' => '1 Lower Creek Road',
|
||||
* 'billingCountry' => 'AU',
|
||||
* 'billingCity' => 'Upper Swan',
|
||||
* 'billingPostcode' => '6999',
|
||||
* 'billingState' => 'WA',
|
||||
* ));
|
||||
*
|
||||
* // Do a create card transaction on the gateway
|
||||
* $response = $gateway->createCard(array(
|
||||
* 'card' => $new_card,
|
||||
* 'customerReference' => $customer_id,
|
||||
* ))->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Gateway createCard was successful.\n";
|
||||
* // Find the card ID
|
||||
* $card_id = $response->getCardReference();
|
||||
* echo "Card ID = " . $card_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see CreateCustomerRequest
|
||||
* @link https://stripe.com/docs/api#create_card
|
||||
*/
|
||||
class CreateCardRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
// Only set the description if we are creating a new customer.
|
||||
if (!$this->getCustomerReference()) {
|
||||
$data['description'] = $this->getDescription();
|
||||
}
|
||||
|
||||
if ($this->getSource()) {
|
||||
$data['source'] = $this->getSource();
|
||||
} elseif ($this->getCardReference()) {
|
||||
$data['source'] = $this->getCardReference();
|
||||
} elseif ($this->getToken()) {
|
||||
$data['source'] = $this->getToken();
|
||||
} elseif ($this->getCard()) {
|
||||
$this->getCard()->validate();
|
||||
$data['source'] = $this->getCardData();
|
||||
// Only set the email address if we are creating a new customer.
|
||||
if (!$this->getCustomerReference()) {
|
||||
$data['email'] = $this->getCard()->getEmail();
|
||||
}
|
||||
} else {
|
||||
// one of token or card is required
|
||||
$this->validate('source');
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
if ($this->getCustomerReference()) {
|
||||
// Create a new card on an existing customer
|
||||
return $this->endpoint.'/customers/'.
|
||||
$this->getCustomerReference().'/cards';
|
||||
}
|
||||
// Create a new customer and card
|
||||
return $this->endpoint.'/customers';
|
||||
}
|
||||
|
||||
public function getCardData()
|
||||
{
|
||||
$data = parent::getCardData();
|
||||
unset($data['email']);
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
201
vendor/omnipay/stripe/src/Message/CreateCouponRequest.php
vendored
Normal file
201
vendor/omnipay/stripe/src/Message/CreateCouponRequest.php
vendored
Normal file
@@ -0,0 +1,201 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
|
||||
/**
|
||||
* Stripe Create Coupon Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/coupons/create
|
||||
*/
|
||||
class CreateCouponRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getAmountOff()
|
||||
{
|
||||
return $this->getParameter('amount_off');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setAmountOff($value)
|
||||
{
|
||||
return $this->setParameter('amount_off', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getPercentOff()
|
||||
{
|
||||
return $this->getParameter('percent_off');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setPercentOff($value)
|
||||
{
|
||||
return $this->setParameter('percent_off', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDurationInMonths()
|
||||
{
|
||||
return $this->getParameter('duration_in_months');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setDurationInMonths($value)
|
||||
{
|
||||
return $this->setParameter('duration_in_months', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getParameter('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
return $this->setParameter('name', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxRedemptions()
|
||||
{
|
||||
return $this->getParameter('max_redemptions');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setMaxRedemptions($value)
|
||||
{
|
||||
return $this->setParameter('duration_in_months', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getRedeemBy()
|
||||
{
|
||||
return $this->getParameter('redeem_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setRedeemBy($value)
|
||||
{
|
||||
return $this->setParameter('redeem_by', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->getParameter('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
return $this->setParameter('id', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
return $this->getParameter('duration');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return CreateCouponRequest
|
||||
*/
|
||||
public function setDuration($value)
|
||||
{
|
||||
return $this->setParameter('duration', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('duration');
|
||||
|
||||
$amountOff = $this->getAmountOff();
|
||||
$percentOff = $this->getPercentOff();
|
||||
|
||||
if (!isset($amountOff) && !isset($percentOff)) {
|
||||
throw new InvalidRequestException("Either amount_off or percent_off is required");
|
||||
}
|
||||
|
||||
$data = [
|
||||
'id' => $this->getId(),
|
||||
'duration' => $this->getDuration(),
|
||||
'amount_off' => $this->getAmountOff(),
|
||||
'currency' => $this->getCurrency(),
|
||||
'duration_in_months' => $this->getDurationInMonths(),
|
||||
'name' => $this->getName(),
|
||||
'max_redemptions' => $this->getMaxRedemptions(),
|
||||
'percent_off' => $this->getPercentOff(),
|
||||
'redeem_by' => $this->getRedeemBy(),
|
||||
];
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/coupons';
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'POST';
|
||||
}
|
||||
}
|
||||
174
vendor/omnipay/stripe/src/Message/CreateCustomerRequest.php
vendored
Normal file
174
vendor/omnipay/stripe/src/Message/CreateCustomerRequest.php
vendored
Normal file
@@ -0,0 +1,174 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Customer Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Create Customer Request.
|
||||
*
|
||||
* Customer objects allow you to perform recurring charges and
|
||||
* track multiple charges that are associated with the same customer.
|
||||
* The API allows you to create, delete, and update your customers.
|
||||
* You can retrieve individual customers as well as a list of all of
|
||||
* your customers.
|
||||
*
|
||||
* ### Examples
|
||||
*
|
||||
* #### Create Customer from Email Address
|
||||
*
|
||||
* This is the recommended way to create a customer object.
|
||||
*
|
||||
* <code>
|
||||
* $response = $gateway->createCustomer(array(
|
||||
* 'description' => 'Test Customer',
|
||||
* 'email' => 'test123@example.com',
|
||||
* ))->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Gateway createCustomer was successful.\n";
|
||||
* // Find the card ID
|
||||
* $customer_id = $response->getCustomerReference();
|
||||
* echo "Customer ID = " . $customer_id . "\n";
|
||||
* } else {
|
||||
* echo "Gateway createCustomer failed.\n";
|
||||
* echo "Error message == " . $response->getMessage() . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* The $customer_id can now be used in a createCard() call.
|
||||
*
|
||||
* #### Create Customer using Card Object
|
||||
*
|
||||
* Historically, this library used a card object to create customers.
|
||||
* Although this is no longer the recommended path, it is still supported.
|
||||
* Using this approach, a customer object and a card object can be created
|
||||
* at the same time.
|
||||
*
|
||||
* <code>
|
||||
* // Create a credit card object
|
||||
* // This card can be used for testing.
|
||||
* // The CreditCard object is also used for creating customers.
|
||||
* $card = new CreditCard(array(
|
||||
* 'firstName' => 'Example',
|
||||
* 'lastName' => 'Customer',
|
||||
* 'number' => '4242424242424242',
|
||||
* 'expiryMonth' => '01',
|
||||
* 'expiryYear' => '2020',
|
||||
* 'cvv' => '123',
|
||||
* 'email' => 'customer@example.com',
|
||||
* 'billingAddress1' => '1 Scrubby Creek Road',
|
||||
* 'billingCountry' => 'AU',
|
||||
* 'billingCity' => 'Scrubby Creek',
|
||||
* 'billingPostcode' => '4999',
|
||||
* 'billingState' => 'QLD',
|
||||
* ));
|
||||
*
|
||||
* // Do a create customer transaction on the gateway
|
||||
* $response = $gateway->createCustomer(array(
|
||||
* 'card' => $card,
|
||||
* ))->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Gateway createCustomer was successful.\n";
|
||||
* // Find the customer ID
|
||||
* $customer_id = $response->getCustomerReference();
|
||||
* echo "Customer ID = " . $customer_id . "\n";
|
||||
* // Find the card ID
|
||||
* $card_id = $response->getCardReference();
|
||||
* echo "Card ID = " . $card_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api#customers
|
||||
*/
|
||||
class CreateCustomerRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the customer's email address.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->getParameter('email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the customer's email address.
|
||||
*
|
||||
* @param string $value
|
||||
* @return CreateCustomerRequest provides a fluent interface.
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
return $this->setParameter('email', $value);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->getParameter('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the customer's name.
|
||||
*
|
||||
* @param string $value
|
||||
* @return CreateCustomerRequest provides a fluent interface.
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
return $this->setParameter('name', $value);
|
||||
}
|
||||
|
||||
public function getSource()
|
||||
{
|
||||
return $this->getParameter('source');
|
||||
}
|
||||
|
||||
public function setSource($value)
|
||||
{
|
||||
$this->setParameter('source', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
$data['description'] = $this->getDescription();
|
||||
|
||||
if ($this->getToken()) {
|
||||
$data['card'] = $this->getToken();
|
||||
|
||||
if ($this->getEmail()) {
|
||||
$data['email'] = $this->getEmail();
|
||||
}
|
||||
} elseif ($this->getCard()) {
|
||||
$data['card'] = $this->getCardData();
|
||||
$data['email'] = $this->getCard()->getEmail();
|
||||
} elseif ($this->getEmail()) {
|
||||
$data['email'] = $this->getEmail();
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if ($this->getSource()) {
|
||||
$data['source'] = $this->getSource();
|
||||
}
|
||||
|
||||
if ($this->getName()) {
|
||||
$data['name'] = $this->getName();
|
||||
}
|
||||
|
||||
if ($this->getPaymentMethod()) {
|
||||
$data['payment_method'] = $this->getPaymentMethod();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers';
|
||||
}
|
||||
}
|
||||
203
vendor/omnipay/stripe/src/Message/CreateInvoiceItemRequest.php
vendored
Normal file
203
vendor/omnipay/stripe/src/Message/CreateInvoiceItemRequest.php
vendored
Normal file
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Invoice Item Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Create Invoice Item Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#create_invoiceitem
|
||||
*
|
||||
* Providing the invoice-item reference will update the invoice-item
|
||||
* @link https://stripe.com/docs/api#update_invoiceitem
|
||||
*/
|
||||
class CreateInvoiceItemRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the invoice-item reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceItemReference()
|
||||
{
|
||||
return $this->getParameter('invoiceItemReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item reference
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setInvoiceItemReference($invoiceItemReference)
|
||||
{
|
||||
return $this->setParameter('invoiceItemReference', $invoiceItemReference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice-item amount
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->getParameter('amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item amount
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setAmount($value)
|
||||
{
|
||||
return $this->setParameter('amount', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item currency
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setCurrency($currency)
|
||||
{
|
||||
return $this->setParameter('currency', $currency);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice-item currency
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrency()
|
||||
{
|
||||
return $this->getParameter('currency');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item description
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setDescription($description)
|
||||
{
|
||||
return $this->setParameter('description', $description);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice-item description
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->getParameter('description');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item discountable
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setDiscountable($discountable)
|
||||
{
|
||||
return $this->setParameter('discountable', $discountable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice-item discountable
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDiscountable()
|
||||
{
|
||||
return $this->getParameter('discountable');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item invoice reference
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setInvoiceReference($invoiceReference)
|
||||
{
|
||||
return $this->setParameter('invoiceReference', $invoiceReference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice-item invoice reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceReference()
|
||||
{
|
||||
return $this->getParameter('invoiceReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the invoice-item subscription reference
|
||||
*
|
||||
* @return CreateInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSubscriptionReference($subscriptionReference)
|
||||
{
|
||||
return $this->setParameter('subscriptionReference', $subscriptionReference);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice-item subscription reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubscriptionReference()
|
||||
{
|
||||
return $this->getParameter('subscriptionReference');
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
if ($this->getInvoiceItemReference() == null) {
|
||||
$this->validate('customerReference', 'amount', 'currency');
|
||||
}
|
||||
|
||||
if ($this->getCustomerReference()) {
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
}
|
||||
|
||||
if ($this->getAmount()) {
|
||||
$data['amount'] = $this->getAmount();
|
||||
}
|
||||
|
||||
if ($this->getCurrency()) {
|
||||
$data['currency'] = $this->getCurrency();
|
||||
}
|
||||
|
||||
if ($this->getDescription()) {
|
||||
$data['description'] = $this->getDescription();
|
||||
}
|
||||
|
||||
if ($this->getDiscountable() !== null) {
|
||||
$data['discountable'] = $this->getDiscountable();
|
||||
}
|
||||
|
||||
if ($this->getInvoiceReference()) {
|
||||
$data['invoice'] = $this->getInvoiceReference();
|
||||
}
|
||||
|
||||
if ($this->getSubscriptionReference()) {
|
||||
$data['subscription'] = $this->getSubscriptionReference();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/invoiceitems'
|
||||
.($this->getInvoiceItemReference() != null ? '/'.$this->getInvoiceItemReference() : '');
|
||||
}
|
||||
}
|
||||
450
vendor/omnipay/stripe/src/Message/CreatePlanRequest.php
vendored
Normal file
450
vendor/omnipay/stripe/src/Message/CreatePlanRequest.php
vendored
Normal file
@@ -0,0 +1,450 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Plan Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Create Plan Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/plans/create
|
||||
*/
|
||||
class CreatePlanRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Set the plan ID
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
return $this->setParameter('id', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->getParameter('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan interval
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setInterval($value)
|
||||
{
|
||||
return $this->setParameter('interval', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan interval
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getInterval()
|
||||
{
|
||||
return $this->getParameter('interval');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan interval count
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setIntervalCount($value)
|
||||
{
|
||||
return $this->setParameter('interval_count', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan interval count
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getIntervalCount()
|
||||
{
|
||||
return $this->getParameter('interval_count');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan name
|
||||
* @deprecated use setNickname() instead
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
return $this->setNickname($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan name
|
||||
* @deprecated use getNickname() instead
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getNickname();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan statement descriptor
|
||||
* @deprecated Not used anymore
|
||||
*
|
||||
* @param $planStatementDescriptor
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setStatementDescriptor($planStatementDescriptor)
|
||||
{
|
||||
return $this->setParameter('statement_descriptor', $planStatementDescriptor);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan statement descriptor
|
||||
* @deprecated Not used anymore
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getStatementDescriptor()
|
||||
{
|
||||
return $this->getParameter('statement_descriptor');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan product
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setProduct($value)
|
||||
{
|
||||
return $this->setParameter('product', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan product
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public function getProduct()
|
||||
{
|
||||
return $this->getParameter('product');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan amount
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setAmount($value)
|
||||
{
|
||||
return $this->setParameter('amount', (integer)$value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan amount
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->getParameter('amount');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan tiers
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setTiers($value)
|
||||
{
|
||||
return $this->setParameter('tiers', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan tiers
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTiers()
|
||||
{
|
||||
return $this->getParameter('tiers');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan tiers mode
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setTiersMode($value)
|
||||
{
|
||||
return $this->setParameter('tiers_mode', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan tiers mode
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTiersMode()
|
||||
{
|
||||
return $this->getParameter('tiers_mode');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan nickname
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setNickname($value)
|
||||
{
|
||||
return $this->setParameter('nickname', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan nickname
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public function getNickname()
|
||||
{
|
||||
return $this->getParameter('nickname');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan metadata
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setMetadata($value)
|
||||
{
|
||||
return $this->setParameter('metadata', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan metadata
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public function getMetadata()
|
||||
{
|
||||
return $this->getParameter('metadata');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan active
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setActive($value)
|
||||
{
|
||||
return $this->setParameter('active', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan active
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public function getActive()
|
||||
{
|
||||
return $this->getParameter('active');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan billingScheme
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setBillingScheme($value)
|
||||
{
|
||||
return $this->setParameter('billing_scheme', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan billingScheme
|
||||
*
|
||||
* @return string|array
|
||||
*/
|
||||
public function getBillingScheme()
|
||||
{
|
||||
return $this->getParameter('billing_scheme');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan aggregate usage
|
||||
*
|
||||
* @param $planAggregateUsage
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setAggregateUsage($planAggregateUsage)
|
||||
{
|
||||
return $this->setParameter('aggregate_usage', $planAggregateUsage);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan aggregate usage
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAggregateUsage()
|
||||
{
|
||||
return $this->getParameter('aggregate_usage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan trial period days
|
||||
*
|
||||
* @param $planTrialPeriodDays
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setTrialPeriodDays($planTrialPeriodDays)
|
||||
{
|
||||
return $this->setParameter('trial_period_days', $planTrialPeriodDays);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan trial period days
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTrialPeriodDays()
|
||||
{
|
||||
return $this->getParameter('trial_period_days');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan transform usage
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setTransformUsage($value)
|
||||
{
|
||||
return $this->setParameter('transform_usage', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan transform usage
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTransformUsage()
|
||||
{
|
||||
return $this->getParameter('transform_usage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan usage type
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreatePlanRequest
|
||||
*/
|
||||
public function setUsageType($value)
|
||||
{
|
||||
return $this->setParameter('usage_type', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the plan usage type
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getUsageType()
|
||||
{
|
||||
return $this->getParameter('usage_type');
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('currency', 'interval', 'product');
|
||||
|
||||
if (null == $this->getBillingScheme() || 'per_unit' == $this->getBillingScheme()) {
|
||||
$this->validate('amount');
|
||||
} elseif ('tiered' == $this->getBillingScheme()) {
|
||||
$this->validate('tiers', 'tiers_mode');
|
||||
}
|
||||
|
||||
$data = array(
|
||||
'currency' => $this->getCurrency(),
|
||||
'interval' => $this->getInterval(),
|
||||
'product' => $this->getProduct()
|
||||
);
|
||||
|
||||
if (null != $this->getBillingScheme()) {
|
||||
$data['billing_scheme'] = $this->getBillingScheme();
|
||||
}
|
||||
|
||||
if (null != $this->getId()) {
|
||||
$data['id'] = $this->getId();
|
||||
}
|
||||
|
||||
if (null != $this->getAmount()) {
|
||||
$data['amount'] = $this->getAmount();
|
||||
}
|
||||
|
||||
if (null != $this->getNickName()) {
|
||||
$data['nickname'] = $this->getNickName();
|
||||
}
|
||||
|
||||
if (null != $this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if (null != $this->getActive()) {
|
||||
$data['active'] = $this->getActive();
|
||||
}
|
||||
|
||||
if (null != $this->getIntervalCount()) {
|
||||
$data['interval_count'] = $this->getIntervalCount();
|
||||
}
|
||||
|
||||
if (null != $this->getAggregateUsage()) {
|
||||
$data['aggregate_usage'] = $this->getAggregateUsage();
|
||||
}
|
||||
|
||||
if (null != $this->getTrialPeriodDays()) {
|
||||
$data['trial_period_days'] = $this->getTrialPeriodDays();
|
||||
}
|
||||
|
||||
if (null != $this->getTransformUsage()) {
|
||||
$data['transform_usage'] = $this->getTransformUsage();
|
||||
}
|
||||
|
||||
if (null != $this->getUsageType()) {
|
||||
$data['usage_type'] = $this->getUsageType();
|
||||
}
|
||||
|
||||
if (null != $this->getTiers()) {
|
||||
$data['tiers'] = $this->getTiers();
|
||||
}
|
||||
|
||||
if (null != $this->getTiersMode()) {
|
||||
$data['tiers_mode'] = $this->getTiersMode();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/plans';
|
||||
}
|
||||
}
|
||||
100
vendor/omnipay/stripe/src/Message/CreateSourceRequest.php
vendored
Normal file
100
vendor/omnipay/stripe/src/Message/CreateSourceRequest.php
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
/**
|
||||
* CreateSourceRequest
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
|
||||
/**
|
||||
* Class CreateSourceRequest
|
||||
*
|
||||
* @link https://stripe.com/docs/api/sources/create
|
||||
*/
|
||||
class CreateSourceRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the request secure flag. This is a boolean flag to indicate
|
||||
* whether 3-D secure is required for this source or not
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSecure()
|
||||
{
|
||||
return $this->getParameter('secure');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the request secure flag. This is a boolean flag to indicate
|
||||
* whether 3-D secure is required for this source or not
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setSecure($value)
|
||||
{
|
||||
return $this->setParameter('secure', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the secure redirect url where the user will be redirected back after OTP verification
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSecureRedirectUrl()
|
||||
{
|
||||
return $this->getParameter('secureRedirectUrl');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the secure redirect url where the user will be redirected back after OTP verification
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest]
|
||||
*/
|
||||
public function setSecureRedirectUrl($value)
|
||||
{
|
||||
return $this->setParameter('secureRedirectUrl', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw data array for this message. The format of this varies from gateway to
|
||||
* gateway, but will usually be either an associative array, or a SimpleXMLElement.
|
||||
*
|
||||
* @return mixed
|
||||
* @throws InvalidRequestException
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$data['amount'] = $this->getAmountInteger();
|
||||
$data['currency'] = strtolower($this->getCurrency());
|
||||
|
||||
if ($this->getSecure()) {
|
||||
$data['type'] = 'three_d_secure';
|
||||
$data['three_d_secure']['card'] = $this->getSource();
|
||||
$data['redirect']['return_url'] = $this->getSecureRedirectUrl();
|
||||
} elseif ($card = $this->getCard()) {
|
||||
$data['type'] = 'card';
|
||||
$data['card']['number'] = $card->getNumber();
|
||||
$data['card']['exp_month'] = $card->getExpiryMonth();
|
||||
$data['card']['exp_year'] = $card->getExpiryYear();
|
||||
if ($card->getCvv()) {
|
||||
$data['card']['cvc'] = $card->getCvv();
|
||||
}
|
||||
$data['owner']['email'] = $card->getEmail();
|
||||
$data['owner']['name'] = $card->getName();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*
|
||||
* @return string The endpoint for the create token request.
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/sources';
|
||||
}
|
||||
}
|
||||
107
vendor/omnipay/stripe/src/Message/CreateSubscriptionRequest.php
vendored
Normal file
107
vendor/omnipay/stripe/src/Message/CreateSubscriptionRequest.php
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Subscription Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Create Subscription Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/php#create_subscription
|
||||
*/
|
||||
class CreateSubscriptionRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the plan
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlan()
|
||||
{
|
||||
return $this->getParameter('plan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
|
||||
*/
|
||||
public function setPlan($value)
|
||||
{
|
||||
return $this->setParameter('plan', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the tax percent
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTaxPercent()
|
||||
{
|
||||
return $this->getParameter('tax_percent');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the the trial end timestamp
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getTrialEnd()
|
||||
{
|
||||
return $this->getParameter('trial_end');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the trial end timestamp.
|
||||
*
|
||||
* @param int $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
|
||||
*/
|
||||
public function setTrialEnd($value)
|
||||
{
|
||||
return $this->setParameter('trial_end', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the tax percentage
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|CreateSubscriptionRequest
|
||||
*/
|
||||
public function setTaxPercent($value)
|
||||
{
|
||||
return $this->setParameter('tax_percent', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference', 'plan');
|
||||
|
||||
$data = array(
|
||||
'plan' => $this->getPlan()
|
||||
);
|
||||
|
||||
if ($this->parameters->has('tax_percent')) {
|
||||
$data['tax_percent'] = (float)$this->getParameter('tax_percent');
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if ($this->getTrialEnd()) {
|
||||
$data['trial_end'] = $this->getTrialEnd();
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference().'/subscriptions';
|
||||
}
|
||||
}
|
||||
119
vendor/omnipay/stripe/src/Message/CreateTokenRequest.php
vendored
Normal file
119
vendor/omnipay/stripe/src/Message/CreateTokenRequest.php
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
|
||||
/**
|
||||
* Message which creates a new card token, or in a Connect API
|
||||
* workflow can be used to share clients between the platform and
|
||||
* the connected accounts.
|
||||
*
|
||||
* Creates a single use token that wraps the details of a credit card.
|
||||
* This token can be used in place of a credit card dictionary with any API method.
|
||||
* These tokens can only be used once: by creating a new charge object, or attaching them to a customer.
|
||||
*
|
||||
* In most cases, you should create tokens client-side using Checkout, Elements, or our mobile libraries,
|
||||
* instead of using the API.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#create_card_token
|
||||
*/
|
||||
class CreateTokenRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*
|
||||
* @param \Omnipay\Common\CreditCard $value Credit card object
|
||||
* @return \Omnipay\Common\Message\AbstractRequest $this
|
||||
*/
|
||||
public function setCard($value)
|
||||
{
|
||||
return parent::setCard($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* The id of the customer with format cus_<identifier>.
|
||||
* <strong>Only use this if you are using Connect API</strong>
|
||||
*
|
||||
* @param string $customer The id of the customer
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|\Omnipay\Stripe\Message\CreateTokenRequest
|
||||
*/
|
||||
public function setCustomer($customer)
|
||||
{
|
||||
return $this->setParameter('customer', $customer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the raw data array for this message. The format of this varies from gateway to
|
||||
* gateway, but will usually be either an associative array, or a SimpleXMLElement.
|
||||
* @return mixed
|
||||
* @throws InvalidRequestException
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
if ($this->getParameter('customer')) {
|
||||
$data['customer'] = $this->getParameter('customer');
|
||||
} elseif ($this->getParameter('card')) {
|
||||
/* @var $card \OmniPay\Common\CreditCard */
|
||||
$card = $this->getParameter('card');
|
||||
$card->validate();
|
||||
|
||||
$card_data = array(
|
||||
'exp_month' => $card->getExpiryMonth(),
|
||||
'exp_year' => $card->getExpiryYear(),
|
||||
'number' => $card->getNumber(),
|
||||
);
|
||||
|
||||
if ($card->getBillingCity()) {
|
||||
$card_data['address_city'] = $card->getBillingCity();
|
||||
}
|
||||
|
||||
if ($card->getBillingCountry()) {
|
||||
$card_data['address_country'] = $card->getBillingCountry();
|
||||
}
|
||||
|
||||
if ($card->getBillingAddress1()) {
|
||||
$card_data['address_line1'] = $card->getBillingAddress1();
|
||||
}
|
||||
|
||||
if ($card->getBillingAddress2()) {
|
||||
$card_data['address_line2'] = $card->getBillingAddress2();
|
||||
}
|
||||
|
||||
if ($card->getBillingState()) {
|
||||
$card_data['address_state'] = $card->getBillingState();
|
||||
}
|
||||
|
||||
if ($card->getBillingPostcode()) {
|
||||
$card_data['address_zip'] = $card->getBillingPostcode();
|
||||
}
|
||||
|
||||
if ($card->getCvv()) {
|
||||
$card_data['cvc'] = $card->getCvv();
|
||||
}
|
||||
|
||||
if ($card->getBillingName()) {
|
||||
$card_data['name'] = $card->getBillingName();
|
||||
}
|
||||
|
||||
$data['card'] = $card_data;
|
||||
} else {
|
||||
throw new InvalidRequestException("You must pass either the card or the customer");
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*
|
||||
* @return string The endpoint for the create token request.
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/tokens';
|
||||
}
|
||||
}
|
||||
59
vendor/omnipay/stripe/src/Message/DeleteCardRequest.php
vendored
Normal file
59
vendor/omnipay/stripe/src/Message/DeleteCardRequest.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Delete Credit Card Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Delete Credit Card Request.
|
||||
*
|
||||
* This is normally used to delete a credit card from an existing
|
||||
* customer.
|
||||
*
|
||||
* You can delete cards from a customer or recipient. If you delete a
|
||||
* card that is currently the default card on a customer or recipient,
|
||||
* the most recently added card will be used as the new default. If you
|
||||
* delete the last remaining card on a customer or recipient, the
|
||||
* default_card attribute on the card's owner will become null.
|
||||
*
|
||||
* Note that for cards belonging to customers, you may want to prevent
|
||||
* customers on paid subscriptions from deleting all cards on file so
|
||||
* that there is at least one default card for the next invoice payment
|
||||
* attempt.
|
||||
*
|
||||
* In deference to the previous incarnation of this gateway, where
|
||||
* all CreateCard requests added a new customer and the customer ID
|
||||
* was used as the card ID, if a cardReference is passed in but no
|
||||
* customerReference then we assume that the cardReference is in fact
|
||||
* a customerReference and delete the customer. This might be
|
||||
* dangerous but it's the best way to ensure backwards compatibility.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#delete_card
|
||||
*/
|
||||
class DeleteCardRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('cardReference');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
if ($this->getCustomerReference()) {
|
||||
// Delete a card from a customer
|
||||
return $this->endpoint.'/customers/'.
|
||||
$this->getCustomerReference().'/cards/'.
|
||||
$this->getCardReference();
|
||||
}
|
||||
// Delete the customer. Oops?
|
||||
return $this->endpoint.'/customers/'.$this->getCardReference();
|
||||
}
|
||||
}
|
||||
49
vendor/omnipay/stripe/src/Message/DeleteCouponRequest.php
vendored
Normal file
49
vendor/omnipay/stripe/src/Message/DeleteCouponRequest.php
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Delete Coupon Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/coupons/delete
|
||||
*/
|
||||
class DeleteCouponRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the source id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCouponId()
|
||||
{
|
||||
return $this->getParameter('couponId');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the coupon id.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return DeleteCouponRequest provides a fluent interface
|
||||
*/
|
||||
public function setCouponId($value)
|
||||
{
|
||||
return $this->setParameter('couponId', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('couponId');
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/coupons/'.$this->getCouponId();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
}
|
||||
34
vendor/omnipay/stripe/src/Message/DeleteCustomerRequest.php
vendored
Normal file
34
vendor/omnipay/stripe/src/Message/DeleteCustomerRequest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Delete Customer Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Delete Customer Request.
|
||||
*
|
||||
* Permanently deletes a customer. It cannot be undone. Also immediately
|
||||
* cancels any active subscriptions on the customer.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#delete_customer
|
||||
*/
|
||||
class DeleteCustomerRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference();
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/DeleteInvoiceItemRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/DeleteInvoiceItemRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Delete Invoice Item Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Delete Invoice Item Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#delete_invoiceitem
|
||||
*/
|
||||
class DeleteInvoiceItemRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the invoice-item reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceItemReference()
|
||||
{
|
||||
return $this->getParameter('invoiceItemReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set invoice-item reference.
|
||||
*
|
||||
* @return DeleteInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setInvoiceItemReference($value)
|
||||
{
|
||||
return $this->setParameter('invoiceItemReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('invoiceItemReference');
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/invoiceitems/'.$this->getInvoiceItemReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
}
|
||||
51
vendor/omnipay/stripe/src/Message/DeletePlanRequest.php
vendored
Normal file
51
vendor/omnipay/stripe/src/Message/DeletePlanRequest.php
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Delete Plan Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Delete Plan Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#delete_plan
|
||||
*/
|
||||
class DeletePlanRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the plan id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->getParameter('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan id.
|
||||
*
|
||||
* @return DeletePlanRequest provides a fluent interface.
|
||||
*/
|
||||
public function setId($planId)
|
||||
{
|
||||
return $this->setParameter('id', $planId);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('id');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/plans/'.$this->getId();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
}
|
||||
34
vendor/omnipay/stripe/src/Message/DetachSourceRequest.php
vendored
Normal file
34
vendor/omnipay/stripe/src/Message/DetachSourceRequest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Detach Source Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Detach Source Request.
|
||||
*
|
||||
* Detaches a Source object from a Customer.
|
||||
* The status of a source is changed to consumed when it is detached and it can no longer be used to create a charge.
|
||||
*
|
||||
* @link https://stripe.com/docs/api/sources/detach
|
||||
*/
|
||||
class DetachSourceRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference', 'source');
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference().'/sources/'.$this->getSource();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'DELETE';
|
||||
}
|
||||
}
|
||||
69
vendor/omnipay/stripe/src/Message/FetchApplicationFeeRequest.php
vendored
Normal file
69
vendor/omnipay/stripe/src/Message/FetchApplicationFeeRequest.php
vendored
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Application Fee Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Application Fee Request.
|
||||
*
|
||||
* Example -- note this example assumes that an application fee has been successful.
|
||||
*
|
||||
* <code>
|
||||
* // Fetch the transaction so that details can be found for refund, etc.
|
||||
* $transaction = $gateway->fetchApplicationFee();
|
||||
* $transaction->setApplicationFeeReference($application_fee_id);
|
||||
* $response = $transaction->send();
|
||||
* $data = $response->getData();
|
||||
* echo "Gateway fetchApplicationFee response data == " . print_r($data, true) . "\n";
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_application_fee
|
||||
*/
|
||||
class FetchApplicationFeeRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the application fee reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getApplicationFeeReference()
|
||||
{
|
||||
return $this->getParameter('applicationFeeReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the application fee reference
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setApplicationFeeReference($value)
|
||||
{
|
||||
return $this->setParameter('applicationFeeReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('applicationFeeReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/application_fees/' . $this->getApplicationFeeReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
68
vendor/omnipay/stripe/src/Message/FetchBalanceTransactionRequest.php
vendored
Normal file
68
vendor/omnipay/stripe/src/Message/FetchBalanceTransactionRequest.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* Stripe Fetch Transaction Request
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Balance Request
|
||||
*
|
||||
* Example -- note this example assumes that the purchase has been successful
|
||||
* and that the transaction balance ID returned from the purchase is held in $balanceTransactionId.
|
||||
* See PurchaseRequest for the first part of this example transaction:
|
||||
*
|
||||
* <code>
|
||||
* // Fetch the balance to get information about the payment.
|
||||
* $balance = $gateway->fetchBalanceTransaction();
|
||||
* $balance->setBalanceTransactionReference($balance_transaction_id);
|
||||
* $response = $balance->send();
|
||||
* $data = $response->getData();
|
||||
* echo "Gateway fetchBalance response data == " . print_r($data, true) . "\n";
|
||||
* </code>
|
||||
*
|
||||
* @see PurchaseRequest
|
||||
* @see Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#retrieve_balance_transaction
|
||||
*/
|
||||
class FetchBalanceTransactionRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the transaction balance reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBalanceTransactionReference()
|
||||
{
|
||||
return $this->getParameter('balanceTransactionReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transaction balance reference
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setBalanceTransactionReference($value)
|
||||
{
|
||||
return $this->setParameter('balanceTransactionReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('balanceTransactionReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/balance/history/'.$this->getBalanceTransactionReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/FetchChargeRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/FetchChargeRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Charge Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Charge Request.
|
||||
*
|
||||
* @deprecated 2.3.3:3.0.0 functionality provided by \Omnipay\Stripe\Message\FetchTransactionRequest
|
||||
* @see \Omnipay\Stripe\Message\FetchTransactionRequest
|
||||
* @link https://stripe.com/docs/api#retrieve_charge
|
||||
*/
|
||||
class FetchChargeRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the charge reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getChargeReference()
|
||||
{
|
||||
return $this->getParameter('chargeReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the charge reference.
|
||||
*
|
||||
* @param string
|
||||
* @return FetchChargeRequest provides a fluent interface.
|
||||
*/
|
||||
public function setChargeReference($value)
|
||||
{
|
||||
return $this->setParameter('chargeReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('chargeReference');
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/charges/'.$this->getChargeReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
48
vendor/omnipay/stripe/src/Message/FetchCouponRequest.php
vendored
Normal file
48
vendor/omnipay/stripe/src/Message/FetchCouponRequest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Coupon Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/coupons/retrieve
|
||||
*/
|
||||
class FetchCouponRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the coupon id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCouponId()
|
||||
{
|
||||
return $this->getParameter('couponId');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the coupon id.
|
||||
*
|
||||
* @param string
|
||||
* @return FetchCouponRequest provides a fluent interface.
|
||||
*/
|
||||
public function setCouponId($value)
|
||||
{
|
||||
return $this->setParameter('couponId', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('couponId');
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/coupons/'.$this->getCouponId();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
31
vendor/omnipay/stripe/src/Message/FetchCustomerRequest.php
vendored
Normal file
31
vendor/omnipay/stripe/src/Message/FetchCustomerRequest.php
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Delete Customer Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Customer Request.
|
||||
*
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_customer
|
||||
*/
|
||||
class FetchCustomerRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference');
|
||||
return;
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/customers/' . $this->getCustomerReference();
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/FetchEventRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/FetchEventRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Event Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Event Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api/curl#retrieve_event
|
||||
*/
|
||||
class FetchEventRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the event reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEventReference()
|
||||
{
|
||||
return $this->getParameter('eventReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the event reference.
|
||||
*
|
||||
* @return FetchEventRequest provides a fluent interface.
|
||||
*/
|
||||
public function setEventReference($value)
|
||||
{
|
||||
return $this->setParameter('eventReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('eventReference');
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/events/'.$this->getEventReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/FetchInvoiceItemRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/FetchInvoiceItemRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Invoice Item Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Invoice Item Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_invoiceitem
|
||||
*/
|
||||
class FetchInvoiceItemRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the invoice-item reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceItemReference()
|
||||
{
|
||||
return $this->getParameter('invoiceItemReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set invoice-item reference.
|
||||
*
|
||||
* @return FetchInvoiceItemRequest provides a fluent interface.
|
||||
*/
|
||||
public function setInvoiceItemReference($value)
|
||||
{
|
||||
return $this->setParameter('invoiceItemReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('invoiceItemReference');
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/invoiceitems/'.$this->getInvoiceItemReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/FetchInvoiceLinesRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/FetchInvoiceLinesRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Invoice Lines Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Invoice Lines Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#invoice_lines
|
||||
*/
|
||||
class FetchInvoiceLinesRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the invoice reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceReference()
|
||||
{
|
||||
return $this->getParameter('invoiceReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set invoice reference.
|
||||
*
|
||||
* @return FetchInvoiceLinesRequest provides a fluent interface.
|
||||
*/
|
||||
public function setInvoiceReference($value)
|
||||
{
|
||||
return $this->setParameter('invoiceReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('invoiceReference');
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/invoices/'.$this->getInvoiceReference().'/lines';
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/FetchInvoiceRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/FetchInvoiceRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Invoice Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Invoice Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_invoice
|
||||
*/
|
||||
class FetchInvoiceRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the invoice reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getInvoiceReference()
|
||||
{
|
||||
return $this->getParameter('invoiceReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the set invoice reference.
|
||||
*
|
||||
* @return FetchInvoiceRequest provides a fluent interface.
|
||||
*/
|
||||
public function setInvoiceReference($value)
|
||||
{
|
||||
return $this->setParameter('invoiceReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('invoiceReference');
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/invoices/'.$this->getInvoiceReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/FetchPlanRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/FetchPlanRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Plan Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Plan Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_plan
|
||||
*/
|
||||
class FetchPlanRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the plan id.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->getParameter('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan id.
|
||||
*
|
||||
* @return FetchPlanRequest provides a fluent interface.
|
||||
*/
|
||||
public function setId($planId)
|
||||
{
|
||||
return $this->setParameter('id', $planId);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('id');
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/plans/'.$this->getId();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
54
vendor/omnipay/stripe/src/Message/FetchSourceRequest.php
vendored
Normal file
54
vendor/omnipay/stripe/src/Message/FetchSourceRequest.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Source Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Source Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api/sources/retrieve
|
||||
*/
|
||||
class FetchSourceRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getClientSecret()
|
||||
{
|
||||
return $this->getParameter('clientSecret');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return FetchSourceRequest
|
||||
*/
|
||||
public function setClientSecret($value)
|
||||
{
|
||||
return $this->setParameter('clientSecret', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('source');
|
||||
$data = array();
|
||||
|
||||
if ($clientSecret = $this->getClientSecret()) {
|
||||
$data['client_secret'] = $clientSecret;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/sources/'.$this->getSource();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
54
vendor/omnipay/stripe/src/Message/FetchSubscriptionRequest.php
vendored
Normal file
54
vendor/omnipay/stripe/src/Message/FetchSubscriptionRequest.php
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Subscription Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Subscription Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_subscription
|
||||
*/
|
||||
class FetchSubscriptionRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the subscription reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubscriptionReference()
|
||||
{
|
||||
return $this->getParameter('subscriptionReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subscription reference.
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|FetchSubscriptionRequest
|
||||
*/
|
||||
public function setSubscriptionReference($value)
|
||||
{
|
||||
return $this->setParameter('subscriptionReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference', 'subscriptionReference');
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference()
|
||||
.'/subscriptions/'.$this->getSubscriptionReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
53
vendor/omnipay/stripe/src/Message/FetchSubscriptionSchedulesRequest.php
vendored
Normal file
53
vendor/omnipay/stripe/src/Message/FetchSubscriptionSchedulesRequest.php
vendored
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Subscription Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Subscription Request.
|
||||
*
|
||||
* @link https://stripe.com/docs/api/subscription_schedules/retrieve
|
||||
*/
|
||||
class FetchSubscriptionSchedulesRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the subscription reference.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubscriptionSchedulesReference()
|
||||
{
|
||||
return $this->getParameter('subscriptionSchedulesReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subscription reference.
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|FetchSubscriptionRequest
|
||||
*/
|
||||
public function setSubscriptionSchedulesReference($value)
|
||||
{
|
||||
return $this->setParameter('subscriptionSchedulesReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('subscriptionSchedulesReference');
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/subscription_schedules/'.$this->getSubscriptionSchedulesReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
45
vendor/omnipay/stripe/src/Message/FetchTokenRequest.php
vendored
Normal file
45
vendor/omnipay/stripe/src/Message/FetchTokenRequest.php
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Token Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Token Request.
|
||||
*
|
||||
* Often you want to be able to charge credit cards or send payments
|
||||
* to bank accounts without having to hold sensitive card information
|
||||
* on your own servers. Stripe.js makes this easy in the browser, but
|
||||
* you can use the same technique in other environments with our token API.
|
||||
*
|
||||
* Tokens can be created with your publishable API key, which can safely
|
||||
* be embedded in downloadable applications like iPhone and Android apps.
|
||||
* You can then use a token anywhere in our API that a card or bank account
|
||||
* is accepted. Note that tokens are not meant to be stored or used more
|
||||
* than once—to store these details for use later, you should create
|
||||
* Customer or Recipient objects.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#tokens
|
||||
*/
|
||||
class FetchTokenRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('token');
|
||||
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/tokens/'.$this->getToken();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
48
vendor/omnipay/stripe/src/Message/FetchTransactionRequest.php
vendored
Normal file
48
vendor/omnipay/stripe/src/Message/FetchTransactionRequest.php
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transaction Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transaction Request.
|
||||
*
|
||||
* Example -- note this example assumes that the purchase has been successful
|
||||
* and that the transaction ID returned from the purchase is held in $sale_id.
|
||||
* See PurchaseRequest for the first part of this example transaction:
|
||||
*
|
||||
* <code>
|
||||
* // Fetch the transaction so that details can be found for refund, etc.
|
||||
* $transaction = $gateway->fetchTransaction();
|
||||
* $transaction->setTransactionReference($sale_id);
|
||||
* $response = $transaction->send();
|
||||
* $data = $response->getData();
|
||||
* echo "Gateway fetchTransaction response data == " . print_r($data, true) . "\n";
|
||||
* </code>
|
||||
*
|
||||
* @see PurchaseRequest
|
||||
* @see Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#retrieve_charge
|
||||
*/
|
||||
class FetchTransactionRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transactionReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/charges/'.$this->getTransactionReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
123
vendor/omnipay/stripe/src/Message/ListCouponsRequest.php
vendored
Normal file
123
vendor/omnipay/stripe/src/Message/ListCouponsRequest.php
vendored
Normal file
@@ -0,0 +1,123 @@
|
||||
<?php
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe List Coupons Request.
|
||||
*
|
||||
* @see Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/coupons/list
|
||||
*/
|
||||
class ListCouponsRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getCreated()
|
||||
{
|
||||
return $this->getParameter('created');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return ListCouponsRequest
|
||||
*/
|
||||
public function setCreated($value)
|
||||
{
|
||||
return $this->setParameter('created', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLimit()
|
||||
{
|
||||
return $this->getParameter('limit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return ListCouponsRequest
|
||||
*/
|
||||
public function setLimit($value)
|
||||
{
|
||||
return $this->setParameter('limit', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list.
|
||||
* For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your
|
||||
* subsequent call can include `ending_before=obj_ba`r in order to fetch the previous page of the list.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEndingBefore()
|
||||
{
|
||||
return $this->getParameter('endingBefore');
|
||||
}
|
||||
|
||||
/**
|
||||
* A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list.
|
||||
* For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your
|
||||
* subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStartingAfter()
|
||||
{
|
||||
return $this->getParameter('startingAfter');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setStartingAfter($value)
|
||||
{
|
||||
return $this->setParameter('startingAfter', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return ListCouponsRequest
|
||||
*/
|
||||
public function setEndingBefore($value)
|
||||
{
|
||||
return $this->setParameter('endingBefore', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
if ($this->getLimit()) {
|
||||
$data['created'] = $this->getCreated();
|
||||
}
|
||||
if ($this->getLimit()) {
|
||||
$data['limit'] = $this->getLimit();
|
||||
}
|
||||
|
||||
if ($this->getEndingBefore()) {
|
||||
$data['ending_before'] = $this->getEndingBefore();
|
||||
}
|
||||
|
||||
if ($this->getStartingAfter()) {
|
||||
$data['starting_after'] = $this->getStartingAfter();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/coupons';
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
37
vendor/omnipay/stripe/src/Message/ListInvoicesRequest.php
vendored
Normal file
37
vendor/omnipay/stripe/src/Message/ListInvoicesRequest.php
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe List Invoices Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe List Invoices Request.
|
||||
*
|
||||
* @see Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#list_invoices
|
||||
*/
|
||||
class ListInvoicesRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
$endpoint = $this->endpoint.'/invoices';
|
||||
if ($customerReference = $this->getCustomerReference()) {
|
||||
return $endpoint . '?customer=' . $customerReference;
|
||||
}
|
||||
|
||||
return $endpoint;
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
34
vendor/omnipay/stripe/src/Message/ListPlansRequest.php
vendored
Normal file
34
vendor/omnipay/stripe/src/Message/ListPlansRequest.php
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe List Plans Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
// use Omnipay\Common\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe List Plans Request.
|
||||
*
|
||||
* @see Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/curl#list_plans
|
||||
*/
|
||||
class ListPlansRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/plans';
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
62
vendor/omnipay/stripe/src/Message/PaymentIntents/AbstractRequest.php
vendored
Normal file
62
vendor/omnipay/stripe/src/Message/PaymentIntents/AbstractRequest.php
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Abstract Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intent Abstract Request.
|
||||
*
|
||||
* This is the parent class for all Stripe payment intent requests.
|
||||
* It adds just a getter and setter.
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
* @see \Omnipay\Stripe\Message\AbstractRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents
|
||||
*/
|
||||
abstract class AbstractRequest extends \Omnipay\Stripe\Message\AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setPaymentIntentReference($value)
|
||||
{
|
||||
return $this->setParameter('paymentIntentReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getPaymentIntentReference()
|
||||
{
|
||||
return $this->getParameter('paymentIntentReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* If there's a reference to a payment method, return that instead.
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getCardReference()
|
||||
{
|
||||
if ($paymentMethod = $this->getPaymentMethod()) {
|
||||
return $paymentMethod;
|
||||
}
|
||||
|
||||
return parent::getCardReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* Actually, set the payment method, which is the preferred API.
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function setCardReference($reference)
|
||||
{
|
||||
$this->setPaymentMethod($reference);
|
||||
}
|
||||
}
|
||||
68
vendor/omnipay/stripe/src/Message/PaymentIntents/AttachPaymentMethodRequest.php
vendored
Normal file
68
vendor/omnipay/stripe/src/Message/PaymentIntents/AttachPaymentMethodRequest.php
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Attach Payment Method Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Attach Payment Method Request.
|
||||
*
|
||||
* This request is used to attach an existing payment method to an existing customer.
|
||||
* The `attachCard` method *will not work* on the Charge gateway.
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* This example assumes that you have already created both a customer and a
|
||||
* payment method and that the data is stored in $customerId and $paymentMethodId, respectively.
|
||||
*
|
||||
* <code>
|
||||
* // Do an attach card transaction on the gateway
|
||||
* $response = $gateway->attachCard(array(
|
||||
* 'paymentMethod' => $paymentMethodId,
|
||||
* 'customerReference' => $customerId,
|
||||
* ))->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Gateway attachCard was successful.\n";
|
||||
* // Find the card ID
|
||||
* $methodId = $response->getCardReference();
|
||||
* echo "Method ID = " . $methodId . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreatePaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreateCustomerRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\UpdatePaymentMethodRequest
|
||||
* @link https://stripe.com/docs/api/payment_methods/attach
|
||||
*/
|
||||
class AttachPaymentMethodRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
$this->validate('customerReference');
|
||||
$this->validate('paymentMethod');
|
||||
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_methods/' . $this->getPaymentMethod() . '/attach';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
425
vendor/omnipay/stripe/src/Message/PaymentIntents/AuthorizeRequest.php
vendored
Normal file
425
vendor/omnipay/stripe/src/Message/PaymentIntents/AuthorizeRequest.php
vendored
Normal file
@@ -0,0 +1,425 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Authorize Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
use Money\Formatter\DecimalMoneyFormatter;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Authorize Request.
|
||||
*
|
||||
* An authorize request is similar to a purchase request but the
|
||||
* charge issues an authorization (or pre-authorization), and no money
|
||||
* is transferred. The transaction will need to be captured later
|
||||
* in order to effect payment. Uncaptured charges expire in 7 days.
|
||||
*
|
||||
* A payment method is required. It can be set using the `paymentMethod`, `source`,
|
||||
* `cardReference` or `token` parameters.
|
||||
*
|
||||
* *Important*: Please note, that this gateway is a hybrid between credit card and
|
||||
* off-site gateway. It acts as a normal credit card gateway, unless the payment method
|
||||
* requires 3DS authentication, in which case it also performs a redirect to an
|
||||
* off-site authentication form.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* <code>
|
||||
* // Create a gateway for the Stripe Gateway
|
||||
* // (routes to GatewayFactory::create)
|
||||
* $gateway = Omnipay::create('Stripe\PaymentIntents');
|
||||
*
|
||||
* // Initialise the gateway
|
||||
* $gateway->initialize(array(
|
||||
* 'apiKey' => 'MyApiKey',
|
||||
* ));
|
||||
*
|
||||
* // Create a payment method using a credit card object.
|
||||
* // This card can be used for testing.
|
||||
* $card = new CreditCard(array(
|
||||
* 'firstName' => 'Example',
|
||||
* 'lastName' => 'Customer',
|
||||
* 'number' => '4242424242424242',
|
||||
* 'expiryMonth' => '01',
|
||||
* 'expiryYear' => '2020',
|
||||
* 'cvv' => '123',
|
||||
* 'email' => 'customer@example.com',
|
||||
* 'billingAddress1' => '1 Scrubby Creek Road',
|
||||
* 'billingCountry' => 'AU',
|
||||
* 'billingCity' => 'Scrubby Creek',
|
||||
* 'billingPostcode' => '4999',
|
||||
* 'billingState' => 'QLD',
|
||||
* ));
|
||||
*
|
||||
* $paymentMethod = $gateway->createCard(['card' => $card])->send()->getCardReference();
|
||||
*
|
||||
* // Code above can be skipped if you use Stripe.js and have a payment method reference
|
||||
* // in the $paymentMethod variable already.
|
||||
*
|
||||
* // For backwards compatibility, it's also possible to use card and source references
|
||||
* // as well as tokens. However, a data dictionary containing card data cannot
|
||||
* // be used at this stage.
|
||||
*
|
||||
* // Also note the setting of a return url. This is needed for cards that require
|
||||
* // the 3DS 2.0 authentication. If you do not set a return url, payment with such
|
||||
* // cards will fail.
|
||||
*
|
||||
* // Do a purchase transaction on the gateway
|
||||
* $paymentIntent = $gateway->authorize(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'currency' => 'USD',
|
||||
* 'description' => 'This is a test purchase transaction.',
|
||||
* 'paymentMethod' => $paymentMethod,
|
||||
* 'returnUrl' => $completePaymentUrl,
|
||||
* 'confirm' => true,
|
||||
* ));
|
||||
*
|
||||
* $paymentIntent = $paymentIntent->send();
|
||||
*
|
||||
* // Alternatively, if you don't want to confirm it at one go for whatever reason, you
|
||||
* // can use this code block below to confirm it. Otherwise, skip it.
|
||||
* $paymentIntent = $gateway->confirm(array(
|
||||
* 'returnUrl' => $completePaymentUrl
|
||||
* 'paymentIntentReference' => $paymentIntent->getPaymentIntentReference(),
|
||||
* ));
|
||||
*
|
||||
* $response = $paymentIntent->send();
|
||||
*
|
||||
* // If you set the confirm to true when performing the authorize transaction,
|
||||
* // resume here.
|
||||
*
|
||||
* // 3DS 2.0 time!
|
||||
* if ($response->isRedirect()) {
|
||||
* $response->redirect();
|
||||
* } else if ($response->isSuccessful()) {
|
||||
* echo "Authorize transaction was successful!\n";
|
||||
* $sale_id = $response->getTransactionReference();
|
||||
* echo "Transaction reference = " . $sale_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreatePaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\ConfirmPaymentIntentRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents
|
||||
*/
|
||||
class AuthorizeRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Set the confirm parameter.
|
||||
*
|
||||
* @param $value
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setConfirm($value)
|
||||
{
|
||||
return $this->setParameter('confirm', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the confirm parameter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getConfirm()
|
||||
{
|
||||
return $this->getParameter('confirm');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDestination()
|
||||
{
|
||||
return $this->getParameter('destination');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setDestination($value)
|
||||
{
|
||||
return $this->setParameter('destination', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->getParameter('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
return $this->setParameter('source', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferGroup()
|
||||
{
|
||||
return $this->getParameter('transferGroup');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setTransferGroup($value)
|
||||
{
|
||||
return $this->setParameter('transferGroup', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOnBehalfOf()
|
||||
{
|
||||
return $this->getParameter('onBehalfOf');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setOnBehalfOf($value)
|
||||
{
|
||||
return $this->setParameter('onBehalfOf', $value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws \Omnipay\Common\Exception\InvalidRequestException
|
||||
*/
|
||||
public function getApplicationFee()
|
||||
{
|
||||
$money = $this->getMoney('applicationFee');
|
||||
|
||||
if ($money !== null) {
|
||||
$moneyFormatter = new DecimalMoneyFormatter($this->getCurrencies());
|
||||
|
||||
return $moneyFormatter->format($money);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment amount as an integer.
|
||||
*
|
||||
* @return integer
|
||||
* @throws \Omnipay\Common\Exception\InvalidRequestException
|
||||
*/
|
||||
public function getApplicationFeeInteger()
|
||||
{
|
||||
$money = $this->getMoney('applicationFee');
|
||||
|
||||
if ($money !== null) {
|
||||
return (integer) $money->getAmount();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setApplicationFee($value)
|
||||
{
|
||||
return $this->setParameter('applicationFee', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStatementDescriptor()
|
||||
{
|
||||
return $this->getParameter('statementDescriptor');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setStatementDescriptor($value)
|
||||
{
|
||||
$value = str_replace(array('<', '>', '"', '\''), '', $value);
|
||||
|
||||
return $this->setParameter('statementDescriptor', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getReceiptEmail()
|
||||
{
|
||||
return $this->getParameter('receipt_email');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $email
|
||||
* @return $this
|
||||
*/
|
||||
public function setReceiptEmail($email)
|
||||
{
|
||||
$this->setParameter('receipt_email', $email);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the setup_future_usage parameter.
|
||||
*
|
||||
* @param $value
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSetupFutureUsage($value)
|
||||
{
|
||||
return $this->setParameter('setup_future_usage', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the setup_future_usage parameter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSetupFutureUsage()
|
||||
{
|
||||
return $this->getParameter('setup_future_usage');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the setup_future_usage parameter.
|
||||
*
|
||||
* @param $value
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setOffSession($value)
|
||||
{
|
||||
return $this->setParameter('off_session', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the setup_future_usage parameter.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getOffSession()
|
||||
{
|
||||
return $this->getParameter('off_session');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('amount', 'currency');
|
||||
|
||||
$data = array();
|
||||
|
||||
$data['amount'] = $this->getAmountInteger();
|
||||
$data['currency'] = strtolower($this->getCurrency());
|
||||
$data['description'] = $this->getDescription();
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
|
||||
if ($this->getStatementDescriptor()) {
|
||||
$data['statement_descriptor'] = $this->getStatementDescriptor();
|
||||
}
|
||||
if ($this->getDestination()) {
|
||||
$data['transfer_data']['destination'] = $this->getDestination();
|
||||
}
|
||||
|
||||
if ($this->getOnBehalfOf()) {
|
||||
$data['on_behalf_of'] = $this->getOnBehalfOf();
|
||||
}
|
||||
|
||||
if ($this->getApplicationFee()) {
|
||||
$data['application_fee'] = $this->getApplicationFeeInteger();
|
||||
}
|
||||
|
||||
if ($this->getTransferGroup()) {
|
||||
$data['transfer_group'] = $this->getTransferGroup();
|
||||
}
|
||||
|
||||
if ($this->getReceiptEmail()) {
|
||||
$data['receipt_email'] = $this->getReceiptEmail();
|
||||
}
|
||||
|
||||
if ($this->getPaymentMethod()) {
|
||||
$data['payment_method'] = $this->getPaymentMethod();
|
||||
} elseif ($this->getSource()) {
|
||||
$data['payment_method'] = $this->getSource();
|
||||
} elseif ($this->getCardReference()) {
|
||||
$data['payment_method'] = $this->getCardReference();
|
||||
} elseif ($this->getToken()) {
|
||||
$data['payment_method_data'] = [
|
||||
'type' => 'card',
|
||||
'card' => ['token' => $this->getToken()],
|
||||
];
|
||||
} else {
|
||||
// one of cardReference, token, or card is required
|
||||
$this->validate('paymentMethod');
|
||||
}
|
||||
|
||||
if ($this->getCustomerReference()) {
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
}
|
||||
|
||||
if ($this->getSetupFutureUsage()) {
|
||||
$data['setup_future_usage'] = $this->getSetupFutureUsage();
|
||||
}
|
||||
|
||||
$data['off_session'] = $this->getOffSession() ? 'true' : 'false';
|
||||
|
||||
$data['confirmation_method'] = 'manual';
|
||||
$data['capture_method'] = 'manual';
|
||||
|
||||
$data['confirm'] = $this->getConfirm() ? 'true' : 'false';
|
||||
|
||||
if ($this->getConfirm() && !$this->getOffSession()) {
|
||||
$this->validate('returnUrl');
|
||||
$data['return_url'] = $this->getReturnUrl();
|
||||
}
|
||||
$data['off_session'] = $this->getOffSession() ? 'true' : 'false';
|
||||
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_intents';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
52
vendor/omnipay/stripe/src/Message/PaymentIntents/CancelPaymentIntentRequest.php
vendored
Normal file
52
vendor/omnipay/stripe/src/Message/PaymentIntents/CancelPaymentIntentRequest.php
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Cancel Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Cancel Payment Intent Request.
|
||||
*
|
||||
* <code>
|
||||
* $paymentIntent = $gateway->cancelPaymentIntent(array(
|
||||
* 'paymentIntentReference' => $paymentIntentReference,
|
||||
* ));
|
||||
*
|
||||
* $response = $paymentIntent->send();
|
||||
*
|
||||
* if ($response->isCancelled()) {
|
||||
* // All done
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api/payment_intents/cancel
|
||||
*/
|
||||
class CancelPaymentIntentRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentIntentReference');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_intents/' . $this->getPaymentIntentReference() . '/cancel';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
57
vendor/omnipay/stripe/src/Message/PaymentIntents/CaptureRequest.php
vendored
Normal file
57
vendor/omnipay/stripe/src/Message/PaymentIntents/CaptureRequest.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Capture Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Capture Request.
|
||||
*
|
||||
* Use this request to capture and process a previously created authorization.
|
||||
*
|
||||
* Example -- note this example assumes that the authorization has been successful
|
||||
* and that the payment intent that performed the authorization is held in $paymentIntent.
|
||||
* See AuthorizeRequest for the first part of this example transaction:
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->capture(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'currency' => 'AUD',
|
||||
* ));
|
||||
* $transaction->setPaymentMethod($paymentMethod);
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @see AuthorizeRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents/capture
|
||||
*/
|
||||
class CaptureRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentIntentReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($amount = $this->getAmountInteger()) {
|
||||
$data['amount_to_capture'] = $amount;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_intents/'.$this->getPaymentIntentReference().'/capture';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
58
vendor/omnipay/stripe/src/Message/PaymentIntents/ConfirmPaymentIntentRequest.php
vendored
Normal file
58
vendor/omnipay/stripe/src/Message/PaymentIntents/ConfirmPaymentIntentRequest.php
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Authorize Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Confirm Payment Intent Request.
|
||||
*
|
||||
* This request is sent behind the scenes whenever an authorize or purchase request
|
||||
* is performed by the Payment Intents gateway. The previous authorize or purchase request
|
||||
* "primes" the purchase or authorization and this request confirms it.
|
||||
*
|
||||
* The response to this request indicates whether the payment requires 3DS authentication,
|
||||
* in which case it will be a redirect response.
|
||||
*
|
||||
* For examples, refer to related purchase and authorization classes.
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AuthorizeRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\PurchaseRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents/confirm
|
||||
*/
|
||||
class ConfirmPaymentIntentRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentIntentReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($this->getReturnUrl()) {
|
||||
$data['return_url'] = $this->getReturnUrl();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_intents/' . $this->getPaymentIntentReference() . '/confirm';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
133
vendor/omnipay/stripe/src/Message/PaymentIntents/CreatePaymentMethodRequest.php
vendored
Normal file
133
vendor/omnipay/stripe/src/Message/PaymentIntents/CreatePaymentMethodRequest.php
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Payment Method Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Create Payment Method Request.
|
||||
*
|
||||
* Stripe payment methods differs a little bit from creating a card.
|
||||
* When using the Payment Intent API, it is mandatory to use a payment method,
|
||||
* so a lot of times you'll be creating a payment method without an assigned customer.
|
||||
*
|
||||
* Another difference is that it's impossible to create a payment method and assign
|
||||
* it to a user in a single request. Instead, you create a payment method and then
|
||||
* attach it.
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* <code>
|
||||
* // Create a credit card object
|
||||
* // This card can be used for testing.
|
||||
* $new_card = new CreditCard([
|
||||
* 'firstName' => 'Example',
|
||||
* 'lastName' => 'Customer',
|
||||
* 'number' => '5555555555554444',
|
||||
* 'expiryMonth' => '01',
|
||||
* 'expiryYear' => '2020',
|
||||
* 'cvv' => '456',
|
||||
* 'email' => 'customer@example.com',
|
||||
* 'billingAddress1' => '1 Lower Creek Road',
|
||||
* 'billingCountry' => 'AU',
|
||||
* 'billingCity' => 'Upper Swan',
|
||||
* 'billingPostcode' => '6999',
|
||||
* 'billingState' => 'WA',
|
||||
* ]);
|
||||
*
|
||||
* // Do a create card transaction on the gateway
|
||||
* $response = $gateway->createCard(['card' => $new_card])->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Gateway createCard was successful.\n";
|
||||
* // Find the card ID
|
||||
* $method_id = $response->getCardReference();
|
||||
* echo "Method ID = " . $method_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AttachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\UpdatePaymentMethodRequest
|
||||
* @link https://stripe.com/docs/api/payment_methods/create
|
||||
*/
|
||||
class CreatePaymentMethodRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
if ($this->getToken()) {
|
||||
$data['card'] = ['token' => $this->getToken()];
|
||||
} elseif ($this->getCard()) {
|
||||
$data['card'] = $this->getCardData();
|
||||
} else {
|
||||
// one of token or card is required
|
||||
$this->validate('card');
|
||||
}
|
||||
|
||||
if ($this->getCard() && $billingDetails = $this->getBillingDetails()) {
|
||||
$data['billing_details'] = $billingDetails;
|
||||
}
|
||||
|
||||
$data['type'] = 'card';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_methods';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getCardData()
|
||||
{
|
||||
$data = parent::getCardData();
|
||||
|
||||
return [
|
||||
'exp_month' => $data['exp_month'],
|
||||
'exp_year' => $data['exp_year'],
|
||||
'number' => $data['number'],
|
||||
'cvc' => $data['cvc'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of the billing details.
|
||||
*/
|
||||
public function getBillingDetails()
|
||||
{
|
||||
$data = parent::getCardData();
|
||||
|
||||
// Take care of optional data by filtering it out.
|
||||
return array_filter([
|
||||
'email' => $data['email'],
|
||||
'name' => $data['name'],
|
||||
'address' => array_filter([
|
||||
'city' => $data['address_city'],
|
||||
'country' => $data['address_country'],
|
||||
'line1' => $data['address_line1'],
|
||||
'line2' => $data['address_line2'],
|
||||
'postal_code' => $data['address_zip'],
|
||||
'state' => $data['address_state'],
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
60
vendor/omnipay/stripe/src/Message/PaymentIntents/DetachPaymentMethodRequest.php
vendored
Normal file
60
vendor/omnipay/stripe/src/Message/PaymentIntents/DetachPaymentMethodRequest.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Attach Payment Method Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Attach Payment Method Request.
|
||||
*
|
||||
* This request is used to detach an existing payment method from a customer.
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* This example assumes that you have already created both a customer and a
|
||||
* payment method and that the data is stored in $customerId and $paymentMethodId, respectively.
|
||||
*
|
||||
* <code>
|
||||
* // Do an attach card transaction on the gateway
|
||||
* $response = $gateway->deleteCard(array(
|
||||
* 'paymentMethod' => $paymentMethodId,
|
||||
* ))->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Gateway detachCard was successful.\n";
|
||||
* // Find the card ID
|
||||
* $methodId = $response->getCardReference();
|
||||
* echo "Method ID = " . $methodId . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreatePaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AttachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\UpdatePaymentMethodRequest
|
||||
* @link https://stripe.com/docs/api/payment_methods/detach
|
||||
*/
|
||||
class DetachPaymentMethodRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentMethod');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_methods/' . $this->getPaymentMethod() . '/detach';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
57
vendor/omnipay/stripe/src/Message/PaymentIntents/FetchPaymentIntentRequest.php
vendored
Normal file
57
vendor/omnipay/stripe/src/Message/PaymentIntents/FetchPaymentIntentRequest.php
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Payment Intent Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Payment Intent Request.
|
||||
*
|
||||
* // Check if we're good!
|
||||
* $paymentIntent = $gateway->fetchPaymentIntent(array(
|
||||
* 'paymentIntentReference' => $paymentIntentReference,
|
||||
* ));
|
||||
*
|
||||
* $response = $paymentIntent->send();
|
||||
*
|
||||
* if ($response->isSuccessful()) {
|
||||
* // All done. Rejoice.
|
||||
* }
|
||||
*
|
||||
* @link https://stripe.com/docs/api/payment_intents/retrieve
|
||||
*/
|
||||
class FetchPaymentIntentRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentIntentReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/payment_intents/' . $this->getPaymentIntentReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
60
vendor/omnipay/stripe/src/Message/PaymentIntents/FetchPaymentMethodRequest.php
vendored
Normal file
60
vendor/omnipay/stripe/src/Message/PaymentIntents/FetchPaymentMethodRequest.php
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Payment Method Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Payment Method Request.
|
||||
*
|
||||
* <code>
|
||||
* $paymentMethod = $gateway->fetchPaymentMethod(array(
|
||||
* 'paymentMethodId' => $paymentMethodId,
|
||||
* ));
|
||||
*
|
||||
* $response = $paymentMethod->send();
|
||||
*
|
||||
* if ($response->isSuccessful()) {
|
||||
* // All done
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api/payment_methods/retrieve
|
||||
*/
|
||||
class FetchPaymentMethodRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentMethod');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/payment_methods/' . $this->getPaymentMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
40
vendor/omnipay/stripe/src/Message/PaymentIntents/PurchaseRequest.php
vendored
Normal file
40
vendor/omnipay/stripe/src/Message/PaymentIntents/PurchaseRequest.php
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Purchase Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Purchase Request.
|
||||
*
|
||||
* A payment method is required. It can be set using the `paymentMethod`, `source`,
|
||||
* `cardReference` or `token` parameters.
|
||||
*
|
||||
* *Important*: Please note, that this gateway is a hybrid between credit card and
|
||||
* off-site gateway. It acts as a normal credit card gateway, unless the payment method
|
||||
* requires 3DS authentication, in which case it also performs a redirect to an
|
||||
* off-site authentication form.
|
||||
*
|
||||
* Because a purchase request in Stripe looks similar to an Authorize request, this
|
||||
* class simply extends the AuthorizeRequest class and overrides the
|
||||
* getData method setting capture_method to be automatic.
|
||||
*
|
||||
* You should also look at that class for code examples.
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AuthorizeRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreatePaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\ConfirmPaymentIntentRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents
|
||||
*/
|
||||
class PurchaseRequest extends AuthorizeRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = parent::getData();
|
||||
$data['capture_method'] = 'automatic';
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
171
vendor/omnipay/stripe/src/Message/PaymentIntents/Response.php
vendored
Normal file
171
vendor/omnipay/stripe/src/Message/PaymentIntents/Response.php
vendored
Normal file
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Response.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
use Omnipay\Stripe\Message\Response as BaseResponse;
|
||||
use Omnipay\Common\Message\RedirectResponseInterface;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Response.
|
||||
*
|
||||
* This is the response class for all payment intents related responses.
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
*/
|
||||
class Response extends BaseResponse implements RedirectResponseInterface
|
||||
{
|
||||
/**
|
||||
* Get the status of a payment intents response.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
return $this->data['status'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the payment intent requires confirmation.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function requiresConfirmation()
|
||||
{
|
||||
return $this->getStatus() === 'requires_confirmation';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getCardReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_method' === $this->data['object']) {
|
||||
if (!empty($this->data['id'])) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
if (!empty($this->data['payment_method'])) {
|
||||
return $this->data['payment_method'];
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getCardReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getCustomerReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_method' === $this->data['object']) {
|
||||
if (!empty($this->data['customer'])) {
|
||||
return $this->data['customer'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
if (!empty($this->data['customer'])) {
|
||||
return $this->data['customer'];
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getCustomerReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the capture method of a payment intents response.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCaptureMethod()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
return $this->data['capture_method'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getTransactionReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
if (!empty($this->data['charges']['data'][0]['id'])) {
|
||||
return $this->data['charges']['data'][0]['id'];
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getTransactionReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
return in_array($this->getStatus(), ['succeeded', 'requires_capture']);
|
||||
}
|
||||
|
||||
return parent::isSuccessful();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isCancelled()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
return $this->getStatus() === 'canceled';
|
||||
}
|
||||
|
||||
return parent::isCancelled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isRedirect()
|
||||
{
|
||||
if ($this->getStatus() === 'requires_action' || $this->getStatus() === 'requires_source_action') {
|
||||
// Currently this gateway supports only manual confirmation, so any other
|
||||
// next action types pretty much mean a failed transaction for us.
|
||||
return (!empty($this->data['next_action']) && $this->data['next_action']['type'] === 'redirect_to_url');
|
||||
}
|
||||
|
||||
return parent::isRedirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getRedirectUrl()
|
||||
{
|
||||
return $this->isRedirect() ? $this->data['next_action']['redirect_to_url']['url'] : parent::getRedirectUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment intent reference.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaymentIntentReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'payment_intent' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
110
vendor/omnipay/stripe/src/Message/PaymentIntents/UpdatePaymentMethodRequest.php
vendored
Normal file
110
vendor/omnipay/stripe/src/Message/PaymentIntents/UpdatePaymentMethodRequest.php
vendored
Normal file
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Update Payment Method Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message\PaymentIntents;
|
||||
|
||||
/**
|
||||
* Stripe Update Payment Method Request.
|
||||
*
|
||||
* If you need to update only some payment method details, like the billing
|
||||
* address or expiration date, you can do so, however it is impossible to change the
|
||||
* card number or the cvc code for a payment method. Stripe also works directly
|
||||
* with card networks so that your customers can continue using your service without
|
||||
* interruption.
|
||||
*
|
||||
* Stripe will automatically validate the payment method on update.
|
||||
* The payment method must be attached to a customer to be updated.
|
||||
*
|
||||
* This requires a paymentMethod.
|
||||
*
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreatePaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\CreateCustomerRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AttachPaymentMethodRequest
|
||||
* @link https://stripe.com/docs/api/payment_methods/update
|
||||
*/
|
||||
class UpdatePaymentMethodRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('paymentMethod');
|
||||
|
||||
$data = [];
|
||||
|
||||
if ($this->getCard()) {
|
||||
$data['card'] = $this->getCardData();
|
||||
$data['billing_details'] = $this->getBillingDetails();
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
|
||||
if ($metadata = $this->getMetadata()) {
|
||||
$data['metadata'] = $metadata;
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/payment_methods/'.$this->getPaymentMethod();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card data.
|
||||
*
|
||||
* This request uses a slightly different format for card data to
|
||||
* the other requests and does not require the card data to be
|
||||
* complete in full (or valid).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCardData()
|
||||
{
|
||||
$data = array();
|
||||
$card = $this->getCard();
|
||||
if (!empty($card)) {
|
||||
if ($card->getExpiryMonth()) {
|
||||
$data['exp_month'] = $card->getExpiryMonth();
|
||||
}
|
||||
if ($card->getExpiryYear()) {
|
||||
$data['exp_year'] = $card->getExpiryYear();
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return an array of the billing details.
|
||||
*/
|
||||
public function getBillingDetails()
|
||||
{
|
||||
$data = parent::getCardData();
|
||||
|
||||
// Take care of optional data by filtering it out.
|
||||
return array_filter([
|
||||
'email' => $data['email'],
|
||||
'name' => $data['name'],
|
||||
'address' => array_filter([
|
||||
'city' => $data['address_city'],
|
||||
'country' => $data['address_country'],
|
||||
'line1' => $data['address_line1'],
|
||||
'line2' => $data['address_line2'],
|
||||
'postal_code' => $data['address_zip'],
|
||||
'state' => $data['address_state'],
|
||||
]),
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
76
vendor/omnipay/stripe/src/Message/PurchaseRequest.php
vendored
Normal file
76
vendor/omnipay/stripe/src/Message/PurchaseRequest.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Purchase Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Purchase Request.
|
||||
*
|
||||
* To charge a credit card, you create a new charge object. If your API key
|
||||
* is in test mode, the supplied card won't actually be charged, though
|
||||
* everything else will occur as if in live mode. (Stripe assumes that the
|
||||
* charge would have completed successfully).
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* <code>
|
||||
* // Create a gateway for the Stripe Gateway
|
||||
* // (routes to GatewayFactory::create)
|
||||
* $gateway = Omnipay::create('Stripe');
|
||||
*
|
||||
* // Initialise the gateway
|
||||
* $gateway->initialize(array(
|
||||
* 'apiKey' => 'MyApiKey',
|
||||
* ));
|
||||
*
|
||||
* // Create a credit card object
|
||||
* // This card can be used for testing.
|
||||
* $card = new CreditCard(array(
|
||||
* 'firstName' => 'Example',
|
||||
* 'lastName' => 'Customer',
|
||||
* 'number' => '4242424242424242',
|
||||
* 'expiryMonth' => '01',
|
||||
* 'expiryYear' => '2020',
|
||||
* 'cvv' => '123',
|
||||
* 'email' => 'customer@example.com',
|
||||
* 'billingAddress1' => '1 Scrubby Creek Road',
|
||||
* 'billingCountry' => 'AU',
|
||||
* 'billingCity' => 'Scrubby Creek',
|
||||
* 'billingPostcode' => '4999',
|
||||
* 'billingState' => 'QLD',
|
||||
* ));
|
||||
*
|
||||
* // Do a purchase transaction on the gateway
|
||||
* $transaction = $gateway->purchase(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'currency' => 'USD',
|
||||
* 'description' => 'This is a test purchase transaction.',
|
||||
* 'card' => $card,
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Purchase transaction was successful!\n";
|
||||
* $sale_id = $response->getTransactionReference();
|
||||
* echo "Transaction reference = " . $sale_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* Because a purchase request in Stripe looks similar to an
|
||||
* Authorize request, this class simply extends the AuthorizeRequest
|
||||
* class and over-rides the getData method setting capture = true.
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#charges
|
||||
*/
|
||||
class PurchaseRequest extends AuthorizeRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$data = parent::getData();
|
||||
$data['capture'] = 'true';
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
133
vendor/omnipay/stripe/src/Message/RefundRequest.php
vendored
Normal file
133
vendor/omnipay/stripe/src/Message/RefundRequest.php
vendored
Normal file
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Refund Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Refund Request.
|
||||
*
|
||||
* When you create a new refund, you must specify a
|
||||
* charge to create it on.
|
||||
*
|
||||
* Creating a new refund will refund a charge that has
|
||||
* previously been created but not yet refunded. Funds will
|
||||
* be refunded to the credit or debit card that was originally
|
||||
* charged. The fees you were originally charged are also
|
||||
* refunded.
|
||||
*
|
||||
* You can optionally refund only part of a charge. You can
|
||||
* do so as many times as you wish until the entire charge
|
||||
* has been refunded.
|
||||
*
|
||||
* Once entirely refunded, a charge can't be refunded again.
|
||||
* This method will return an error when called on an
|
||||
* already-refunded charge, or when trying to refund more
|
||||
* money than is left on a charge.
|
||||
*
|
||||
* Example -- note this example assumes that the purchase has been successful
|
||||
* and that the transaction ID returned from the purchase is held in $sale_id.
|
||||
* See PurchaseRequest for the first part of this example transaction:
|
||||
*
|
||||
* <code>
|
||||
* // Do a refund transaction on the gateway
|
||||
* $transaction = $gateway->refund(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'transactionReference' => $sale_id,
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Refund transaction was successful!\n";
|
||||
* $refund_id = $response->getTransactionReference();
|
||||
* echo "Transaction reference = " . $refund_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see PurchaseRequest
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#create_refund
|
||||
*/
|
||||
class RefundRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return bool Whether the application fee should be refunded
|
||||
*/
|
||||
public function getRefundApplicationFee()
|
||||
{
|
||||
return $this->getParameter('refundApplicationFee');
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to refund the application fee associated with a charge.
|
||||
*
|
||||
* From the {@link https://stripe.com/docs/api#create_refund Stripe docs}:
|
||||
* Boolean indicating whether the application fee should be refunded
|
||||
* when refunding this charge. If a full charge refund is given, the
|
||||
* full application fee will be refunded. Else, the application fee
|
||||
* will be refunded with an amount proportional to the amount of the
|
||||
* charge refunded. An application fee can only be refunded by the
|
||||
* application that created the charge.
|
||||
*
|
||||
* @param bool $value Whether the application fee should be refunded
|
||||
*
|
||||
* @return AbstractRequest
|
||||
*/
|
||||
public function setRefundApplicationFee($value)
|
||||
{
|
||||
return $this->setParameter('refundApplicationFee', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool Whether the transfer should be reversed
|
||||
*/
|
||||
public function getReverseTransfer()
|
||||
{
|
||||
return $this->getParameter('reverseTransfer');
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to refund the application fee associated with a charge.
|
||||
*
|
||||
* From the {@link https://stripe.com/docs/connect/destination-charges#issuing-refunds Stripe docs}:
|
||||
* Charges created on the platform account can be refunded using the
|
||||
* platform account's secret key. When refunding a charge that has a
|
||||
* `destination[account]`, by default the destination account keeps the
|
||||
* funds that were transferred to it, leaving the platform account to
|
||||
* cover the negative balance from the refund. To pull back the funds
|
||||
* from the connected account to cover the refund, set the
|
||||
* `reverse_transfer` parameter to true when creating the refund
|
||||
*
|
||||
* @param bool $value Whether the transfer should be refunded
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setReverseTransfer($value)
|
||||
{
|
||||
return $this->setParameter('reverseTransfer', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transactionReference', 'amount');
|
||||
|
||||
$data = array();
|
||||
$data['amount'] = $this->getAmountInteger();
|
||||
|
||||
if ($this->getRefundApplicationFee()) {
|
||||
$data['refund_application_fee'] = 'true';
|
||||
}
|
||||
|
||||
if ($this->getReverseTransfer()) {
|
||||
$data['reverse_transfer'] = 'true';
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/charges/'.$this->getTransactionReference().'/refund';
|
||||
}
|
||||
}
|
||||
596
vendor/omnipay/stripe/src/Message/Response.php
vendored
Normal file
596
vendor/omnipay/stripe/src/Message/Response.php
vendored
Normal file
@@ -0,0 +1,596 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Response.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
use Omnipay\Common\Message\AbstractResponse;
|
||||
use Omnipay\Common\Message\RedirectResponseInterface;
|
||||
use Omnipay\Common\Message\RequestInterface;
|
||||
|
||||
/**
|
||||
* Stripe Response.
|
||||
*
|
||||
* This is the response class for all Stripe requests.
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
*/
|
||||
class Response extends AbstractResponse implements RedirectResponseInterface
|
||||
{
|
||||
/**
|
||||
* Request id
|
||||
*
|
||||
* @var string URL
|
||||
*/
|
||||
protected $requestId = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $headers = [];
|
||||
|
||||
public function __construct(RequestInterface $request, $data, $headers = [])
|
||||
{
|
||||
$this->request = $request;
|
||||
$this->data = json_decode($data, true);
|
||||
$this->headers = $headers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the transaction successful?
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
if ($this->isRedirect()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !isset($this->data['error']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the charge reference from the response of FetchChargeRequest.
|
||||
*
|
||||
* @deprecated 2.3.3:3.0.0 duplicate of \Omnipay\Stripe\Message\Response::getTransactionReference()
|
||||
* @see \Omnipay\Stripe\Message\Response::getTransactionReference()
|
||||
* @return array|null
|
||||
*/
|
||||
public function getChargeReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the outcome of a charge from the response
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getOutcome()
|
||||
{
|
||||
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
|
||||
if (isset($this->data['outcome']) && !empty($this->data['outcome'])) {
|
||||
return $this->data['outcome'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transaction reference.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTransactionReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
if (isset($this->data['error']) && isset($this->data['error']['charge'])) {
|
||||
return $this->data['error']['charge'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the balance transaction reference.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getApplicationFeeReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'application_fee' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
if (isset($this->data['error']) && isset($this->data['error']['application_fee'])) {
|
||||
return $this->data['error']['application_fee'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the balance transaction reference.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getBalanceTransactionReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
|
||||
return $this->data['balance_transaction'];
|
||||
}
|
||||
if (isset($this->data['object']) && 'balance_transaction' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
if (isset($this->data['error']) && isset($this->data['error']['charge'])) {
|
||||
return $this->data['error']['charge'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a customer reference, for createCustomer requests.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCustomerReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'customer' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'card' === $this->data['object']) {
|
||||
if (!empty($this->data['customer'])) {
|
||||
return $this->data['customer'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
|
||||
if (!empty($this->data['customer'])) {
|
||||
return $this->data['customer'];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a card reference, for createCard or createCustomer requests.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCardReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'customer' === $this->data['object']) {
|
||||
if (isset($this->data['default_source']) && !empty($this->data['default_source'])) {
|
||||
return $this->data['default_source'];
|
||||
}
|
||||
|
||||
if (isset($this->data['default_card']) && !empty($this->data['default_card'])) {
|
||||
return $this->data['default_card'];
|
||||
}
|
||||
|
||||
if (!empty($this->data['id'])) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'card' === $this->data['object']) {
|
||||
if (!empty($this->data['id'])) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'charge' === $this->data['object']) {
|
||||
if (! empty($this->data['source'])) {
|
||||
if (!empty($this->data['source']['three_d_secure']['card'])) {
|
||||
return $this->data['source']['three_d_secure']['card'];
|
||||
}
|
||||
|
||||
if (! empty($this->data['source']['id'])) {
|
||||
return $this->data['source']['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a token, for createCard requests.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getToken()
|
||||
{
|
||||
if (isset($this->data['object']) && 'token' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card data from the response.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getCard()
|
||||
{
|
||||
if (isset($this->data['card'])) {
|
||||
return $this->data['card'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card data from the response of purchaseRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
if (isset($this->data['source']) && $this->data['source']['object'] == 'card') {
|
||||
return $this->data['source'];
|
||||
}
|
||||
|
||||
if (isset($this->data['object']) && 'source' === $this->data['object']) {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subscription reference from the response of CreateSubscriptionRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getSubscriptionReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'subscription') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subscription schedule reference from the response of FetchSubscriptionSchedulesRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getSubscriptionSchedulesReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'subscription_schedule') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the event reference from the response of FetchEventRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getEventReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'event') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the invoice reference from the response of FetchInvoiceRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getInvoiceReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'invoice') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transfer reference from the response of CreateTransferRequest,
|
||||
* UpdateTransferRequest, and FetchTransferRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'transfer') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the transfer reference from the response of CreateTransferReversalRequest,
|
||||
* UpdateTransferReversalRequest, and FetchTransferReversalRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getTransferReversalReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'transfer_reversal') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the list object from a result
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getList()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'list') {
|
||||
return $this->data['data'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subscription plan from the response of CreateSubscriptionRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getPlan()
|
||||
{
|
||||
if (isset($this->data['plan'])) {
|
||||
return $this->data['plan'];
|
||||
} elseif (array_key_exists('object', $this->data) && $this->data['object'] == 'plan') {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plan id
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPlanId()
|
||||
{
|
||||
$plan = $this->getPlan();
|
||||
|
||||
if ($plan && array_key_exists('id', $plan)) {
|
||||
return $plan['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get plan id
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSourceId()
|
||||
{
|
||||
if (isset($this->data['object']) && 'source' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get invoice-item reference
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getInvoiceItemReference()
|
||||
{
|
||||
if (isset($this->data['object']) && $this->data['object'] == 'invoiceitem') {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error message from the response.
|
||||
*
|
||||
* Returns null if the request was successful.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMessage()
|
||||
{
|
||||
if (!$this->isSuccessful() && isset($this->data['error']) && isset($this->data['error']['message'])) {
|
||||
return $this->data['error']['message'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error message from the response.
|
||||
*
|
||||
* Returns null if the request was successful.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCode()
|
||||
{
|
||||
if (!$this->isSuccessful() && isset($this->data['error']) && isset($this->data['error']['code'])) {
|
||||
return $this->data['error']['code'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getRequestId()
|
||||
{
|
||||
if (isset($this->headers['Request-Id'])) {
|
||||
return $this->headers['Request-Id'][0];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source reference
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getSourceReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'source' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function isRedirect()
|
||||
{
|
||||
if (isset($this->data['object']) && 'source' === $this->data['object']) {
|
||||
if ($this->cardCan3DS() || ($this->isThreeDSecureSourcePending() && $this->getRedirectUrl() !== null)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if card requires 3DS
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function cardCan3DS()
|
||||
{
|
||||
if (isset($this->data['type']) && 'card' === $this->data['type']) {
|
||||
if (isset($this->data['card']['three_d_secure']) &&
|
||||
in_array($this->data['card']['three_d_secure'], ['required', 'optional', 'recommended'], true)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the ThreeDSecure source has status pending
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
protected function isThreeDSecureSourcePending()
|
||||
{
|
||||
if (isset($this->data['type']) && 'three_d_secure' === $this->data['type']) {
|
||||
if (isset($this->data['status']) && 'pending' === $this->data['status']) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRedirectUrl()
|
||||
{
|
||||
if (isset($this->data['object']) && 'source' === $this->data['object'] &&
|
||||
isset($this->data['type']) && 'three_d_secure' === $this->data['type'] &&
|
||||
!empty($this->data['redirect']['url'])
|
||||
) {
|
||||
return $this->data['redirect']['url'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRedirectMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getRedirectData()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the source reference of ThreeDSecure charge
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function getSessionId()
|
||||
{
|
||||
if (isset($this->data['type']) && 'three_d_secure' === $this->data['type']) {
|
||||
return $this->getSourceReference();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the coupon plan from the response of CreateCouponRequest.
|
||||
*
|
||||
* @return array|null
|
||||
*/
|
||||
public function getCoupon()
|
||||
{
|
||||
if (isset($this->data['coupon'])) {
|
||||
return $this->data['coupon'];
|
||||
} elseif (array_key_exists('object', $this->data) && $this->data['object'] == 'coupon') {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get coupon id
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCouponId()
|
||||
{
|
||||
$coupon = $this->getCoupon();
|
||||
|
||||
if ($coupon && array_key_exists('id', $coupon)) {
|
||||
return $coupon['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
38
vendor/omnipay/stripe/src/Message/SetupIntents/AbstractRequest.php
vendored
Normal file
38
vendor/omnipay/stripe/src/Message/SetupIntents/AbstractRequest.php
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Abstract Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\SetupIntents;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intent Abstract Request.
|
||||
*
|
||||
* This is the parent class for all Stripe payment intent requests.
|
||||
* It adds just a getter and setter.
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
* @see \Omnipay\Stripe\Message\AbstractRequest
|
||||
* @link https://stripe.com/docs/api/payment_intents
|
||||
*/
|
||||
abstract class AbstractRequest extends \Omnipay\Stripe\Message\AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return AbstractRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSetupIntentReference($value)
|
||||
{
|
||||
return $this->setParameter('setupIntentReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSetupIntentReference()
|
||||
{
|
||||
return $this->getParameter('setupIntentReference');
|
||||
}
|
||||
}
|
||||
67
vendor/omnipay/stripe/src/Message/SetupIntents/CreateSetupIntentRequest.php
vendored
Normal file
67
vendor/omnipay/stripe/src/Message/SetupIntents/CreateSetupIntentRequest.php
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Payment Method Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\SetupIntents;
|
||||
|
||||
/**
|
||||
* Stripe create setup intent
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* <code>
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AttachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\UpdatePaymentMethodRequest
|
||||
* @link https://stripe.com/docs/api/setup_intents/create
|
||||
*/
|
||||
class CreateSetupIntentRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$data = [];
|
||||
|
||||
if ($this->getCustomerReference()) {
|
||||
$data['customer'] = $this->getCustomerReference();
|
||||
}
|
||||
if ($this->getDescription()) {
|
||||
$data['description'] = $this->getDescription();
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$this['metadata'] = $this->getMetadata();
|
||||
}
|
||||
if ($this->getPaymentMethod()) {
|
||||
$this['payment_method'] = $this->getPaymentMethod();
|
||||
}
|
||||
|
||||
$data['usage'] = 'off_session';
|
||||
$data['payment_method_types'][] = 'card';
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/setup_intents';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
145
vendor/omnipay/stripe/src/Message/SetupIntents/Response.php
vendored
Normal file
145
vendor/omnipay/stripe/src/Message/SetupIntents/Response.php
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Response.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\SetupIntents;
|
||||
|
||||
use Omnipay\Common\Message\ResponseInterface;
|
||||
use Omnipay\Stripe\Message\Response as BaseResponse;
|
||||
|
||||
/**
|
||||
* Stripe Payment Intents Response.
|
||||
*
|
||||
* This is the response class for all payment intents related responses.
|
||||
*
|
||||
* @see \Omnipay\Stripe\PaymentIntentsGateway
|
||||
*/
|
||||
class Response extends BaseResponse implements ResponseInterface
|
||||
{
|
||||
/**
|
||||
* Get the status of a payment intents response.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getStatus()
|
||||
{
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
return $this->data['status'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the payment intent requires confirmation.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function requiresConfirmation()
|
||||
{
|
||||
return $this->getStatus() === 'requires_confirmation';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getClientSecret()
|
||||
{
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
if (!empty($this->data['client_secret'])) {
|
||||
return $this->data['client_secret'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getCustomerReference()
|
||||
{
|
||||
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
if (!empty($this->data['customer'])) {
|
||||
return $this->data['customer'];
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getCustomerReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isSuccessful()
|
||||
{
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
return in_array($this->getStatus(), ['succeeded', 'requires_payment_method']);
|
||||
}
|
||||
|
||||
return parent::isSuccessful();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isCancelled()
|
||||
{
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
return $this->getStatus() === 'canceled';
|
||||
}
|
||||
|
||||
return parent::isCancelled();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function isRedirect()
|
||||
{
|
||||
if ($this->getStatus() === 'requires_action' || $this->getStatus() === 'requires_source_action') {
|
||||
// Currently this gateway supports only manual confirmation, so any other
|
||||
// next action types pretty much mean a failed transaction for us.
|
||||
return (!empty($this->data['next_action']) && $this->data['next_action']['type'] === 'redirect_to_url');
|
||||
}
|
||||
|
||||
return parent::isRedirect();
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getRedirectUrl()
|
||||
{
|
||||
return $this->isRedirect() ? $this->data['next_action']['redirect_to_url']['url'] : parent::getRedirectUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment intent reference.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSetupIntentReference()
|
||||
{
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
return $this->data['id'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the payment intent reference.
|
||||
*
|
||||
* @return string|null
|
||||
*/
|
||||
public function getPaymentMethod()
|
||||
{
|
||||
if (isset($this->data['object']) && 'setup_intent' === $this->data['object']) {
|
||||
return $this->data['payment_method'];
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
55
vendor/omnipay/stripe/src/Message/SetupIntents/RetrieveSetupIntentRequest.php
vendored
Normal file
55
vendor/omnipay/stripe/src/Message/SetupIntents/RetrieveSetupIntentRequest.php
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Create Payment Method Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\SetupIntents;
|
||||
|
||||
/**
|
||||
* Stripe create setup intent
|
||||
*
|
||||
* ### Example
|
||||
*
|
||||
* <code>
|
||||
*
|
||||
* </code>
|
||||
*
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\AttachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\DetachPaymentMethodRequest
|
||||
* @see \Omnipay\Stripe\Message\PaymentIntents\UpdatePaymentMethodRequest
|
||||
* @link https://stripe.com/docs/api/setup_intents/create
|
||||
*/
|
||||
class RetrieveSetupIntentRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('setupIntentReference');
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint . '/setup_intents/' . $this->getSetupIntentReference();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
*/
|
||||
protected function createResponse($data, $headers = [])
|
||||
{
|
||||
return $this->response = new Response($this, $data, $headers);
|
||||
}
|
||||
}
|
||||
93
vendor/omnipay/stripe/src/Message/Transfers/CreateTransferRequest.php
vendored
Normal file
93
vendor/omnipay/stripe/src/Message/Transfers/CreateTransferRequest.php
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Transfer Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Common\Exception\InvalidRequestException;
|
||||
use Omnipay\Stripe\Message\AuthorizeRequest;
|
||||
|
||||
/**
|
||||
* Stripe Transfer Request.
|
||||
*
|
||||
* To send funds from your Stripe account to a connected account, you create
|
||||
* a new transfer object. Your Stripe balance must be able to cover the
|
||||
* transfer amount, or you'll receive an "Insufficient Funds" error.
|
||||
*
|
||||
* Example -- note this example assumes that the original charge was successful
|
||||
*
|
||||
* <code>
|
||||
* // Create the transfer object when moving funds between Stripe accounts
|
||||
* $transaction = $gateway->transfer(array(
|
||||
* 'amount' => '10.00',
|
||||
* 'currency' => 'AUD',
|
||||
* 'transferGroup' => '{ORDER10}',
|
||||
* 'destination' => '{CONNECTED_STRIPE_ACCOUNT_ID}',
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @see AuthorizeRequest
|
||||
* @link https://stripe.com/docs/connect/charges-transfers
|
||||
*/
|
||||
class CreateTransferRequest extends AuthorizeRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getSourceTransaction()
|
||||
{
|
||||
return $this->getParameter('sourceTransaction');
|
||||
}
|
||||
|
||||
/**
|
||||
* When creating separate charges and transfers, your platform can
|
||||
* inadvertently attempt a transfer without having a sufficient
|
||||
* available balance. Doing so raises an error and the transfer
|
||||
* attempt fails. If you’re commonly experiencing this problem, you
|
||||
* can use the `source_transaction` parameter to tie a transfer to an
|
||||
* existing charge. By using `source_transaction`, the transfer
|
||||
* request succeeds regardless of your available balance and the
|
||||
* transfer itself only occurs once the charge’s funds become available.
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setSourceTransaction($value)
|
||||
{
|
||||
return $this->setParameter('sourceTransaction', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('amount', 'currency', 'destination');
|
||||
|
||||
$data = array(
|
||||
'amount' => $this->getAmountInteger(),
|
||||
'currency' => strtolower($this->getCurrency()),
|
||||
'destination' => $this->getDestination(),
|
||||
);
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if ($this->getTransferGroup()) {
|
||||
$data['transfer_group'] = $this->getTransferGroup();
|
||||
} elseif ($this->getSourceTransaction()) {
|
||||
$data['source_transaction'] = $this->getSourceTransaction();
|
||||
} else {
|
||||
throw new InvalidRequestException("The sourceTransaction or transferGroup parameter is required");
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers';
|
||||
}
|
||||
}
|
||||
91
vendor/omnipay/stripe/src/Message/Transfers/CreateTransferReversalRequest.php
vendored
Normal file
91
vendor/omnipay/stripe/src/Message/Transfers/CreateTransferReversalRequest.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Reverse Transfer Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\RefundRequest;
|
||||
|
||||
/**
|
||||
* Stripe Transfer Reversal Request.
|
||||
*
|
||||
* When you create a new reversal, you must specify a transfer to create it on.
|
||||
*
|
||||
* When reversing transfers, you can optionally reverse part of the transfer.
|
||||
* You can do so as many times as you wish until the entire transfer has been
|
||||
* reversed.
|
||||
*
|
||||
* Once entirely reversed, a transfer can't be reversed again. This method will
|
||||
* return an error when called on an already-reversed transfer, or when trying
|
||||
* to reverse more money than is left on a transfer.
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->reverseTransfer(array(
|
||||
* 'transferReference' => '{TRANSFER_ID}',
|
||||
* 'description' => 'Had to reverse this transfer because of things'
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api#create_transfer_reversal
|
||||
*/
|
||||
class CreateTransferReversalRequest extends RefundRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
return $this->getParameter('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferReference($value)
|
||||
{
|
||||
return $this->setParameter('transferReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transferReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
// If no amount is passed, then the entire transfer is reversed
|
||||
if ($this->getAmountInteger()) {
|
||||
$data['amount'] = $this->getAmountInteger();
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if ($this->getDescription()) {
|
||||
$data['description'] = $this->getDescription();
|
||||
}
|
||||
|
||||
if ($this->getRefundApplicationFee()) {
|
||||
$data['refund_application_fee'] = 'true';
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers/'.$this->getTransferReference().'/reversals';
|
||||
}
|
||||
}
|
||||
59
vendor/omnipay/stripe/src/Message/Transfers/FetchTransferRequest.php
vendored
Normal file
59
vendor/omnipay/stripe/src/Message/Transfers/FetchTransferRequest.php
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transfer Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transfer Request.
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->fetchTransfer([
|
||||
* 'transferReference' => '{TRANSFER_ID}',
|
||||
* ]);
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_transfer
|
||||
*/
|
||||
class FetchTransferRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
return $this->getParameter('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferReference($value)
|
||||
{
|
||||
return $this->setParameter('transferReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers/'.$this->getTransferReference();
|
||||
}
|
||||
}
|
||||
73
vendor/omnipay/stripe/src/Message/Transfers/FetchTransferReversalRequest.php
vendored
Normal file
73
vendor/omnipay/stripe/src/Message/Transfers/FetchTransferReversalRequest.php
vendored
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transfer Reversal Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe Fetch Transfer Reversal Request.
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->fetchTransferReversal([
|
||||
* 'transferReference' => '{TRANSFER_ID}',
|
||||
* 'reversalReference' => '{REVERSAL_ID}',
|
||||
* ]);
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
* @link https://stripe.com/docs/api#retrieve_transfer_reversal
|
||||
*/
|
||||
class FetchTransferReversalRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getReversalReference()
|
||||
{
|
||||
return $this->getParameter('reversalReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setReversalReference($value)
|
||||
{
|
||||
return $this->setParameter('reversalReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
return $this->getParameter('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferReference($value)
|
||||
{
|
||||
return $this->setParameter('transferReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('reversalReference', 'transferReference');
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers/'.$this->getTransferReference().'/reversals/'.$this->getReversalReference();
|
||||
}
|
||||
}
|
||||
144
vendor/omnipay/stripe/src/Message/Transfers/ListTransferReversalsRequest.php
vendored
Normal file
144
vendor/omnipay/stripe/src/Message/Transfers/ListTransferReversalsRequest.php
vendored
Normal file
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe List Transfer Reversals Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe List Transfer Reversals Request.
|
||||
*
|
||||
* You can see a list of the reversals belonging to a specific transfer.
|
||||
*
|
||||
* Note that the 10 most recent reversals are always available by default
|
||||
* on the transfer object. If you need more than those 10, you can use
|
||||
* this API method and the `limit` and `starting_after` parameters to
|
||||
* page through additional reversals.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#list_transfer_reversals
|
||||
*/
|
||||
class ListTransferReversalsRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
return $this->getParameter('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferReference($value)
|
||||
{
|
||||
return $this->setParameter('transferReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLimit()
|
||||
{
|
||||
return $this->getParameter('limit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setLimit($value)
|
||||
{
|
||||
return $this->setParameter('limit', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list.
|
||||
* For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your
|
||||
* subsequent call can include `ending_before=obj_ba`r in order to fetch the previous page of the list.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEndingBefore()
|
||||
{
|
||||
return $this->getParameter('endingBefore');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setEndingBefore($value)
|
||||
{
|
||||
return $this->setParameter('endingBefore', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list.
|
||||
* For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your
|
||||
* subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStartingAfter()
|
||||
{
|
||||
return $this->getParameter('startingAfter');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setStartingAfter($value)
|
||||
{
|
||||
return $this->setParameter('startingAfter', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transferReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($this->getLimit()) {
|
||||
$data['limit'] = $this->getLimit();
|
||||
}
|
||||
|
||||
if ($this->getEndingBefore()) {
|
||||
$data['ending_before'] = $this->getEndingBefore();
|
||||
}
|
||||
|
||||
if ($this->getStartingAfter()) {
|
||||
$data['starting_after'] = $this->getStartingAfter();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers/'.$this->getTransferReference().'/reversals';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
167
vendor/omnipay/stripe/src/Message/Transfers/ListTransfersRequest.php
vendored
Normal file
167
vendor/omnipay/stripe/src/Message/Transfers/ListTransfersRequest.php
vendored
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe List Transfers Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe List Transfers Request.
|
||||
*
|
||||
* Returns a list of existing transfers sent to connected accounts. The
|
||||
* transfers are returned in sorted order, with the most recently created
|
||||
* transfers appearing first.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#list_transfers
|
||||
*/
|
||||
class ListTransfersRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getLimit()
|
||||
{
|
||||
return $this->getParameter('limit');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setLimit($value)
|
||||
{
|
||||
return $this->setParameter('limit', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDestination()
|
||||
{
|
||||
return $this->getParameter('destination');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setDestination($value)
|
||||
{
|
||||
return $this->setParameter('destination', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect only
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferGroup()
|
||||
{
|
||||
return $this->getParameter('transferGroup');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferGroup($value)
|
||||
{
|
||||
return $this->setParameter('transferGroup', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list.
|
||||
* For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your
|
||||
* subsequent call can include `ending_before=obj_ba`r in order to fetch the previous page of the list.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getEndingBefore()
|
||||
{
|
||||
return $this->getParameter('endingBefore');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setEndingBefore($value)
|
||||
{
|
||||
return $this->setParameter('endingBefore', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* A cursor for use in pagination. `starting_after` is an object ID that defines your place in the list.
|
||||
* For instance, if you make a list request and receive 100 objects, ending with `obj_foo`, your
|
||||
* subsequent call can include `starting_after=obj_foo` in order to fetch the next page of the list.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getStartingAfter()
|
||||
{
|
||||
return $this->getParameter('startingAfter');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setStartingAfter($value)
|
||||
{
|
||||
return $this->setParameter('startingAfter', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
if ($this->getLimit()) {
|
||||
$data['limit'] = $this->getLimit();
|
||||
}
|
||||
|
||||
if ($this->getDestination()) {
|
||||
$data['destination'] = $this->getDestination();
|
||||
}
|
||||
|
||||
if ($this->getTransferGroup()) {
|
||||
$data['transfer_group'] = $this->getTransferGroup();
|
||||
}
|
||||
|
||||
if ($this->getEndingBefore()) {
|
||||
$data['ending_before'] = $this->getEndingBefore();
|
||||
}
|
||||
|
||||
if ($this->getStartingAfter()) {
|
||||
$data['starting_after'] = $this->getStartingAfter();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'GET';
|
||||
}
|
||||
}
|
||||
75
vendor/omnipay/stripe/src/Message/Transfers/UpdateTransferRequest.php
vendored
Normal file
75
vendor/omnipay/stripe/src/Message/Transfers/UpdateTransferRequest.php
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Update Transfer Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe Update Transfer Request.
|
||||
*
|
||||
* Updates the specified transfer by setting the values of the parameters passed.
|
||||
* Any parameters not provided will be left unchanged.
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->updateTransfer(array(
|
||||
* 'transferReference' => '{TRANSFER_ID}',
|
||||
* 'metadata' => [],
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api#update_transfer
|
||||
*/
|
||||
class UpdateTransferRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the plan ID
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
return $this->getParameter('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan ID
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferReference($value)
|
||||
{
|
||||
return $this->setParameter('transferReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transferReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers/'.$this->getTransferReference();
|
||||
}
|
||||
}
|
||||
96
vendor/omnipay/stripe/src/Message/Transfers/UpdateTransferReversalRequest.php
vendored
Normal file
96
vendor/omnipay/stripe/src/Message/Transfers/UpdateTransferReversalRequest.php
vendored
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Update Transfer Reversal Request (Connect only).
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message\Transfers;
|
||||
|
||||
use Omnipay\Stripe\Message\AbstractRequest;
|
||||
|
||||
/**
|
||||
* Stripe Update Transfer Reversal Request.
|
||||
*
|
||||
* Updates the specified reversal by setting the values of the parameters passed.
|
||||
* Any parameters not provided will be left unchanged.
|
||||
*
|
||||
* This request only accepts metadata and description as arguments.
|
||||
*
|
||||
* <code>
|
||||
* // Once the transaction has been authorized, we can capture it for final payment.
|
||||
* $transaction = $gateway->updateTransfer(array(
|
||||
* 'transferReference' => '{TRANSFER_ID}',
|
||||
* 'reversalReference' => '{REVERSAL_ID}',
|
||||
* 'metadata' => [],
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* </code>
|
||||
*
|
||||
* @link https://stripe.com/docs/api#update_transfer_reversal
|
||||
*/
|
||||
class UpdateTransferReversalRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getReversalReference()
|
||||
{
|
||||
return $this->getParameter('reversalReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setReversalReference($value)
|
||||
{
|
||||
return $this->setParameter('reversalReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
*/
|
||||
public function getTransferReference()
|
||||
{
|
||||
return $this->getParameter('transferReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return \Omnipay\Common\Message\AbstractRequest
|
||||
*/
|
||||
public function setTransferReference($value)
|
||||
{
|
||||
return $this->setParameter('transferReference', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('reversalReference', 'transferReference');
|
||||
|
||||
$data = array();
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if ($this->getDescription()) {
|
||||
$data['description'] = $this->getDescription();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/transfers/'.$this->getTransferReference().'/reversals/'.$this->getReversalReference();
|
||||
}
|
||||
}
|
||||
91
vendor/omnipay/stripe/src/Message/UpdateCardRequest.php
vendored
Normal file
91
vendor/omnipay/stripe/src/Message/UpdateCardRequest.php
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Update Credit Card Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Update Credit Card Request.
|
||||
*
|
||||
* If you need to update only some card details, like the billing
|
||||
* address or expiration date, you can do so without having to re-enter
|
||||
* the full card details. Stripe also works directly with card networks
|
||||
* so that your customers can continue using your service without
|
||||
* interruption.
|
||||
*
|
||||
* When you update a card, Stripe will automatically validate the card.
|
||||
*
|
||||
* This requires both a customerReference and a cardReference.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#update_card
|
||||
*/
|
||||
class UpdateCardRequest extends AbstractRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('cardReference');
|
||||
$this->validate('customerReference');
|
||||
|
||||
if ($this->getCard()) {
|
||||
return $this->getCardData();
|
||||
} else {
|
||||
return array();
|
||||
}
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference().
|
||||
'/cards/'.$this->getCardReference();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the card data.
|
||||
*
|
||||
* This request uses a slightly different format for card data to
|
||||
* the other requests and does not require the card data to be
|
||||
* complete in full (or valid).
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
protected function getCardData()
|
||||
{
|
||||
$data = array();
|
||||
$card = $this->getCard();
|
||||
if (!empty($card)) {
|
||||
if ($card->getExpiryMonth()) {
|
||||
$data['exp_month'] = $card->getExpiryMonth();
|
||||
}
|
||||
if ($card->getExpiryYear()) {
|
||||
$data['exp_year'] = $card->getExpiryYear();
|
||||
}
|
||||
if ($card->getName()) {
|
||||
$data['name'] = $card->getName();
|
||||
}
|
||||
if ($card->getNumber()) {
|
||||
$data['number'] = $card->getNumber();
|
||||
}
|
||||
if ($card->getAddress1()) {
|
||||
$data['address_line1'] = $card->getAddress1();
|
||||
}
|
||||
if ($card->getAddress2()) {
|
||||
$data['address_line2'] = $card->getAddress2();
|
||||
}
|
||||
if ($card->getCity()) {
|
||||
$data['address_city'] = $card->getCity();
|
||||
}
|
||||
if ($card->getPostcode()) {
|
||||
$data['address_zip'] = $card->getPostcode();
|
||||
}
|
||||
if ($card->getState()) {
|
||||
$data['address_state'] = $card->getState();
|
||||
}
|
||||
if ($card->getCountry()) {
|
||||
$data['address_country'] = $card->getCountry();
|
||||
}
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
76
vendor/omnipay/stripe/src/Message/UpdateCouponRequest.php
vendored
Normal file
76
vendor/omnipay/stripe/src/Message/UpdateCouponRequest.php
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Update Coupon Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api/coupons/update
|
||||
*/
|
||||
class UpdateCouponRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the coupon
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCouponId()
|
||||
{
|
||||
return $this->getParameter('couponId');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the coupon
|
||||
*
|
||||
* @param $value
|
||||
* @return UpdateCouponRequest
|
||||
*/
|
||||
public function setCouponId($value)
|
||||
{
|
||||
return $this->setParameter('couponId', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->getParameter('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*
|
||||
* @return UpdateCouponRequest
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
return $this->setParameter('name', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$data = array();
|
||||
|
||||
if (null !== $this->getName()) {
|
||||
$data['name'] = $this->getName();
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/coupons/'.$this->getCouponId();
|
||||
}
|
||||
|
||||
public function getHttpMethod()
|
||||
{
|
||||
return 'POST';
|
||||
}
|
||||
}
|
||||
112
vendor/omnipay/stripe/src/Message/UpdateCustomerRequest.php
vendored
Normal file
112
vendor/omnipay/stripe/src/Message/UpdateCustomerRequest.php
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Update Customer Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Update Customer Request.
|
||||
*
|
||||
* Customer objects allow you to perform recurring charges and
|
||||
* track multiple charges that are associated with the same customer.
|
||||
* The API allows you to create, delete, and update your customers.
|
||||
* You can retrieve individual customers as well as a list of all of
|
||||
* your customers.
|
||||
*
|
||||
* This request updates the specified customer by setting the values
|
||||
* of the parameters passed. Any parameters not provided will be left
|
||||
* unchanged. For example, if you pass the card parameter, that becomes
|
||||
* the customer's active card to be used for all charges in the future,
|
||||
* and the customer email address is updated to the email address
|
||||
* on the card. When you update a customer to a new valid card: for
|
||||
* each of the customer's current subscriptions, if the subscription
|
||||
* is in the `past_due` state, then the latest unpaid, unclosed
|
||||
* invoice for the subscription will be retried (note that this retry
|
||||
* will not count as an automatic retry, and will not affect the next
|
||||
* regularly scheduled payment for the invoice). (Note also that no
|
||||
* invoices pertaining to subscriptions in the `unpaid` state, or
|
||||
* invoices pertaining to canceled subscriptions, will be retried as
|
||||
* a result of updating the customer's card.)
|
||||
*
|
||||
* This request accepts mostly the same arguments as the customer
|
||||
* creation call.
|
||||
*
|
||||
* @link https://stripe.com/docs/api#update_customer
|
||||
*/
|
||||
class UpdateCustomerRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the customer's email address.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->getParameter('email');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the customer's email address.
|
||||
*
|
||||
* @param string $value
|
||||
* @return CreateCustomerRequest provides a fluent interface.
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
return $this->setParameter('email', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the customer's source.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->getParameter('source');
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the customer's source.
|
||||
*
|
||||
* @param string $value
|
||||
* @return CreateCustomerRequest provides a fluent interface.
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
$this->setParameter('source', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference');
|
||||
$data = array();
|
||||
$data['description'] = $this->getDescription();
|
||||
|
||||
if ($this->getToken()) {
|
||||
$data['card'] = $this->getToken();
|
||||
} elseif ($this->getCard()) {
|
||||
$this->getCard()->validate();
|
||||
$data['card'] = $this->getCardData();
|
||||
$data['email'] = $this->getCard()->getEmail();
|
||||
} elseif ($this->getEmail()) {
|
||||
$data['email'] = $this->getEmail();
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
if ($this->getSource()) {
|
||||
$data['source'] = $this->getSource();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference();
|
||||
}
|
||||
}
|
||||
101
vendor/omnipay/stripe/src/Message/UpdateSubscriptionRequest.php
vendored
Normal file
101
vendor/omnipay/stripe/src/Message/UpdateSubscriptionRequest.php
vendored
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Update Subscription Request.
|
||||
*/
|
||||
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Update Subscription Request
|
||||
*
|
||||
* @see \Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#update_subscription
|
||||
*/
|
||||
class UpdateSubscriptionRequest extends AbstractRequest
|
||||
{
|
||||
/**
|
||||
* Get the plan
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getPlan()
|
||||
{
|
||||
return $this->getParameter('plan');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the plan
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|UpdateSubscriptionRequest
|
||||
*/
|
||||
public function setPlan($value)
|
||||
{
|
||||
return $this->setParameter('plan', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public function getPlanId()
|
||||
{
|
||||
return $this->getPlan();
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|UpdateSubscriptionRequest
|
||||
*/
|
||||
public function setPlanId($value)
|
||||
{
|
||||
return $this->setPlan($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the subscription reference
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubscriptionReference()
|
||||
{
|
||||
return $this->getParameter('subscriptionReference');
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the subscription reference
|
||||
*
|
||||
* @param $value
|
||||
* @return \Omnipay\Common\Message\AbstractRequest|UpdateSubscriptionRequest
|
||||
*/
|
||||
public function setSubscriptionReference($value)
|
||||
{
|
||||
return $this->setParameter('subscriptionReference', $value);
|
||||
}
|
||||
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('customerReference', 'subscriptionReference', 'plan');
|
||||
|
||||
$data = array(
|
||||
'plan' => $this->getPlan()
|
||||
);
|
||||
|
||||
if ($this->parameters->has('tax_percent')) {
|
||||
$data['tax_percent'] = (float)$this->getParameter('tax_percent');
|
||||
}
|
||||
|
||||
if ($this->getMetadata()) {
|
||||
$data['metadata'] = $this->getMetadata();
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
public function getEndpoint()
|
||||
{
|
||||
return $this->endpoint.'/customers/'.$this->getCustomerReference()
|
||||
.'/subscriptions/'.$this->getSubscriptionReference();
|
||||
}
|
||||
}
|
||||
50
vendor/omnipay/stripe/src/Message/VoidRequest.php
vendored
Normal file
50
vendor/omnipay/stripe/src/Message/VoidRequest.php
vendored
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Stripe Void Request.
|
||||
*/
|
||||
namespace Omnipay\Stripe\Message;
|
||||
|
||||
/**
|
||||
* Stripe Void Request.
|
||||
*
|
||||
* Stripe does not support voiding, per se, but
|
||||
* we treat it as a full refund.
|
||||
*
|
||||
* See RefundRequest for additional information
|
||||
*
|
||||
* Example -- note this example assumes that the purchase has been successful
|
||||
* and that the transaction ID returned from the purchase is held in $sale_id.
|
||||
* See PurchaseRequest for the first part of this example transaction:
|
||||
*
|
||||
* <code>
|
||||
* // Do a void transaction on the gateway
|
||||
* $transaction = $gateway->void(array(
|
||||
* 'transactionReference' => $sale_id,
|
||||
* ));
|
||||
* $response = $transaction->send();
|
||||
* if ($response->isSuccessful()) {
|
||||
* echo "Void transaction was successful!\n";
|
||||
* $void_id = $response->getTransactionReference();
|
||||
* echo "Transaction reference = " . $void_id . "\n";
|
||||
* }
|
||||
* </code>
|
||||
*
|
||||
* @see RefundRequest
|
||||
* @see Omnipay\Stripe\Gateway
|
||||
* @link https://stripe.com/docs/api#create_refund
|
||||
*/
|
||||
class VoidRequest extends RefundRequest
|
||||
{
|
||||
public function getData()
|
||||
{
|
||||
$this->validate('transactionReference');
|
||||
|
||||
$data = array();
|
||||
if ($this->getRefundApplicationFee()) {
|
||||
$data['refund_application_fee'] = 'true';
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user