<?php

namespace KnitPayUPI\Gateways\UpiQR\Freecharge;

use Pronamic\WordPress\Pay\Payments\PaymentStatus as Core_Statuses;

/**
 * Title: FreeCharge Statuses
 * Copyright: 2020-2026 Knit Pay
 *
 * @author  Knit Pay
 * @version 1.7.0.0
 * @since   1.7.0.0
 */
class Statuses {
	const SUCCESS = 'SUCCESS';
	
	const PAYMENT_FAILED = 'PAYMENT_FAILED';

	const PROCESSING = 'PROCESSING';

	/**
	 * Transform an FreeCharge status to an Knit Pay status
	 *
	 * @param string $status
	 *
	 * @return string
	 */
	public static function transform( $status ) {
		switch ( $status ) {
			case self::SUCCESS:
				return Core_Statuses::SUCCESS;

			case self::PAYMENT_FAILED:
				return Core_Statuses::FAILURE;

			case self::PROCESSING:
			default:
				return Core_Statuses::OPEN;
		}
	}
}
