diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6429212..ecf21a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,7 +7,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: PHP Composer uses: php-actions/composer@v6 - name: Tests diff --git a/lib/Shift4/Shift4Gateway.php b/lib/Shift4/Shift4Gateway.php index 9acf651..f6dfb70 100644 --- a/lib/Shift4/Shift4Gateway.php +++ b/lib/Shift4/Shift4Gateway.php @@ -10,7 +10,7 @@ class Shift4Gateway { - const VERSION = '3.3.0'; + const VERSION = '4.0.0'; const DEFAULT_ENDPOINT = 'https://api.shift4.com'; const DEFAULT_UPLOADS_ENDPOINT = "https://uploads.api.shift4.com/"; @@ -227,17 +227,16 @@ public function listPaymentMethods($request) */ public function createSubscription($request, RequestOptions $requestOptions = null) { - return $this->post('/customers/{customerId}/subscriptions', $request, '\Shift4\Response\Subscription', $requestOptions); + return $this->post('/subscriptions', $request, '\Shift4\Response\Subscription', $requestOptions); } /** - * @param string $customerId * @param string $subscriptionId * @return \Shift4\Response\Subscription */ - public function retrieveSubscription($customerId, $subscriptionId) + public function retrieveSubscription($subscriptionId) { - return $this->get("/customers/{$customerId}/subscriptions/{$subscriptionId}", '\Shift4\Response\Subscription'); + return $this->get("/subscriptions/{$subscriptionId}", '\Shift4\Response\Subscription'); } /** @@ -246,7 +245,7 @@ public function retrieveSubscription($customerId, $subscriptionId) */ public function updateSubscription($request, RequestOptions $requestOptions = null) { - return $this->post('/customers/{customerId}/subscriptions/{subscriptionId}', $request, '\Shift4\Response\Subscription', $requestOptions); + return $this->post('/subscriptions/{subscriptionId}', $request, '\Shift4\Response\Subscription', $requestOptions); } /** @@ -255,7 +254,7 @@ public function updateSubscription($request, RequestOptions $requestOptions = nu */ public function cancelSubscription($request) { - return $this->delete('/customers/{customerId}/subscriptions/{subscriptionId}', $request, '\Shift4\Response\Subscription'); + return $this->delete('/subscriptions/{subscriptionId}', $request, '\Shift4\Response\Subscription'); } /** @@ -264,7 +263,7 @@ public function cancelSubscription($request) */ public function listSubscriptions($request) { - return $this->getList('/customers/{customerId}/subscriptions', $request, '\Shift4\Response\Subscription'); + return $this->getList('/subscriptions', $request, '\Shift4\Response\Subscription'); } /** diff --git a/tests/SubscriptionTest.php b/tests/SubscriptionTest.php index a202a8a..9f2c540 100644 --- a/tests/SubscriptionTest.php +++ b/tests/SubscriptionTest.php @@ -34,7 +34,7 @@ function testRetrieveSubscription() $subscription = $this->gateway->createSubscription($request); // when - $subscription = $this->gateway->retrieveSubscription($subscription->getCustomerId(), $subscription->getId()); + $subscription = $this->gateway->retrieveSubscription($subscription->getId()); // then Assert::assertSubscription($request, $subscription); diff --git a/tests/utils/Assert.php b/tests/utils/Assert.php index 92723ec..21c2b28 100644 --- a/tests/utils/Assert.php +++ b/tests/utils/Assert.php @@ -228,7 +228,7 @@ public static function assertValidCheckoutRequest($signedCheckoutRequest) $error = substr($error, 0, strpos($error, "\">") + 1); self::assertFalse($hasError, "Error for checkout url $checkoutUrl: $error"); - $hasInput = (strpos($checkoutPage, '