File "class-kp-cancel-recurring.php"

Full Path: /home/siazco/grocery.siazco.se/wp-content/plugins/klarna-payments-for-woocommerce/classes/requests/patch/class-kp-cancel-recurring.php
File size: 943 bytes
MIME-type: text/x-php
Charset: utf-8

<?php
/**
 * Cancel KP recurring order.
 *
 * https://docs.klarna.com/klarna-payments/other-actions/cancel-a-customer-token/
 *
 * @package WC_Klarna_Payments/Classes/Requests/PATCH
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Create KP recurring order.
 */
class KP_Cancel_Recurring extends KP_Requests_Patch {
	/**
	 * Class constructor.
	 *
	 * @param array $arguments The request arguments.
	 */
	public function __construct( $arguments ) {
		parent::__construct( $arguments );

		$this->log_title      = 'Cancel recurring order';
		$this->request_filter = 'wc_klarna_payments_cancel_recurring_order_args';
		$this->endpoint       = "/customer-token/v1/tokens/{$arguments['recurring_token']}/status";
	}


	/**
	 * Gets the request body.
	 *
	 * @param int $order_id The WooCommerce order id.
	 * @return array
	 */
	public function get_body() {
		return array(
			'status' => 'cancelled',
		);
	}
}