Automattic\WooCommerce\StoreApi\Schemas\V1\Agentic

CheckoutSessionSchema::get_propertiespublicWC 1.0

Checkout session schema properties.

Метод класса: CheckoutSessionSchema{}

Хуков нет.

Возвращает

Массив.

Использование

$CheckoutSessionSchema = new CheckoutSessionSchema();
$CheckoutSessionSchema->get_properties();

Код CheckoutSessionSchema::get_properties() WC 10.5.0

public function get_properties() {
	return [
		'id'                    => [
			'description' => __( 'Unique identifier for the checkout session.', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
		],
		'buyer'                 => [
			'description' => __( 'Buyer information.', 'woocommerce' ),
			'type'        => [ 'object', 'null' ],
			'context'     => [ 'view', 'edit' ],
			'properties'  => [
				'first_name'   => [
					'description' => __( 'First name.', 'woocommerce' ),
					'type'        => 'string',
				],
				'last_name'    => [
					'description' => __( 'Last name.', 'woocommerce' ),
					'type'        => 'string',
				],
				'email'        => [
					'description' => __( 'Email address.', 'woocommerce' ),
					'type'        => 'string',
				],
				'phone_number' => [
					'description' => __( 'Phone number.', 'woocommerce' ),
					'type'        => 'string',
				],
			],
		],
		'payment_provider'      => [
			'description' => __( 'Payment provider information.', 'woocommerce' ),
			'type'        => [ 'object', 'null' ],
			'context'     => [ 'view', 'edit' ],
			'properties'  => [
				'provider'                  => [
					'description' => __( 'Payment provider identifier.', 'woocommerce' ),
					'type'        => 'string',
				],
				'supported_payment_methods' => [
					'description' => __( 'List of supported payment methods.', 'woocommerce' ),
					'type'        => 'array',
					'items'       => [
						'type' => 'string',
					],
				],
			],
		],
		'status'                => [
			'description' => __( 'Status of the checkout session.', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'enum'        => [
				CheckoutSessionStatus::NOT_READY_FOR_PAYMENT,
				CheckoutSessionStatus::READY_FOR_PAYMENT,
				CheckoutSessionStatus::COMPLETED,
				CheckoutSessionStatus::CANCELED,
			],
			'readonly'    => true,
		],
		'currency'              => [
			'description' => __( 'Currency code (ISO 4217).', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
		],
		'line_items'            => [
			'description' => __( 'Line items in the checkout session.', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'id'          => [
						'description' => __( 'Line item ID.', 'woocommerce' ),
						'type'        => 'string',
					],
					'item'        => [
						'description' => __( 'Product item details.', 'woocommerce' ),
						'type'        => 'object',
						'properties'  => [
							'id'       => [
								'description' => __( 'Product ID.', 'woocommerce' ),
								'type'        => 'string',
							],
							'quantity' => [
								'description' => __( 'Quantity.', 'woocommerce' ),
								'type'        => 'integer',
							],
						],
					],
					'base_amount' => [
						'description' => __( 'Base amount in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
					'discount'    => [
						'description' => __( 'Discount amount in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
					'subtotal'    => [
						'description' => __( 'Subtotal in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
					'tax'         => [
						'description' => __( 'Tax amount in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
					'total'       => [
						'description' => __( 'Total amount in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
				],
			],
		],
		'fulfillment_address'   => [
			'description' => __( 'Fulfillment/shipping address.', 'woocommerce' ),
			'type'        => [ 'object', 'null' ],
			'context'     => [ 'view', 'edit' ],
			'properties'  => [
				'name'        => [
					'description' => __( 'Full name.', 'woocommerce' ),
					'type'        => 'string',
				],
				'line_one'    => [
					'description' => __( 'Address line 1.', 'woocommerce' ),
					'type'        => 'string',
				],
				'line_two'    => [
					'description' => __( 'Address line 2.', 'woocommerce' ),
					'type'        => [ 'string', 'null' ],
				],
				'city'        => [
					'description' => __( 'City.', 'woocommerce' ),
					'type'        => 'string',
				],
				'state'       => [
					'description' => __( 'State/province.', 'woocommerce' ),
					'type'        => 'string',
				],
				'country'     => [
					'description' => __( 'Country code (ISO 3166-1 alpha-2).', 'woocommerce' ),
					'type'        => 'string',
				],
				'postal_code' => [
					'description' => __( 'Postal/ZIP code.', 'woocommerce' ),
					'type'        => 'string',
				],
			],
		],
		'fulfillment_options'   => [
			'description' => __( 'Available fulfillment options.', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'type'                   => [
						'description' => __( 'Fulfillment type.', 'woocommerce' ),
						'type'        => 'string',
						'enum'        => [ FulfillmentType::SHIPPING, FulfillmentType::DIGITAL ],
					],
					'id'                     => [
						'description' => __( 'Fulfillment option ID.', 'woocommerce' ),
						'type'        => 'string',
					],
					'title'                  => [
						'description' => __( 'Title.', 'woocommerce' ),
						'type'        => 'string',
					],
					'subtitle'               => [
						'description' => __( 'Subtitle.', 'woocommerce' ),
						'type'        => [ 'string', 'null' ],
					],
					'carrier'                => [
						'description' => __( 'Carrier name.', 'woocommerce' ),
						'type'        => [ 'string', 'null' ],
					],
					'earliest_delivery_time' => [
						'description' => __( 'Earliest delivery time (ISO 8601).', 'woocommerce' ),
						'type'        => [ 'string', 'null' ],
					],
					'latest_delivery_time'   => [
						'description' => __( 'Latest delivery time (ISO 8601).', 'woocommerce' ),
						'type'        => [ 'string', 'null' ],
					],
					'subtotal'               => [
						'description' => __( 'Subtotal in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
					'tax'                    => [
						'description' => __( 'Tax in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
					'total'                  => [
						'description' => __( 'Total in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
				],
			],
		],
		'fulfillment_option_id' => [
			'description' => __( 'Selected fulfillment option ID.', 'woocommerce' ),
			'type'        => [ 'string', 'null' ],
			'context'     => [ 'view', 'edit' ],
		],
		'totals'                => [
			'description' => __( 'Order totals breakdown.', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'type'         => [
						'description' => __( 'Total type.', 'woocommerce' ),
						'type'        => 'string',
					],
					'display_text' => [
						'description' => __( 'Display text.', 'woocommerce' ),
						'type'        => 'string',
					],
					'amount'       => [
						'description' => __( 'Amount in cents.', 'woocommerce' ),
						'type'        => 'integer',
					],
				],
			],
		],
		'messages'              => [
			'description' => __( 'Messages (info, warnings, errors).', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'type'         => [
						'description' => __( 'Message type.', 'woocommerce' ),
						'type'        => 'string',
						'enum'        => [ MessageType::INFO, MessageType::WARNING, MessageType::ERROR ],
					],
					'param'        => [
						'description' => __( 'JSON path to the related field.', 'woocommerce' ),
						'type'        => [ 'string', 'null' ],
					],
					'content_type' => [
						'description' => __( 'Content type.', 'woocommerce' ),
						'type'        => 'string',
						'enum'        => [ MessageContentType::PLAIN, MessageContentType::MARKDOWN ],
					],
					'content'      => [
						'description' => __( 'Message content.', 'woocommerce' ),
						'type'        => 'string',
					],
				],
			],
		],
		'links'                 => [
			'description' => __( 'Related links.', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'type' => [
						'description' => __( 'Link type.', 'woocommerce' ),
						'type'        => 'string',
					],
					'url'  => [
						'description' => __( 'URL.', 'woocommerce' ),
						'type'        => 'string',
					],
				],
			],
		],
	];
}