<?php

namespace Hyperpay\Gateways\Helpers;

class COF
{

    public static function build_cit_params($agreementId)
    {
        return [
            'standingInstruction.mode'      => 'INITIAL',
            'standingInstruction.type'      => 'UNSCHEDULED',
            'standingInstruction.source'    => 'CIT',
            'standingInstruction.recurringType' => 'STANDING_ORDER',
            'standingInstruction.expiry'    => gmdate('Y-m-d', strtotime('+3 years')),
            'customParameters[paymentFrequency]' => 'OTHER',
            'customParameters[recurringPaymentAgreement]' => $agreementId,
            'customParameters[standingInstruction]' => 'UNSCHEDULED',
            'customParameters[PostBridge_MADA_AGREEMENT_ID]' => $agreementId,
        ];
    }

    public static function build_mit_params($agreementId, $initialTxId = '')
    {
        return [
            'standingInstruction.mode'     => 'REPEATED',
            'standingInstruction.type'     => 'UNSCHEDULED',
            'standingInstruction.source'   => 'MIT',
            'standingInstruction.initialTransactionId' => $initialTxId,
            'standingInstruction.expiry'    => gmdate('Y-m-d', strtotime('+3 years')),
            'customParameters[plugin]'     => 'wordpress',
            'customParameters[standingInstruction]' => 'UNSCHEDULED',
            'customParameters[recurringPaymentAgreement]' => $agreementId,
            'customParameters[CardholderInitiatedTransactionID]' => $initialTxId,
            'customParameters[PostBridge_MADA_AGREEMENT_ID]' => $agreementId,
        ];
    }
}
