Skip to content

Commit

Permalink
Attribute name fix and update date parameter added to SubscriptionReq…
Browse files Browse the repository at this point in the history
…uest::update
  • Loading branch information
mvdgeijn committed Aug 21, 2023
1 parent e7c8649 commit 27d120c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Requests/SubscriptionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Mvdgeijn\Pax8\Requests;

use Carbon\Carbon;
use GuzzleHttp\Exception\GuzzleException;
use Mvdgeijn\Pax8\Collections\PaginatedCollection;
use Mvdgeijn\Pax8\Responses\Subscription;
Expand Down Expand Up @@ -50,14 +51,15 @@ public function get(string $subscriptionId ): ?Subscription
/**
* @param string $subscriptionId
* @param int $quantity
* @param Carbon|null $updateDate
* @return Subscription|null
* @throws GuzzleException
*/
public function update(string $subscriptionId, int $quantity ): ?Subscription
public function update(string $subscriptionId, int $quantity, ?Carbon $updateDate = null ): ?Subscription
{
$data = new \stdClass();
$data->quantity = $quantity;
$data->startdate = date("Y-m-d");
$data->startDate = $updateDate->toDateString() ?: date("Y-m-d");
$data->billingTerm = "Monthly";

$response = $this->putRequest('/v1/subscriptions/' . $subscriptionId, $data );
Expand Down

0 comments on commit 27d120c

Please sign in to comment.