From bc4992f9b921e616ba3372d662747380223e7d3e Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Wed, 6 Nov 2024 19:06:36 -0500 Subject: [PATCH] chore: New feature stubbed out --- includes/class-type-registry.php | 2 + includes/class-wp-graphql-woocommerce.php | 2 + includes/mutation/class-refund-create.php | 68 +++++++++++++++++++++++ includes/mutation/class-refund-delete-php | 68 +++++++++++++++++++++++ tests/wpunit/RefundMutationsTest.php | 11 ++++ 5 files changed, 151 insertions(+) create mode 100644 includes/mutation/class-refund-create.php create mode 100644 includes/mutation/class-refund-delete-php create mode 100644 tests/wpunit/RefundMutationsTest.php diff --git a/includes/class-type-registry.php b/includes/class-type-registry.php index e7c41db8..02aff75d 100644 --- a/includes/class-type-registry.php +++ b/includes/class-type-registry.php @@ -177,6 +177,8 @@ public function init() { Mutation\Order_Update::register_mutation(); Mutation\Order_Delete::register_mutation(); Mutation\Order_Delete_Items::register_mutation(); + Mutation\Refund_Create::register_mutation(); + Mutation\Refund_Delete::register_mutation(); Mutation\Checkout::register_mutation(); Mutation\Review_Write::register_mutation(); Mutation\Review_Update::register_mutation(); diff --git a/includes/class-wp-graphql-woocommerce.php b/includes/class-wp-graphql-woocommerce.php index bc284a1b..f1feb895 100644 --- a/includes/class-wp-graphql-woocommerce.php +++ b/includes/class-wp-graphql-woocommerce.php @@ -338,6 +338,8 @@ private function includes() { require $include_directory_path . 'mutation/class-order-delete-items.php'; require $include_directory_path . 'mutation/class-order-delete.php'; require $include_directory_path . 'mutation/class-order-update.php'; + require $include_directory_path . 'mutation/class-refund-create.php'; + require $include_directory_path . 'mutation/class-refund-delete.php'; require $include_directory_path . 'mutation/class-review-write.php'; require $include_directory_path . 'mutation/class-review-delete-restore.php'; require $include_directory_path . 'mutation/class-review-update.php'; diff --git a/includes/mutation/class-refund-create.php b/includes/mutation/class-refund-create.php new file mode 100644 index 00000000..374d5fa6 --- /dev/null +++ b/includes/mutation/class-refund-create.php @@ -0,0 +1,68 @@ + self::get_input_fields(), + 'outputFields' => self::get_output_fields(), + 'mutateAndGetPayload' => self::mutate_and_get_payload(), + ] + ); + } + + /** + * Defines the mutation input field configuration + * + * @return array + */ + public static function get_input_fields() { + return []; + } + + /** + * Defines the mutation output field configuration + * + * @return array + */ + public static function get_output_fields() { + return []; + } + + /** + * Defines the mutation data modification closure. + * + * @return callable + */ + public static function mutate_and_get_payload() { + return static function ( $input, AppContext $context, ResolveInfo $info ) { + return [ 'id' => 0 ]; + }; + } +} \ No newline at end of file diff --git a/includes/mutation/class-refund-delete-php b/includes/mutation/class-refund-delete-php new file mode 100644 index 00000000..fb691448 --- /dev/null +++ b/includes/mutation/class-refund-delete-php @@ -0,0 +1,68 @@ + self::get_input_fields(), + 'outputFields' => self::get_output_fields(), + 'mutateAndGetPayload' => self::mutate_and_get_payload(), + ] + ); + } + + /** + * Defines the mutation input field configuration + * + * @return array + */ + public static function get_input_fields() { + return []; + } + + /** + * Defines the mutation output field configuration + * + * @return array + */ + public static function get_output_fields() { + return []; + } + + /** + * Defines the mutation data modification closure. + * + * @return callable + */ + public static function mutate_and_get_payload() { + return static function ( $input, AppContext $context, ResolveInfo $info ) { + return [ 'id' => 0 ]; + }; + } +} \ No newline at end of file diff --git a/tests/wpunit/RefundMutationsTest.php b/tests/wpunit/RefundMutationsTest.php new file mode 100644 index 00000000..dabb977e --- /dev/null +++ b/tests/wpunit/RefundMutationsTest.php @@ -0,0 +1,11 @@ +markTestIncomplete(); + } + + public function testDeleteRefundMutation() { + $this->markTestIncomplete(); + } +} \ No newline at end of file