/** * The API for operations with orders. * * @package WooCommerce\PayPalCommerce\Api * * @phpcs:disable Squiz.Commenting.FunctionCommentThrowTag */ declare (strict_types=1); namespace WooCommerce\PayPalCommerce\Api; use Exception; use InvalidArgumentException; use RuntimeException; use WC_Order; use WooCommerce\PayPalCommerce\ApiClient\Endpoint\OrderEndpoint; use WooCommerce\PayPalCommerce\ApiClient\Entity\Order; use WooCommerce\PayPalCommerce\PPCP; use WooCommerce\PayPalCommerce\WcGateway\Gateway\PayPalGateway; use WooCommerce\PayPalCommerce\WcGateway\Helper\RefundFeesUpdater; use WooCommerce\PayPalCommerce\WcGateway\Processor\AuthorizedPaymentsProcessor; use WooCommerce\PayPalCommerce\WcGateway\Processor\OrderProcessor; use WooCommerce\PayPalCommerce\WcGateway\Processor\RefundProcessor; /** * Returns the PayPal order. * * @param string|WC_Order $paypal_id_or_wc_order The ID of PayPal order or a WC order (with the ID in meta). * @throws InvalidArgumentException When the argument cannot be used for retrieving the order. * @throws Exception When the operation fails. */ function ppcp_get_paypal_order($paypal_id_or_wc_order): Order { if ($paypal_id_or_wc_order instanceof WC_Order) { $paypal_id_or_wc_order = $paypal_id_or_wc_order->get_meta(PayPalGateway::ORDER_ID_META_KEY); if (!$paypal_id_or_wc_order) { throw new InvalidArgumentException('PayPal order ID not found in meta.'); } } if (!is_string($paypal_id_or_wc_order)) { throw new InvalidArgumentException('Invalid PayPal order ID, string expected.'); } $order_endpoint = PPCP::container()->get('api.endpoint.order'); assert($order_endpoint instanceof OrderEndpoint); return $order_endpoint->order($paypal_id_or_wc_order); } /** * Creates a PayPal order for the given WC order. * * @param WC_Order $wc_order The WC order. * @throws Exception When the operation fails. */ function ppcp_create_paypal_order_for_wc_order(WC_Order $wc_order): Order { $order_processor = PPCP::container()->get('wcgateway.order-processor'); assert($order_processor instanceof OrderProcessor); return $order_processor->create_order($wc_order); } /** * Captures the PayPal order. * * @param WC_Order $wc_order The WC order. * @throws InvalidArgumentException When the order cannot be captured. * @throws Exception When the operation fails. */ function ppcp_capture_order(WC_Order $wc_order): void { $intent = strtoupper((string) $wc_order->get_meta(PayPalGateway::INTENT_META_KEY)); if ($intent !== 'AUTHORIZE') { throw new InvalidArgumentException('Only orders with "authorize" intent can be captured.'); } $captured = wc_string_to_bool($wc_order->get_meta(AuthorizedPaymentsProcessor::CAPTURED_META_KEY)); if ($captured) { throw new InvalidArgumentException('The order is already captured.'); } $authorized_payment_processor = PPCP::container()->get('wcgateway.processor.authorized-payments'); assert($authorized_payment_processor instanceof AuthorizedPaymentsProcessor); if (!$authorized_payment_processor->capture_authorized_payment($wc_order)) { throw new RuntimeException('Capture failed.'); } } /** * Reauthorizes the PayPal order. * * @param WC_Order $wc_order The WC order. * @throws InvalidArgumentException When the order cannot be captured. * @throws Exception When the operation fails. */ function ppcp_reauthorize_order(WC_Order $wc_order): void { $intent = strtoupper((string) $wc_order->get_meta(PayPalGateway::INTENT_META_KEY)); if ($intent !== 'AUTHORIZE') { throw new InvalidArgumentException('Only orders with "authorize" intent can be reauthorized.'); } $captured = wc_string_to_bool($wc_order->get_meta(AuthorizedPaymentsProcessor::CAPTURED_META_KEY)); if ($captured) { throw new InvalidArgumentException('The order is already captured.'); } $authorized_payment_processor = PPCP::container()->get('wcgateway.processor.authorized-payments'); assert($authorized_payment_processor instanceof AuthorizedPaymentsProcessor); if ($authorized_payment_processor->reauthorize_payment($wc_order) !== AuthorizedPaymentsProcessor::SUCCESSFUL) { throw new RuntimeException($authorized_payment_processor->reauthorization_failure_reason() ?: 'Reauthorization failed.'); } } /** * Refunds the PayPal order. * Note that you can use wc_refund_payment() to trigger the refund in WC and PayPal. * * @param WC_Order $wc_order The WC order. * @param float $amount The refund amount. * @param string $reason The reason for the refund. * @return string The PayPal refund ID. * @throws InvalidArgumentException When the order cannot be refunded. * @throws Exception When the operation fails. */ function ppcp_refund_order(WC_Order $wc_order, float $amount, string $reason = ''): string { $order = ppcp_get_paypal_order($wc_order); $refund_processor = PPCP::container()->get('wcgateway.processor.refunds'); assert($refund_processor instanceof RefundProcessor); return $refund_processor->refund($order, $wc_order, $amount, $reason); } /** * Voids the authorization. * * @param WC_Order $wc_order The WC order. * @throws InvalidArgumentException When the order cannot be voided. * @throws Exception When the operation fails. */ function ppcp_void_order(WC_Order $wc_order): void { $order = ppcp_get_paypal_order($wc_order); $refund_processor = PPCP::container()->get('wcgateway.processor.refunds'); assert($refund_processor instanceof RefundProcessor); $refund_processor->void($order); } /** * Updates the PayPal refund fees totals on an order. * * @param WC_Order $wc_order The WC order. */ function ppcp_update_order_refund_fees(WC_Order $wc_order): void { $updater = PPCP::container()->get('wcgateway.helper.refund-fees-updater'); assert($updater instanceof RefundFeesUpdater); $updater->update($wc_order); } {"id":7121,"date":"2025-07-26T00:26:29","date_gmt":"2025-07-26T00:26:29","guid":{"rendered":"https:\/\/hostamy.com\/?p=7121"},"modified":"2025-07-26T00:26:29","modified_gmt":"2025-07-26T00:26:29","slug":"ports-of-las-vega-immediate-play-a-convenient-method-to-delight-in-casino-site-games","status":"publish","type":"post","link":"https:\/\/hostamy.com\/en_gb\/ports-of-las-vega-immediate-play-a-convenient-method-to-delight-in-casino-site-games\/","title":{"rendered":"Ports of Las Vega Immediate Play: A Convenient Method to Delight In Casino Site Games"},"content":{"rendered":"
If you’re a fan of casino video games and delight in the adventure of playing slots, you’ll like the ease of https:\/\/www.playonlineroulette.net\/<\/a> Slots of Vegas Instant Play. This on the internet casino system offers a wide variety of slot video games that you can play quickly, without the requirement to download and install any software application. Whether you’re an experienced player or new to the globe of on the internet gambling, Slots of Vegas Immediate Play offers an easy to use and entertaining experience for all.<\/p>\n Slots of Las Vega Instant Play is powered by Realtime Pc gaming (RTG), a widely known and reputable software program carrier in the on the internet gambling establishment industry. RTG is understood for its top quality graphics, involving gameplay, and reasonable video gaming practices. With their considerable collection of slot video games, you’ll have plenty of choices to select from, making certain that there’s something for everybody.<\/p>\n Instantaneous play casinos, like Ports of Las vega, provide numerous advantages over downloadable online casinos. Right here are some of the crucial advantages:<\/p>\n Ports of Vegas Split second Play flaunts an impressive collection of port games, accommodating players of all choices. Whether you take pleasure in timeless three-reel slots, contemporary video slots, or progressive reward video games, you’ll find them all at Slots of Vegas. With over 200 various port titles to select from, you’ll never ever lack choices.<\/p>\n Each slot video game at Ports of Las vega Instant Play offers special motifs, sensational visuals, and interesting incentive features. From ancient human beings and mythology to sports and experience, there’s a port video game to match every taste. You can explore different globes and immerse yourself in exciting stories as you rotate the reels.<\/p>\n In addition to the wide range of slot games, Ports of Las vega Immediate Play also supplies various other popular casino site games, consisting of blackjack, live roulette, casino poker, and much more. The varied choice guarantees that there’s something for every type of casino site fanatic.<\/p>\n When it concerns on-line gaming, safety is of utmost significance. Slots of Vegas Immediate Play prioritizes the security and security of its players. The system uses state-of-the-art file encryption modern technology to make sure that all purchases and personal info are safeguarded.<\/p>\n Furthermore, the video games at Slots of Vegas Instant Play are on a regular basis examined for justness by independent third-party companies. This guarantees that the end results of the video games are truly arbitrary and not influenced by any exterior variables. You can have peace of mind knowing that you’re playing in a reasonable and credible gaming atmosphere.<\/p>\n Ports of Las vega Immediate Play supplies a practical and enjoyable means to experience the adventure of online casino video games. With its vast choice of slot video games, easy to use user interface, and first-class security procedures, it’s the best platform for both laid-back gamers and seasoned casino players. Whether you’re trying https:\/\/gozabetpe.top\/<\/a> to find excitement, entertainment, or the chance to win huge, Ports of Vegas Split Second Play has it all.<\/p>\n So why wait? Check Out Ports of Vegas Immediate Play today and embark on a thrilling online casino adventure from the comfort of your very own home.<\/p>","protected":false},"excerpt":{"rendered":" If you’re a fan of casino video games and delight in the adventure of playing slots, you’ll like the ease of https:\/\/www.playonlineroulette.net\/ Slots of Vegas Instant Play. This on the internet casino system offers a wide variety of slot video games that you can play quickly, without the requirement<\/p>","protected":false},"author":23,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pmpro_default_level":"","footnotes":""},"categories":[1],"tags":[],"class_list":["post-7121","post","type-post","status-publish","format-standard","hentry","category-uncategorized","pmpro-has-access"],"yoast_head":"\nThe Benefits of Instantaneous Play<\/h2>\n
\n
A Wide Option of Slot Games<\/h2>\n
Safe and Safeguard Pc Gaming Environment<\/h2>\n
Verdict<\/h3>\n