Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate Discount, SourceTransaction and use sections in more places #1582

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions init.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?php

// File generated from our OpenAPI spec

require __DIR__ . '/lib/Util/ApiVersion.php';

// Stripe singleton
Expand Down Expand Up @@ -70,13 +68,20 @@
require __DIR__ . '/lib/Service/AbstractService.php';
require __DIR__ . '/lib/Service/AbstractServiceFactory.php';

require __DIR__ . '/lib/Collection.php';
require __DIR__ . '/lib/SearchResult.php';
require __DIR__ . '/lib/ErrorObject.php';
require __DIR__ . '/lib/Issuing/CardDetails.php';

// StripeClient
require __DIR__ . '/lib/BaseStripeClientInterface.php';
require __DIR__ . '/lib/StripeClientInterface.php';
require __DIR__ . '/lib/StripeStreamingClientInterface.php';
require __DIR__ . '/lib/BaseStripeClient.php';
require __DIR__ . '/lib/StripeClient.php';

// The beginning of the section generated from our OpenAPI spec

require __DIR__ . '/lib/Account.php';
require __DIR__ . '/lib/AccountLink.php';
require __DIR__ . '/lib/AccountSession.php';
Expand All @@ -94,7 +99,6 @@
require __DIR__ . '/lib/CashBalance.php';
require __DIR__ . '/lib/Charge.php';
require __DIR__ . '/lib/Checkout/Session.php';
require __DIR__ . '/lib/Collection.php';
require __DIR__ . '/lib/CountrySpec.php';
require __DIR__ . '/lib/Coupon.php';
require __DIR__ . '/lib/CreditNote.php';
Expand All @@ -105,7 +109,6 @@
require __DIR__ . '/lib/Discount.php';
require __DIR__ . '/lib/Dispute.php';
require __DIR__ . '/lib/EphemeralKey.php';
require __DIR__ . '/lib/ErrorObject.php';
require __DIR__ . '/lib/Event.php';
require __DIR__ . '/lib/ExchangeRate.php';
require __DIR__ . '/lib/File.php';
Expand All @@ -122,7 +125,6 @@
require __DIR__ . '/lib/InvoiceLineItem.php';
require __DIR__ . '/lib/Issuing/Authorization.php';
require __DIR__ . '/lib/Issuing/Card.php';
require __DIR__ . '/lib/Issuing/CardDetails.php';
require __DIR__ . '/lib/Issuing/Cardholder.php';
require __DIR__ . '/lib/Issuing/Dispute.php';
require __DIR__ . '/lib/Issuing/Transaction.php';
Expand All @@ -148,7 +150,6 @@
require __DIR__ . '/lib/Reporting/ReportRun.php';
require __DIR__ . '/lib/Reporting/ReportType.php';
require __DIR__ . '/lib/Review.php';
require __DIR__ . '/lib/SearchResult.php';
require __DIR__ . '/lib/Service/AccountLinkService.php';
require __DIR__ . '/lib/Service/AccountService.php';
require __DIR__ . '/lib/Service/AccountSessionService.php';
Expand Down Expand Up @@ -302,6 +303,8 @@
require __DIR__ . '/lib/UsageRecordSummary.php';
require __DIR__ . '/lib/WebhookEndpoint.php';

// The end of the section generated from our OpenAPI spec

// OAuth
require __DIR__ . '/lib/OAuth.php';
require __DIR__ . '/lib/OAuthErrorObject.php';
Expand Down
25 changes: 15 additions & 10 deletions lib/Discount.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,28 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe;

