Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
73.33% |
11 / 15 |
|
33.33% |
1 / 3 |
CRAP | |
0.00% |
0 / 1 |
| Payments | |
84.62% |
11 / 13 |
|
33.33% |
1 / 3 |
3.03 | |
0.00% |
0 / 1 |
| get_key | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| get_state | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| register_routes | |
100.00% |
11 / 11 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * The Payments section: Stripe, plans and the commission WordPress.com takes. |
| 4 | * |
| 5 | * @package automattic/jetpack-monetize |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\Jetpack\Monetize\Sections; |
| 9 | |
| 10 | use Automattic\Jetpack\Monetize\Dashboard_Section; |
| 11 | use Automattic\Jetpack\Monetize\WPCOM_Proxy; |
| 12 | |
| 13 | if ( ! defined( 'ABSPATH' ) ) { |
| 14 | exit( 0 ); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * Payments state and routes. |
| 19 | * |
| 20 | * @since $$next-version$$ |
| 21 | */ |
| 22 | class Payments implements Dashboard_Section { |
| 23 | |
| 24 | /** |
| 25 | * Section key. |
| 26 | * |
| 27 | * @return string |
| 28 | */ |
| 29 | public function get_key() { |
| 30 | return 'payments'; |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Nothing yet: the page reads payments data from WordPress.com. |
| 35 | * |
| 36 | * @return array |
| 37 | */ |
| 38 | public function get_state() { |
| 39 | return array(); |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Register the section's routes. |
| 44 | * |
| 45 | * @return void |
| 46 | */ |
| 47 | public function register_routes() { |
| 48 | // Stripe connection, commission and currency. |
| 49 | WPCOM_Proxy::register_route( |
| 50 | 'wpcom/v2', |
| 51 | 'memberships/status', |
| 52 | 'GET', |
| 53 | array( |
| 54 | 'source' => array( |
| 55 | 'type' => 'string', |
| 56 | 'sanitize_callback' => 'sanitize_key', |
| 57 | ), |
| 58 | ) |
| 59 | ); |
| 60 | } |
| 61 | } |