/** * 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":7401,"date":"2025-08-27T11:01:26","date_gmt":"2025-08-27T11:01:26","guid":{"rendered":"https:\/\/hostamy.com\/?p=7401"},"modified":"2025-08-27T11:04:38","modified_gmt":"2025-08-27T11:04:38","slug":"futbol-olami-haqiqiy-dostonlar-va-yangi","status":"publish","type":"post","link":"https:\/\/hostamy.com\/en_gb\/futbol-olami-haqiqiy-dostonlar-va-yangi\/","title":{"rendered":"Futbol Olami: Haqiqiy Dostonlar va Yangi Chempionlar Yaratilish Joyi"},"content":{"rendered":"
Futbol Olami: Haqiqiy Dostonlar va Yangi Chempionlar Yaratilish Joyi<\/p>\n
Futbol, bu nafaqat sport turi, balki umumbashariy tuyg\u2018ularni birlashtiradigan global bir fenomen. Har bir o\u2018yinda futbolchilar va muhlislar orasida qandaydir sirli aloqa o\u2018rnatiladi. Ushbu sirli aloqalar, o\u2018nlab yillardan beri davom etib kelayotgan dostonlarga aylanib, butun dunyo bo\u2018ylab millionlab insonlar uchun hayotning bir qismi bo\u2018lib qolgan. Shuning uchun ham futbolni oddiy sport turi deb atash unchalik ham to\u2018g\u2018ri emas. U ehtiros, fidoyilik va intilishlar maskani, haqiqiy insoniy dostonlar yaratiladigan joydir.<\/p>\n
Futbolning har bir qirrasida biz insoniy hayotning bir ko\u2018rinishini ko\u2018ramiz. Har bir jang, har bir oyog\u2018ida yugurish, har bir to\u2018liq sevinch bilan tomoshabinlar qalbiga yetib boradi. Futboldagi ana shunday haqiqiy dostonlar orqali ko\u2018plab insonlar o\u2018zlarining kundalik qiyinchiliklarini unutar, muhlislar qamariga qo\u2018shilib, hayotidan rohat olishi mumkin. Futbolning hayajonli dunyosida, eng yangi chempionlar yaratilishi va muvaffaqiyat hikoyalari bilan tanishuv mostbet<\/a> platformasida oson va qiziqarli bo\u2018lishi mumkin.<\/p>\n Har bir futbol yulduzi o\u2018z harakatlari bilan ilmiy kashfiyotchilar, san’atkorlar yoki yozuvchilar singari jahonni zabt etishga qodir sanaladi. Yangi chempionlar \u2014 bu futbol olamidagi eng qiyin sharoitlarni yengib o\u2018tgan chempionlardir. Ular o\u2018z haqiqatga intilishlari bilan tomoshabinlarni o\u2018zlariga qaratishadi. Ularning har bir harakati, qismati va yutuqlari ushbu sport turi uchun yangi sahifalarni ochib beradi. Futbolning buyuk sahnasida bu yangi chempionlarning yildiz kitobida qanday specific yutuqlar qalamga olinishi kutulmoqda.<\/p>\n Nima uchun har bir o\u2018yinchi bu sahnaga intiladi? Ertangi kunda g\u2018alaba qozonish, katta sahnada yulduz bo\u2018lish \u2014 bu har bir futbol o\u2018yinchisi uchun eng oliy orzu. Ularning kuchli ishtiyoq va iymonlari orqali esa futbol olamiga yangi kuch va yo\u2018nalishlar olib kelinib, jahon maydonidagi o\u2018rinni zabt etishga intilganlari ko\u2018zga tashlanadi. Ushbu yutuqlar orqali ular nafaqat o\u2018z davlatlarining, balki butun dunyoning iftixoriga aylanishadi.<\/p>\n Futboldagi har bir engillashtirish va harakatsizlik dunyo o\u2018yinchilari va muhlislarining fantastik sahnalaridagi hayajonli tuyg\u2018ular, hislar va o\u2018ziga xos kreativlikni keltirib chiqaradi. Futbol birgalikda jamoaviy harakatni, sheriklik va birlikni o\u2018rgatadi. Futbolni anglashga intilganlar uchun bu o\u2018z-o\u2018zini va ko\u2018pchilikni motivatsiyalash sahnasidir.<\/p>\n Futbol olamidagi har bir ikon, o\u2018zining ehtiroslari va mehnatlari bilan misli ko\u2018rilmagan muvaffaqiyatlarga erishdi. Endi bu tajribalarni ularga ergashayotgan yangi avlod o\u2018yinchilariga yetkazish muhim. Shunday qilib, yangi avlodlar ham futbol maydonida muvaffaqiyatga erishib, o\u2018z tarixlarini yaratadilar.<\/p>\n Pontevedra Naturals sayti futbol ishqibozlari uchun noyob manba hisoblanadi. Ushbu sayt orqali futbol olamidagi yangi yo\u2018nalishlar, so\u2018nggi yangiliklar va yulduzlarning intervyulari bilan yangilanishingiz mumkin. Pontevedra Naturals orqali har bir futbol muhlisi aql bovar qilmas hikoyalar va mag\u2018lubiyatlarni kuzatish imkoniyatiga ega bo\u2018ladi.<\/p>\n Sizni eng qiziqarli va hayajonli yangiliklar kutmoqda. Pontevedra Naturals \u2014 bu futbolni anglash va o\u2018rganish uchun eng qulay joydir. Barcha fanatlar, mutaxassislar va yangi kelayotgan sportchilar uchun fantastik portal bo\u2018lgan ushbu sayt orqali futbol olamidagi eng dolzarb voqealarni kuzatib borishingiz mumkin.<\/p>","protected":false},"excerpt":{"rendered":" Futbol Olami: Haqiqiy Dostonlar va Yangi Chempionlar Yaratilish Joyi Futbol Olami: Yurakni Titratadigan Dostonlar Futbol, bu nafaqat sport turi, balki umumbashariy tuyg\u2018ularni birlashtiradigan global bir fenomen. Har bir o\u2018yinda futbolchilar va muhlislar orasida qandaydir sirli aloqa o\u2018rnatiladi. Ushbu sirli aloqalar, o\u2018nlab yillardan beri davom etib kelayotgan dostonlarga aylanib, butun dunyo bo\u2018ylab millionlab insonlar uchun hayotning […]<\/p>","protected":false},"author":23,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"pmpro_default_level":"","footnotes":""},"categories":[211],"tags":[],"class_list":["post-7401","post","type-post","status-publish","format-standard","hentry","category-pablic","pmpro-has-access"],"yoast_head":"\nYangi Chempionlar Yildirak Machinasining Asosiy Qurilmalari<\/h3>\n
Futbol Olami: Hayajon, Harakat va Motivatsiya Vazni<\/h3>\n
Pontevedra Naturals: Futbol Olamida Yangi Yo’nalish<\/h3>\n