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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ psalm.xml
vendor
.php-cs-fixer.cache

.claude/
8 changes: 4 additions & 4 deletions src/API/Endpoints/OrderEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,16 @@ public function page(
}

/**
* Create a signed URL where the customer can update the invoice details for this order
* (billing address, VAT number, company name).
* Request a signed URL where the customer can update their billing address for this order
* (VAT number, company name, address). Valid for a limited time (typically 24 hours).
*
* @throws ApiException
*/
public function createInvoiceUpdateLink(string $id, array $data = []): Link
public function requestAddressUpdateLink(string $id, array $data = []): Link
{
$this->validateOrderId($id);

$resource = "{$this->getResourcePath()}/" . urlencode($id) . "/invoice-update-link";
$resource = "{$this->getResourcePath()}/" . urlencode($id) . "/request-address-update-link";

$body = null;
if (count($data) > 0) {
Expand Down
6 changes: 3 additions & 3 deletions src/API/Endpoints/SubscriptionEndpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ public function update(string $subscriptionId, array $data = [], array $filters
* @return Link Redirect the customer to this URL to let them update their billing details.
* @throws ApiException
*/
public function createBillingUpdateLink(string $subscriptionId, array $data = []): Link
public function updateBilling(string $subscriptionId, array $data = []): Link
{
$this->validateSubscriptionId($subscriptionId);

$resource = "{$this->getResourcePath()}/" . urlencode($subscriptionId) . "/billing-update-link";
$resource = "{$this->getResourcePath()}/" . urlencode($subscriptionId) . "/update-billing";

$body = null;
if (count($data) > 0) {
$body = json_encode($data);
}

$result = $this->client->performHttpCall(self::REST_CREATE, $resource, $body);
$result = $this->client->performHttpCall(self::REST_UPDATE, $resource, $body);

return new Link($result->href, $result->type);
}
Expand Down
10 changes: 0 additions & 10 deletions src/API/Resources/Links/OrderLineLinks.php

This file was deleted.

4 changes: 2 additions & 2 deletions src/API/Resources/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ public function fullRefund(array $data)
return $this->apiClient->orderRefunds->createFullRefundForOrderId($this->id, $data);
}

public function createInvoiceUpdateLink(array $data = []): Link
public function requestAddressUpdateLink(array $data = []): Link
{
return $this->apiClient->orders->createInvoiceUpdateLink($this->id, $data);
return $this->apiClient->orders->requestAddressUpdateLink($this->id, $data);
}
}
4 changes: 0 additions & 4 deletions src/API/Resources/OrderLine.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Vatly\API\Resources;

use Vatly\API\Resources\Links\OrderLineLinks;
use Vatly\API\Types\Money;
use Vatly\API\Types\TaxSummaryCollection;

Expand All @@ -29,10 +28,7 @@ class OrderLine extends BaseResource

public Money $total;


public Money $subtotal;

public TaxSummaryCollection $taxes;

public OrderLineLinks $links;
}
4 changes: 2 additions & 2 deletions src/API/Resources/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ public function update(array $data = []): BaseResource
* @return Link Redirect the customer to this URL to let them update their billing details.
* @throws ApiException
*/
public function createBillingUpdateLink(array $data = []): Link
public function updateBilling(array $data = []): Link
{
return $this->apiClient->subscriptions->createBillingUpdateLink($this->id, $data);
return $this->apiClient->subscriptions->updateBilling($this->id, $data);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions tests/Endpoints/OrderEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ public function can_get_previous_page(): void
}

/** @test */
public function can_create_invoice_update_link(): void
public function can_request_address_update_link(): void
{
$orderId = 'order_dummy_id';
$responseBodyArray = [
Expand All @@ -277,11 +277,11 @@ public function can_create_invoice_update_link(): void

$this->httpClient->setSendReturnObjectFromArray($responseBodyArray);

$response = $this->client->orders->createInvoiceUpdateLink($orderId, []);
$response = $this->client->orders->requestAddressUpdateLink($orderId, []);

$this->assertWasSentOnly(
VatlyApiClient::HTTP_POST,
self::API_ENDPOINT_URL.'/orders/'.$orderId.'/invoice-update-link',
self::API_ENDPOINT_URL.'/orders/'.$orderId.'/request-address-update-link',
[],
null
);
Expand Down
6 changes: 3 additions & 3 deletions tests/Endpoints/SubscriptionEndpointTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,11 @@ public function can_update_billing_details()
'fullName' => 'John Doe',
'city' => 'New York',
];
$response = $subscription->createBillingUpdateLink($updatedBilling);
$response = $subscription->updateBilling($updatedBilling);

$this->assertWasSentOnly(
VatlyApiClient::HTTP_POST,
self::API_ENDPOINT_URL.'/subscriptions/subscription_123/billing-update-link',
VatlyApiClient::HTTP_PATCH,
self::API_ENDPOINT_URL.'/subscriptions/subscription_123/update-billing',
[],
json_encode($updatedBilling)
);
Expand Down