feat: delete cart when cannot order

This commit is contained in:
Maël Gangloff 2024-07-30 01:01:04 +02:00
parent 0a9d8ccfcf
commit 94bec57857
No known key found for this signature in database
GPG Key ID: 11FDC81C24A7F629

View File

@ -59,7 +59,10 @@ readonly class OvhConnector implements ConnectorInterface
$offer['orderable'] === true &&
$offer['pricingMode'] === $pricingMode
);
if (empty($offer)) throw new Exception('Cannot buy this domain name');
if (empty($offer)) {
$conn->delete("/order/cart/{$cartId}");
throw new Exception('Cannot buy this domain name');
}
$item = $conn->post("/order/cart/{$cartId}/domain", [
"domain" => $ldhName,