File tree Expand file tree Collapse file tree
PHPUnit/OrderEndpoints/Endpoint
integration/PHPUnit/Button/Endpoint Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1111
1212use WooCommerce \PayPalCommerce \Assets \AssetGetter ;
1313use WooCommerce \PayPalCommerce \Assets \AssetGetterFactory ;
14- use WooCommerce \PayPalCommerce \Blocks \Endpoint \UpdateShippingEndpoint ;
14+ use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \UpdateShippingEndpoint ;
1515use WooCommerce \PayPalCommerce \Settings \Data \SettingsProvider ;
1616use WooCommerce \PayPalCommerce \Vendor \Psr \Container \ContainerInterface ;
1717use WooCommerce \PayPalCommerce \Button \Assets \SmartButtonInterface ;
@@ -67,13 +67,7 @@ function () use ( $container ): SmartButtonInterface {
6767 },
6868
6969 'blocks.endpoint.update-shipping ' => static function ( ContainerInterface $ container ): UpdateShippingEndpoint {
70- return new UpdateShippingEndpoint (
71- $ container ->get ( 'button.request-data ' ),
72- $ container ->get ( 'api.endpoint.order ' ),
73- $ container ->get ( 'api.factory.purchase-unit ' ),
74- $ container ->get ( 'session.handler ' ),
75- $ container ->get ( 'woocommerce.logger.woocommerce ' )
76- );
70+ return $ container ->get ( 'order-endpoints.endpoint.update-shipping ' );
7771 },
7872
7973 'blocks.add-place-order-method ' => function ( ContainerInterface $ container ): bool {
Original file line number Diff line number Diff line change 1111
1212use Automattic \WooCommerce \Blocks \Payments \PaymentMethodRegistry ;
1313use WooCommerce \PayPalCommerce \Assets \AssetGetter ;
14- use WooCommerce \PayPalCommerce \Blocks \Endpoint \UpdateShippingEndpoint ;
1514use WooCommerce \PayPalCommerce \Button \Assets \SmartButtonInterface ;
1615use WooCommerce \PayPalCommerce \Vendor \Inpsyde \Modularity \Module \ExecutableModule ;
1716use WooCommerce \PayPalCommerce \Vendor \Inpsyde \Modularity \Module \ExtendingModule ;
@@ -88,16 +87,6 @@ function ( PaymentMethodRegistry $payment_method_registry ) use ( $c ): void {
8887 )
8988 );
9089
91- add_action (
92- 'wc_ajax_ ' . UpdateShippingEndpoint::ENDPOINT ,
93- static function () use ( $ c ) {
94- $ endpoint = $ c ->get ( 'blocks.endpoint.update-shipping ' );
95- assert ( $ endpoint instanceof UpdateShippingEndpoint );
96-
97- $ endpoint ->handle_request ();
98- }
99- );
100-
10190 // Enqueue frontend scripts.
10291 add_action (
10392 'wp_enqueue_scripts ' ,
Original file line number Diff line number Diff line change 1212use Automattic \WooCommerce \Blocks \Payments \Integrations \AbstractPaymentMethodType ;
1313use WC_AJAX ;
1414use WooCommerce \PayPalCommerce \Assets \AssetGetter ;
15- use WooCommerce \PayPalCommerce \Blocks \Endpoint \UpdateShippingEndpoint ;
15+ use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \UpdateShippingEndpoint ;
1616use WooCommerce \PayPalCommerce \Button \Assets \SmartButtonInterface ;
1717use WooCommerce \PayPalCommerce \Session \Cancellation \CancelController ;
1818use WooCommerce \PayPalCommerce \Session \Cancellation \CancelView ;
Original file line number Diff line number Diff line change 2323use WooCommerce \PayPalCommerce \ApiClient \Helper \DccApplies ;
2424use WooCommerce \PayPalCommerce \ApiClient \Helper \PartnerAttribution ;
2525use WooCommerce \PayPalCommerce \Assets \AssetGetter ;
26- use WooCommerce \PayPalCommerce \Blocks \Endpoint \UpdateShippingEndpoint ;
26+ use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \UpdateShippingEndpoint ;
2727use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \ApproveOrderEndpoint ;
2828use WooCommerce \PayPalCommerce \Button \Endpoint \ApproveSubscriptionEndpoint ;
2929use WooCommerce \PayPalCommerce \Button \Endpoint \CartScriptParamsEndpoint ;
Original file line number Diff line number Diff line change 1414use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \ChangeCartEndpoint ;
1515use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \CreateOrderEndpoint ;
1616use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \RequestData ;
17+ use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \UpdateShippingEndpoint ;
1718use WooCommerce \PayPalCommerce \OrderEndpoints \Helper \CartProductsHelper ;
1819use WooCommerce \PayPalCommerce \OrderEndpoints \Helper \EarlyOrderHandler ;
1920use WooCommerce \PayPalCommerce \OrderEndpoints \Helper \WooCommerceOrderCreator ;
100101 $ context
101102 );
102103 },
104+ 'order-endpoints.endpoint.update-shipping ' => static function ( ContainerInterface $ container ): UpdateShippingEndpoint {
105+ return new UpdateShippingEndpoint (
106+ $ container ->get ( 'order-endpoints.request-data ' ),
107+ $ container ->get ( 'api.endpoint.order ' ),
108+ $ container ->get ( 'api.factory.purchase-unit ' ),
109+ $ container ->get ( 'session.handler ' ),
110+ $ container ->get ( 'woocommerce.logger.woocommerce ' )
111+ );
112+ },
103113 'order-endpoints.is-logged-in ' => static function ( ContainerInterface $ container ): bool {
104114 return is_user_logged_in ();
105115 },
Original file line number Diff line number Diff line change 22/**
33 * Updates PayPal order with the current shipping methods.
44 *
5- * @package WooCommerce\PayPalCommerce\Button \Endpoint
5+ * @package WooCommerce\PayPalCommerce\OrderEndpoints \Endpoint
66 */
77
88declare (strict_types=1 );
99
10- namespace WooCommerce \PayPalCommerce \Blocks \Endpoint ;
10+ namespace WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint ;
1111
1212use Exception ;
1313use Psr \Log \LoggerInterface ;
1717use WooCommerce \PayPalCommerce \ApiClient \Entity \PatchCollection ;
1818use WooCommerce \PayPalCommerce \ApiClient \Factory \PurchaseUnitFactory ;
1919use WooCommerce \PayPalCommerce \Button \Endpoint \EndpointInterface ;
20- use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \RequestData ;
2120use WooCommerce \PayPalCommerce \Button \Exception \NonceValidationException ;
2221use WooCommerce \PayPalCommerce \Session \SessionHandler ;
2322
Original file line number Diff line number Diff line change 1515use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \ApproveOrderEndpoint ;
1616use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \ChangeCartEndpoint ;
1717use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \CreateOrderEndpoint ;
18+ use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \UpdateShippingEndpoint ;
1819use WooCommerce \PayPalCommerce \Vendor \Inpsyde \Modularity \Module \ExecutableModule ;
1920use WooCommerce \PayPalCommerce \Vendor \Inpsyde \Modularity \Module \ModuleClassNameIdTrait ;
2021use WooCommerce \PayPalCommerce \Vendor \Inpsyde \Modularity \Module \ServiceModule ;
@@ -76,6 +77,16 @@ static function () use ( $c ) {
7677 }
7778 );
7879
80+ add_action (
81+ 'wc_ajax_ ' . UpdateShippingEndpoint::ENDPOINT ,
82+ static function () use ( $ c ) {
83+ $ endpoint = $ c ->get ( 'order-endpoints.endpoint.update-shipping ' );
84+ assert ( $ endpoint instanceof UpdateShippingEndpoint );
85+
86+ $ endpoint ->handle_request ();
87+ }
88+ );
89+
7990 return true ;
8091 }
8192}
Original file line number Diff line number Diff line change 1010namespace WooCommerce \PayPalCommerce \SdkV6 \Assets ;
1111
1212use WooCommerce \PayPalCommerce \Assets \AssetGetter ;
13- use WooCommerce \PayPalCommerce \Blocks \Endpoint \UpdateShippingEndpoint ;
13+ use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \UpdateShippingEndpoint ;
1414use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \ApproveOrderEndpoint ;
1515use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \ChangeCartEndpoint ;
1616use WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint \CreateOrderEndpoint ;
Original file line number Diff line number Diff line change 22
33declare (strict_types=1 );
44
5- namespace WooCommerce \PayPalCommerce \Blocks \Endpoint ;
5+ namespace WooCommerce \PayPalCommerce \OrderEndpoints \Endpoint ;
66
77use Mockery ;
88use Mockery \Adapter \Phpunit \MockeryPHPUnitIntegration ;
1717use function Brain \Monkey \Functions \expect ;
1818
1919/**
20- * @covers \WooCommerce\PayPalCommerce\Blocks \Endpoint\UpdateShippingEndpoint
20+ * @covers \WooCommerce\PayPalCommerce\OrderEndpoints \Endpoint\UpdateShippingEndpoint
2121 */
2222class UpdateShippingEndpointTest extends TestCase
2323{
Original file line number Diff line number Diff line change 1212 * Contract tests for the ppc-update-shipping WC-AJAX endpoint, shared by the
1313 * v5 and v6 SDK frontends.
1414 *
15- * @covers \WooCommerce\PayPalCommerce\Blocks \Endpoint\UpdateShippingEndpoint
15+ * @covers \WooCommerce\PayPalCommerce\OrderEndpoints \Endpoint\UpdateShippingEndpoint
1616 */
1717class UpdateShippingEndpointContractTest extends WcAjaxEndpointTestCase {
1818
You can’t perform that action at this time.
0 commit comments