/**
* Class Discount.
* A discount represents the actual application of a <a href="https://stripe.com/docs/api#coupons">coupon</a> or <a href="https://stripe.com/docs/api#promotion_codes">promotion code</a>.
* It contains information about when the discount began, when it will end, and what it is applied to.
*
* Related guide: <a href="https://stripe.com/docs/billing/subscriptions/discounts">Applying discounts to subscriptions</a>
*
* @property string $id The ID of the discount object. Discounts cannot be fetched by ID. Use <code>expand[]=discounts</code> in API calls to expand discount IDs in an array.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|string $checkout_session The Checkout session that this coupon is applied to, if it is applied to a particular session in payment mode. Will not be present for subscription mode.
* @property \Stripe\Coupon $coupon Hash describing the coupon applied to create this discount.
* @property string|\Stripe\Customer $customer The ID of the customer associated with this discount.
* @property null|int $end If the coupon has a duration of repeating, the date that this discount will end. If the coupon has a duration of once or forever, this attribute will be null.
* @property string $id The ID of the discount object.
* @property null|string $invoice The invoice that the discount’s coupon was applied to, if it was applied directly to a particular invoice.
* @property null|string $invoice_item The invoice item id (or invoice line item id for invoice line items of type=‘subscription’) that the discount’s coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
* @property string $object String representing the object’s type. Objects of the same type share the same value.
* @property null|string $promotion_code The promotion code applied to create this discount.
* @property \Stripe\Coupon $coupon A coupon contains information about a percent-off or amount-off discount you might want to apply to a customer. Coupons may be applied to <a href="https://stripe.com/docs/api#subscriptions">subscriptions</a>, <a href="https://stripe.com/docs/api#invoices">invoices</a>, <a href="https://stripe.com/docs/api/checkout/sessions">checkout sessions</a>, <a href="https://stripe.com/docs/api#quotes">quotes</a>, and more. Coupons do not work with conventional one-off <a href="https://stripe.com/docs/api#create_charge">charges</a> or <a href="https://stripe.com/docs/api/payment_intents">payment intents</a>.
* @property null|string|\Stripe\Customer $customer The ID of the customer associated with this discount.
* @property null|int $end If the coupon has a duration of <code>repeating</code>, the date that this discount will end. If the coupon has a duration of <code>once</code> or <code>forever</code>, this attribute will be null.
* @property null|string $invoice The invoice that the discount's coupon was applied to, if it was applied directly to a particular invoice.
* @property null|string $invoice_item The invoice item <code>id</code> (or invoice line item <code>id</code> for invoice line items of type='subscription') that the discount's coupon was applied to, if it was applied directly to a particular invoice item or invoice line item.
* @property null|string|\Stripe\PromotionCode $promotion_code The promotion code applied to create this discount.
* @property int $start Date that the coupon was applied.
* @property null|string $subscription The subscription that this coupon is applied to, if it is applied to a particular subscription.
*/
class Discount extends StripeObject
class Discount extends ApiResource
pakrym-stripe marked this conversation as resolved.
Show resolved Hide resolved
{
const OBJECT_NAME = 'discount';
}
10 changes: 6 additions & 4 deletions lib/Service/CoreServiceFactory.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe\Service;

