mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
Add get response details
This commit is contained in:
parent
b6e5a0f3ab
commit
40edcdfc3d
2 changed files with 22 additions and 9 deletions
|
@ -127,7 +127,9 @@ return array(
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
'settings.rest.pay_later_messaging' => static function ( ContainerInterface $container ) : PayLaterMessagingEndpoint {
|
'settings.rest.pay_later_messaging' => static function ( ContainerInterface $container ) : PayLaterMessagingEndpoint {
|
||||||
return new PayLaterMessagingEndpoint();
|
return new PayLaterMessagingEndpoint(
|
||||||
|
$container->get( 'wcgateway.settings' )
|
||||||
|
);
|
||||||
},
|
},
|
||||||
'settings.rest.settings' => static function ( ContainerInterface $container ) : SettingsRestEndpoint {
|
'settings.rest.settings' => static function ( ContainerInterface $container ) : SettingsRestEndpoint {
|
||||||
return new SettingsRestEndpoint(
|
return new SettingsRestEndpoint(
|
||||||
|
|
|
@ -9,6 +9,8 @@ declare( strict_types = 1 );
|
||||||
|
|
||||||
namespace WooCommerce\PayPalCommerce\Settings\Endpoint;
|
namespace WooCommerce\PayPalCommerce\Settings\Endpoint;
|
||||||
|
|
||||||
|
use WooCommerce\PayPalCommerce\PayLaterConfigurator\Factory\ConfigFactory;
|
||||||
|
use WooCommerce\PayPalCommerce\WcGateway\Settings\Settings;
|
||||||
use WP_REST_Request;
|
use WP_REST_Request;
|
||||||
use WP_REST_Response;
|
use WP_REST_Response;
|
||||||
use WP_REST_Server;
|
use WP_REST_Server;
|
||||||
|
@ -27,6 +29,22 @@ class PayLaterMessagingEndpoint extends RestEndpoint {
|
||||||
*/
|
*/
|
||||||
protected $rest_base = 'pay_later_messaging';
|
protected $rest_base = 'pay_later_messaging';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The settings.
|
||||||
|
*
|
||||||
|
* @var Settings
|
||||||
|
*/
|
||||||
|
protected $settings;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PayLaterMessagingEndpoint constructor.
|
||||||
|
*
|
||||||
|
* @param Settings $settings The settings.
|
||||||
|
*/
|
||||||
|
public function __construct( Settings $settings ) {
|
||||||
|
$this->settings = $settings;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configure REST API routes.
|
* Configure REST API routes.
|
||||||
*/
|
*/
|
||||||
|
@ -46,13 +64,6 @@ class PayLaterMessagingEndpoint extends RestEndpoint {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* POST wc/v3/wc_paypal/pay_later_messaging
|
* POST wc/v3/wc_paypal/pay_later_messaging
|
||||||
* {
|
|
||||||
* [gateway_id]: {
|
|
||||||
* enabled
|
|
||||||
* title
|
|
||||||
* description
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
*/
|
||||||
register_rest_route(
|
register_rest_route(
|
||||||
$this->namespace,
|
$this->namespace,
|
||||||
|
@ -71,7 +82,7 @@ class PayLaterMessagingEndpoint extends RestEndpoint {
|
||||||
* @return WP_REST_Response The current payment methods details.
|
* @return WP_REST_Response The current payment methods details.
|
||||||
*/
|
*/
|
||||||
public function get_details() : WP_REST_Response {
|
public function get_details() : WP_REST_Response {
|
||||||
return $this->return_success( array() );
|
return $this->return_success( ( new ConfigFactory() )->from_settings( $this->settings ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue