Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 7 additions & 8 deletions lib/Shift4/Shift4Gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/";

Expand Down Expand Up @@ -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');
}

/**
Expand All @@ -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);
}

/**
Expand All @@ -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');
}

/**
Expand All @@ -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');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/SubscriptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion tests/utils/Assert.php
Original file line number Diff line number Diff line change
Expand Up @@ -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, '<input') !== false);
$hasInput = (strpos($checkoutPage, 'Shift4Checkout.open(') !== false);
self::assertTrue($hasInput);
}

Expand Down