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

Add optional appInfo to StripeClient config #1700

Merged
merged 5 commits into from
May 29, 2024

Conversation

helenye-stripe
Copy link
Contributor

@helenye-stripe helenye-stripe commented May 24, 2024

This adds $appInfo as a valid key in $config when initializing a StripeClient. $appInfo expects the type

array{name: string, version?: string, url?: string, appPartnerId?: string}

It passes this in to APIRequestor as an init parameter with default null, and will be set in headers if not null.

Tests verify that we fall back to global configuration if not passed into StripeClient, by verifying the User-Agent header.

Changelog

  • StripeClient can now accept $appInfo as a $config option, so AppInfo can be set per-client. If not passed in, will fall back on the global AppInfo set by Stripe::setAppInfo().
    • The config expects $appInfo to be of type array{name: string, version?: string, url?: string, partner_id?: string}

@helenye-stripe helenye-stripe requested review from a team and anniel-stripe and removed request for a team May 24, 2024 19:59
lib/ApiRequestor.php Outdated Show resolved Hide resolved
lib/ApiRequestor.php Show resolved Hide resolved
lib/BaseStripeClient.php Outdated Show resolved Hide resolved
tests/Stripe/BaseStripeClientTest.php Outdated Show resolved Hide resolved
@admsev

This comment was marked as spam.

@gooroodev

This comment was marked as spam.

Copy link
Contributor

@anniel-stripe anniel-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for adding support for this!

@helenye-stripe helenye-stripe enabled auto-merge (squash) May 29, 2024 17:45
@helenye-stripe helenye-stripe merged commit 654ef98 into master May 29, 2024
22 checks passed
@helenye-stripe helenye-stripe deleted the helenye-app-info-client branch May 29, 2024 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants