Файловый менеджер - Редактировать - /var/www/html/stripe.zip
Ðазад
PK ! %l�F� � src/Message/CaptureRequest.phpnu �[��� <?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'; } } PK ! �Z�� � ! src/Message/DeleteCardRequest.phpnu �[��� <?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 null; } 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(); } } PK ! �`��� � src/Message/AbstractRequest.phpnu �[��� <?php /** * Stripe Abstract Request */ namespace Omnipay\Stripe\Message; /** * 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 * @method \Omnipay\Stripe\Message\Response send() */ 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); } 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'; } public function sendData($data) { // Stripe only accepts TLS >= v1.2, so make sure Curl is told $config = $this->httpClient->getConfig(); $curlOptions = $config->get('curl.options'); $curlOptions[CURLOPT_SSLVERSION] = 6; $config->set('curl.options', $curlOptions); $this->httpClient->setConfig($config); // don't throw exceptions for 4xx errors $this->httpClient->getEventDispatcher()->addListener( 'request.error', function ($event) { if ($event['response']->isClientError()) { $event->stopPropagation(); } } ); $httpRequest = $this->httpClient->createRequest( $this->getHttpMethod(), $this->getEndpoint(), null, $data ); $httpResponse = $httpRequest ->setHeader('Authorization', 'Basic '.base64_encode($this->getApiKey().':')) ->send(); return $this->response = new Response($this, $httpResponse->json()); } /** * @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); } /** * 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'; $data['number'] = $card->getNumber(); $data['exp_month'] = $card->getExpiryMonth(); $data['exp_year'] = $card->getExpiryYear(); if ($card->getCvv()) { $data['cvc'] = $card->getCvv(); } $data['name'] = $card->getName(); $data['address_line1'] = $card->getAddress1(); $data['address_line2'] = $card->getAddress2(); $data['address_city'] = $card->getCity(); $data['address_zip'] = $card->getPostcode(); $data['address_state'] = $card->getState(); $data['address_country'] = $card->getCountry(); return $data; } } PK ! �cf�� � % src/Message/UpdateCustomerRequest.phpnu �[��� <?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 { 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(); } return $data; } public function getEndpoint() { return $this->endpoint . '/customers/' . $this->getCustomerReference(); } } PK ! NE�( ( src/Message/PurchaseRequest.phpnu �[��� <?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'; $data['receipt_email'] = $this->getCard()->getEmail(); return $data; } } PK ! �o)� � ! src/Message/UpdateCardRequest.phpnu �[��� <?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'); $data = array(); $data['description'] = $this->getDescription(); if ($this->getSource()) { $data['source'] = $this->getSource(); } elseif ($this->getToken()) { $data['source'] = $this->getToken(); } elseif ($this->getCard()) { $data['source'] = $this->getCardData(); $data['email'] = $this->getCard()->getEmail(); } return $data; } 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; } } PK ! ���� � '