From 516c3221b644e73efab52da51f020292ff9ba644 Mon Sep 17 00:00:00 2001 From: zach wick Date: Wed, 27 Jun 2018 12:35:02 -0400 Subject: [PATCH] Adds support for 'partner_id' to 'setAppInfo' Signed-off-by: zach wick --- lib/Stripe.php | 5 +++-- tests/Stripe/ApiRequestorTest.php | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Stripe.php b/lib/Stripe.php index e363169d1..a870992a2 100644 --- a/lib/Stripe.php +++ b/lib/Stripe.php @@ -199,12 +199,13 @@ public static function getAppInfo() * @param string $appVersion The application's version * @param string $appUrl The application's URL */ - public static function setAppInfo($appName, $appVersion = null, $appUrl = null) + public static function setAppInfo($appName, $appVersion = null, $appUrl = null, $appPartnerId = null) { self::$appInfo = self::$appInfo ?: []; self::$appInfo['name'] = $appName; - self::$appInfo['version'] = $appVersion; + self::$appInfo['partner_id'] = $appPartnerId; self::$appInfo['url'] = $appUrl; + self::$appInfo['version'] = $appVersion; } /** diff --git a/tests/Stripe/ApiRequestorTest.php b/tests/Stripe/ApiRequestorTest.php index 6fb8229c5..ae79e5668 100644 --- a/tests/Stripe/ApiRequestorTest.php +++ b/tests/Stripe/ApiRequestorTest.php @@ -57,7 +57,7 @@ public function testDefaultHeaders() $method->setAccessible(true); // no way to stub static methods with PHPUnit 4.x :( - Stripe::setAppInfo('MyTestApp', '1.2.34', 'https://mytestapp.example'); + Stripe::setAppInfo('MyTestApp', '1.2.34', 'https://mytestapp.example', 'partner_1234'); $apiKey = 'sk_test_notarealkey'; $clientInfo = ['httplib' => 'testlib 0.1.2']; @@ -67,6 +67,7 @@ public function testDefaultHeaders() $this->assertSame($ua->application->name, 'MyTestApp'); $this->assertSame($ua->application->version, '1.2.34'); $this->assertSame($ua->application->url, 'https://mytestapp.example'); + $this->assertSame($ua->application->partner_id, 'partner_1234'); $this->assertSame($ua->httplib, 'testlib 0.1.2');