/**
* Service factory class for API resources in the root namespace.
*
* @property OAuthService $oauth
* // Doc: The beginning of the section generated from our OpenAPI spec
* @property AccountLinkService $accountLinks
* @property AccountService $accounts
* @property AccountSessionService $accountSessions
Expand Down Expand Up @@ -34,7 +34,6 @@
* @property InvoiceService $invoices
* @property Issuing\IssuingServiceFactory $issuing
* @property MandateService $mandates
* @property OAuthService $oauth
* @property PaymentIntentService $paymentIntents
* @property PaymentLinkService $paymentLinks
* @property PaymentMethodConfigurationService $paymentMethodConfigurations
Expand Down Expand Up @@ -68,13 +67,16 @@
* @property TransferService $transfers
* @property Treasury\TreasuryServiceFactory $treasury
* @property WebhookEndpointService $webhookEndpoints
* // Doc: The end of the section generated from our OpenAPI spec
*/
class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
{
/**
* @var array<string, string>
*/
private static $classMap = [
'oauth' => OAuthService::class,
// Class Map: The beginning of the section generated from our OpenAPI spec
'accountLinks' => AccountLinkService::class,
'accounts' => AccountService::class,
'accountSessions' => AccountSessionService::class,
Expand Down Expand Up @@ -102,7 +104,6 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'invoices' => InvoiceService::class,
'issuing' => Issuing\IssuingServiceFactory::class,
'mandates' => MandateService::class,
'oauth' => OAuthService::class,
'paymentIntents' => PaymentIntentService::class,
'paymentLinks' => PaymentLinkService::class,
'paymentMethodConfigurations' => PaymentMethodConfigurationService::class,
Expand Down Expand Up @@ -136,6 +137,7 @@ class CoreServiceFactory extends \Stripe\Service\AbstractServiceFactory
'transfers' => TransferService::class,
'treasury' => Treasury\TreasuryServiceFactory::class,
'webhookEndpoints' => WebhookEndpointService::class,
// Class Map: The end of the section generated from our OpenAPI spec
];

protected function getServiceClass($name)
Expand Down
46 changes: 37 additions & 9 deletions lib/SourceTransaction.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,48 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe;

/**
* Class SourceTransaction.
* Some payment methods have no required amount that a customer must send.
* Customers can be instructed to send any amount, and it can be made up of
* multiple transactions. As such, sources can have multiple associated
* transactions.
*
* @property string $id
* @property string $object
* @property \Stripe\StripeObject $ach_credit_transfer
* @property int $amount
* @property int $created
* @property string $customer_data
* @property string $currency
* @property string $type
* @property string $id Unique identifier for the object.
* @property string $object String representing the object's type. Objects of the same type share the same value.
* @property null|\Stripe\StripeObject $ach_credit_transfer
* @property int $amount A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the amount your customer has pushed to the receiver.
* @property null|\Stripe\StripeObject $chf_credit_transfer
* @property int $created Time at which the object was created. Measured in seconds since the Unix epoch.
* @property string $currency Three-letter <a href="https://www.iso.org/iso-4217-currency-codes.html">ISO currency code</a>, in lowercase. Must be a <a href="https://stripe.com/docs/currencies">supported currency</a>.
* @property null|\Stripe\StripeObject $gbp_credit_transfer
* @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode.
* @property null|\Stripe\StripeObject $paper_check
* @property null|\Stripe\StripeObject $sepa_credit_transfer
* @property string $source The ID of the source this transaction is attached to.
* @property string $status The status of the transaction, one of <code>succeeded</code>, <code>pending</code>, or <code>failed</code>.
* @property string $type The type of source this transaction is attached to.
*/
class SourceTransaction extends ApiResource
{
const OBJECT_NAME = 'source_transaction';

const TYPE_ACH_CREDIT_TRANSFER = 'ach_credit_transfer';
const TYPE_ACH_DEBIT = 'ach_debit';
const TYPE_ALIPAY = 'alipay';
const TYPE_BANCONTACT = 'bancontact';
const TYPE_CARD = 'card';
const TYPE_CARD_PRESENT = 'card_present';
const TYPE_EPS = 'eps';
const TYPE_GIROPAY = 'giropay';
const TYPE_IDEAL = 'ideal';
const TYPE_KLARNA = 'klarna';
const TYPE_MULTIBANCO = 'multibanco';
const TYPE_P24 = 'p24';
const TYPE_SEPA_DEBIT = 'sepa_debit';
const TYPE_SOFORT = 'sofort';
const TYPE_THREE_D_SECURE = 'three_d_secure';
const TYPE_WECHAT = 'wechat';
}
10 changes: 5 additions & 5 deletions lib/StripeClient.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<?php

// File generated from our OpenAPI spec

namespace Stripe;

/**
* Client used to send requests to Stripe's API.
*
* @property \Stripe\Service\OAuthService $oauth
* // The beginning of the section generated from our OpenAPI spec
* @property \Stripe\Service\AccountLinkService $accountLinks
* @property \Stripe\Service\AccountSessionService $accountSessions
* @property \Stripe\Service\AccountService $accounts
* @property \Stripe\Service\AccountSessionService $accountSessions
* @property \Stripe\Service\ApplePayDomainService $applePayDomains
* @property \Stripe\Service\ApplicationFeeService $applicationFees
* @property \Stripe\Service\Apps\AppsServiceFactory $apps
Expand All @@ -34,7 +34,6 @@
* @property \Stripe\Service\InvoiceService $invoices
* @property \Stripe\Service\Issuing\IssuingServiceFactory $issuing
* @property \Stripe\Service\MandateService $mandates
* @property \Stripe\Service\OAuthService $oauth
* @property \Stripe\Service\PaymentIntentService $paymentIntents
* @property \Stripe\Service\PaymentLinkService $paymentLinks
* @property \Stripe\Service\PaymentMethodConfigurationService $paymentMethodConfigurations
Expand All @@ -56,8 +55,8 @@
* @property \Stripe\Service\Sigma\SigmaServiceFactory $sigma
* @property \Stripe\Service\SourceService $sources
* @property \Stripe\Service\SubscriptionItemService $subscriptionItems
* @property \Stripe\Service\SubscriptionScheduleService $subscriptionSchedules
* @property \Stripe\Service\SubscriptionService $subscriptions
* @property \Stripe\Service\SubscriptionScheduleService $subscriptionSchedules
* @property \Stripe\Service\Tax\TaxServiceFactory $tax
* @property \Stripe\Service\TaxCodeService $taxCodes
* @property \Stripe\Service\TaxRateService $taxRates
Expand All @@ -68,6 +67,7 @@
* @property \Stripe\Service\TransferService $transfers
* @property \Stripe\Service\Treasury\TreasuryServiceFactory $treasury
* @property \Stripe\Service\WebhookEndpointService $webhookEndpoints
* // The end of the section generated from our OpenAPI spec
*/
class StripeClient extends BaseStripeClient
{
Expand Down
Loading