wp-pay-gateways /
buckaroo
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * CLI |
||
| 4 | * |
||
| 5 | * @author Pronamic <[email protected]> |
||
| 6 | * @copyright 2005-2021 Pronamic |
||
| 7 | * @license GPL-3.0-or-later |
||
| 8 | * @package Pronamic\WordPress\Pay\Buckaroo |
||
| 9 | */ |
||
| 10 | |||
| 11 | namespace Pronamic\WordPress\Pay\Gateways\Buckaroo; |
||
| 12 | |||
| 13 | /** |
||
| 14 | * Title: CLI |
||
| 15 | * Description: |
||
| 16 | * Copyright: 2005-2021 Pronamic |
||
| 17 | * Company: Pronamic |
||
| 18 | * |
||
| 19 | * @author Remco Tolsma |
||
| 20 | * @version 2.1.0 |
||
| 21 | * @since 2.1.0 |
||
| 22 | * @link https://github.com/woocommerce/woocommerce/blob/3.9.0/includes/class-wc-cli.php |
||
| 23 | */ |
||
| 24 | class CLI { |
||
| 25 | /** |
||
| 26 | * Construct CLI. |
||
| 27 | */ |
||
| 28 | public function __construct( $integration ) { |
||
| 29 | $this->integration = $integration; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 30 | |||
| 31 | \WP_CLI::add_command( |
||
|
0 ignored issues
–
show
The type
WP_CLI was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths Loading history...
|
|||
| 32 | 'pronamic-pay buckaroo transaction status', |
||
| 33 | function( $args, $assoc_args ) { |
||
| 34 | $this->wp_cli_transaction_status( $args, $assoc_args ); |
||
| 35 | }, |
||
| 36 | array( |
||
| 37 | 'shortdesc' => 'This returns the status for the provided transaction', |
||
| 38 | ) |
||
| 39 | ); |
||
| 40 | } |
||
| 41 | |||
| 42 | /** |
||
| 43 | * CLI transaction status. |
||
| 44 | * |
||
| 45 | * @link https://testcheckout.buckaroo.nl/json/Docs/Api/GET-json-Transaction-Status-transactionKey |
||
| 46 | * @param array<string> $args Arguments. |
||
| 47 | * @param array<string> $assoc_args Associative arguments. |
||
| 48 | * @return void |
||
| 49 | */ |
||
| 50 | public function wp_cli_transaction_status( $args, $assoc_args ) { |
||
| 51 | $gateway = $this->integration->get_gateway( $assoc_args['config_id'] ); |
||
| 52 | |||
| 53 | foreach ( $args as $transaction_key ) { |
||
| 54 | $result = $gateway->request( 'GET', 'Transaction/Status/' . $transaction_key ); |
||
| 55 | |||
| 56 | \WP_CLI::line( \wp_json_encode( $result, \JSON_PRETTY_PRINT ) ); |
||
| 57 | } |
||
| 58 | } |
||
| 59 | } |
||
| 60 |