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
157 changes: 0 additions & 157 deletions .github/workflows/notify-issues-prs.yml

This file was deleted.

19 changes: 19 additions & 0 deletions Api/Data/Response/ErrorResponseInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ interface ErrorResponseInterface
public const CODE_INVALID_CARD = 'invalid_card';
public const CODE_DUPLICATE_REQUEST = 'duplicate_request';
public const CODE_IDEMPOTENCY_CONFLICT = 'idempotency_conflict';
public const CODE_MISSING_API_VERSION = 'missing_api_version';
public const CODE_UNSUPPORTED_API_VERSION = 'unsupported_api_version';

public const KEY_SUPPORTED_VERSIONS = 'supported_versions';

/**
* Get type
Expand Down Expand Up @@ -83,4 +87,19 @@ public function getParam(): ?string;
* @return $this
*/
public function setParam(?string $param): self;

/**
* Get the API versions this module accepts, newest first
*
* @return string[]|null
*/
public function getSupportedVersions(): ?array;

/**
* Set the API versions this module accepts, newest first
*
* @param string[]|null $supportedVersions
* @return $this
*/
public function setSupportedVersions(?array $supportedVersions): self;
}
9 changes: 5 additions & 4 deletions Model/Data/Request/CompleteCheckoutSessionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public function getPaymentData(): PaymentDataInterface
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
// Validate raw data array directly per OpenAI Agentic Checkout Spec
// allowExtraFields stays true: ACP adds optional fields between releases; ignore, never reject.
$metadata->addGetterConstraint('rawData', new Assert\Collection([
'fields' => [
'buyer' => new Assert\Optional([
Expand All @@ -91,7 +92,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
]),
'phone_number' => new Assert\Optional(),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
'payment_data' => new Assert\Required([
Expand Down Expand Up @@ -142,15 +143,15 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\Length(max: 20),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
'allowMissingFields' => false,
]));
}
Expand Down
9 changes: 5 additions & 4 deletions Model/Data/Request/CreateCheckoutSessionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function getBuyer(): ?BuyerInterface
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
// Validate raw data array directly per OpenAI Agentic Checkout Spec
// allowExtraFields stays true: ACP adds optional fields between releases; ignore, never reject.
$metadata->addGetterConstraint('rawData', new Assert\Collection([
'fields' => [
'buyer' => new Assert\Optional([
Expand All @@ -96,7 +97,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
]),
'phone_number' => new Assert\Optional(),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
'items' => new Assert\Required([
Expand All @@ -115,7 +116,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\GreaterThan(0, message: 'Quantity must be greater than 0'),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
]),
Expand Down Expand Up @@ -152,11 +153,11 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\Length(max: 20),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
'allowMissingFields' => false,
]));
}
Expand Down
7 changes: 4 additions & 3 deletions Model/Data/Request/DelegatePaymentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ public function setMetadata(array $metadata): DelegatePaymentRequestInterface
*/
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
// allowExtraFields stays true: ACP adds optional fields between releases; ignore, never reject.
$metadata->addGetterConstraint('rawData', new Assert\Collection([
'fields' => [
'payment_method' => new Assert\Required([
Expand Down Expand Up @@ -224,7 +225,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
'billing_address' => new Assert\Optional([
Expand Down Expand Up @@ -257,7 +258,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\Length(max: 20),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
'risk_signals' => new Assert\Required([
Expand All @@ -278,7 +279,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\Choice(['blocked', 'manual_review', 'authorized'], message: 'Action must be "blocked", "manual_review", or "authorized"'),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
]),
Expand Down
9 changes: 5 additions & 4 deletions Model/Data/Request/UpdateCheckoutSessionRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public function getFulfillmentOptionId(): ?string
public static function loadValidatorMetadata(ClassMetadata $metadata): void
{
// Validate raw data array directly per OpenAI Agentic Checkout Spec
// allowExtraFields stays true: ACP adds optional fields between releases; ignore, never reject.
$metadata->addGetterConstraint('rawData', new Assert\Collection([
'fields' => [
'buyer' => new Assert\Optional([
Expand All @@ -104,7 +105,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
]),
'phone_number' => new Assert\Optional(),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
'items' => new Assert\Optional([
Expand All @@ -121,7 +122,7 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\GreaterThan(0, message: 'Quantity must be greater than 0'),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
]),
Expand Down Expand Up @@ -158,12 +159,12 @@ public static function loadValidatorMetadata(ClassMetadata $metadata): void
new Assert\Length(max: 20),
]),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
]),
]),
'fulfillment_option_id' => new Assert\Optional(),
],
'allowExtraFields' => false,
'allowExtraFields' => true,
'allowMissingFields' => true,
]));
}
Expand Down
22 changes: 22 additions & 0 deletions Model/Data/Response/ErrorResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,26 @@ public function setParam(?string $param): ErrorResponseInterface
{
return $this->setData('param', $param);
}

/**
* @inheritDoc
*/
public function getSupportedVersions(): ?array
{
$data = $this->getData(ErrorResponseInterface::KEY_SUPPORTED_VERSIONS);

if (!is_array($data)) {
return null;
}

return array_values(array_filter($data, 'is_string'));
}

/**
* @inheritDoc
*/
public function setSupportedVersions(?array $supportedVersions): ErrorResponseInterface
{
return $this->setData(ErrorResponseInterface::KEY_SUPPORTED_VERSIONS, $supportedVersions);
}
}
Loading