<?php
 declare(strict_types=1); namespace Shopify\Rest\Admin2022_04; use Shopify\Auth\Session; use Shopify\Rest\Base; class Checkout extends Base { public static string $API_VERSION = "2022-04"; protected static array $HAS_ONE = [ "discount_code" => DiscountCode::class, "order" => Order::class ]; protected static array $HAS_MANY = [ "gift_cards" => GiftCard::class ]; protected static array $PATHS = [ ["http_method" => "get", "operation" => "get", "ids" => ["token"], "path" => "checkouts/<token>.json"], ["http_method" => "get", "operation" => "shipping_rates", "ids" => ["token"], "path" => "checkouts/<token>/shipping_rates.json"], ["http_method" => "post", "operation" => "complete", "ids" => ["token"], "path" => "checkouts/<token>/complete.json"], ["http_method" => "post", "operation" => "post", "ids" => [], "path" => "checkouts.json"], ["http_method" => "put", "operation" => "put", "ids" => ["token"], "path" => "checkouts/<token>.json"] ]; protected static string $PRIMARY_KEY = "token"; public static function find( Session $session, $token, array $urlIds = [], array $params = [] ): ?Checkout { $result = parent::baseFind( $session, array_merge(["token" => $token], $urlIds), $params, ); return !empty($result) ? $result[0] : null; } public static function shipping_rates( Session $session, $token, array $urlIds = [], array $params = [] ): ?array { $response = parent::request( "get", "shipping_rates", $session, array_merge(["token" => $token], $urlIds), $params, [], ); return $response->getDecodedBody(); } public function complete( array $params = [], $body = [] ): ?array { $response = parent::request( "post", "complete", $this->session, ["token" => $this->token], $params, $body, $this, ); return $response->getDecodedBody(); } } 