-
-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
151 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* Mutation - createRefund | ||
* | ||
* Registers mutation for creating a refund on an order. | ||
* | ||
* @package WPGraphQL\WooCommerce\Mutation | ||
* @since TDB | ||
*/ | ||
|
||
namespace WPGraphQL\WooCommerce\Mutation; | ||
|
||
use GraphQL\Error\UserError; | ||
use GraphQL\Type\Definition\ResolveInfo; | ||
use WC_Order_Factory; | ||
use WPGraphQL\AppContext; | ||
use WPGraphQL\WooCommerce\Data\Mutation\Order_Mutation; | ||
use WPGraphQL\WooCommerce\Model\Order; | ||
|
||
/** | ||
* Class Refund_Create | ||
*/ | ||
class Refund_Create { | ||
/** | ||
* Registers mutation | ||
* | ||
* @return void | ||
*/ | ||
public static function register_mutation() { | ||
register_graphql_mutation( | ||
'createRefund', | ||
[ | ||
'inputFields' => 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 ]; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
<?php | ||
/** | ||
* Mutation - deleteRefund | ||
* | ||
* Registers mutation for delete a refund on an order. | ||
* | ||
* @package WPGraphQL\WooCommerce\Mutation | ||
* @since TDB | ||
*/ | ||
|
||
namespace WPGraphQL\WooCommerce\Mutation; | ||
|
||
use GraphQL\Error\UserError; | ||
use GraphQL\Type\Definition\ResolveInfo; | ||
use WC_Order_Factory; | ||
use WPGraphQL\AppContext; | ||
use WPGraphQL\WooCommerce\Data\Mutation\Order_Mutation; | ||
use WPGraphQL\WooCommerce\Model\Order; | ||
|
||
/** | ||
* Class Refund_Delete | ||
*/ | ||
class Refund_Delete { | ||
/** | ||
* Registers mutation | ||
* | ||
* @return void | ||
*/ | ||
public static function register_mutation() { | ||
register_graphql_mutation( | ||
'deleteRefund', | ||
[ | ||
'inputFields' => 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 ]; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
class RefundMutationsTest extends \Tests\WPGraphQL\WooCommerce\TestCase\WooGraphQLTestCase { | ||
public function testCreateRefundMutation() { | ||
$this->markTestIncomplete(); | ||
} | ||
|
||
public function testDeleteRefundMutation() { | ||
$this->markTestIncomplete(); | ||
} | ||
} |