Spamworldpro Mini Shell
Spamworldpro


Server : Apache
System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64
User : corals ( 1002)
PHP Version : 7.4.33
Disable Function : exec,passthru,shell_exec,system
Directory :  /home/corals/job-board.corals.io/Corals/modules/Payment/Fac/Message/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/corals/job-board.corals.io/Corals/modules/Payment/Fac/Message/UpdateCardRequest.php
<?php

namespace Corals\Modules\Payment\Fac\Message;

use Corals\Modules\Payment\Fac\Message\AbstractRequest;

/**
 * FACPG2 Update Token Request
 *
 * Required Parameters:
 * customerReference - The name of the customer
 * cardReference - This is the token created by FAC for the card being updated
 * card - Instantiation of the Corals\Modules\Payment\Fac\CreditCard class
 */
class UpdateCardRequest extends AbstractRequest
{
    /**
     * @var string;
     */
    protected $requestName = 'UpdateTokenRequest';

    /**
     * Returns the signature for the request.
     *
     * @return string base64 encoded sha1 hash of the merchantPassword, merchantId,
     *    and acquirerId.
     */
    protected function generateSignature()
    {
        $signature  = $this->getMerchantPassword();
        $signature .= $this->getMerchantId();
        $signature .= $this->getAcquirerId();

        return base64_encode( sha1($signature, true) );
    }

    /**
     * Validate and construct the data for the request
     *
     * @return array
     */
    public function getData()
    {
        $this->validate('merchantId', 'merchantPassword', 'acquirerId', 'customerReference', 'cardReference', 'card');
        $this->getCard()->validate();

        $data = [
            'CustomerReference' => $this->getCustomerReference(),
            'ExpiryDate'        => $this->getCard()->getExpiryDate('my'),
            'MerchantNumber'    => $this->getMerchantId(),
            'Signature'         => $this->generateSignature(),
            'TokenPAN'          => $this->getCardReference()
        ];

        return $data;
    }

    /**
     * Get the customer reference.
     *
     * @return string
     */
    public function getCustomerReference()
    {
        return $this->getParameter('customerReference');
    }

    /**
     * Set the customer reference.
     *
     * @param string $value
     */
    public function setCustomerReference($value)
    {
        return $this->setParameter('customerReference', $value);
    }

    /**
     * Returns endpoint for update token requests
     *
     * @return string Endpoint URL
     */
    protected function getEndpoint()
    {
        return parent::getEndpoint() . 'UpdateToken';
    }

    /**
     * Return the update token response object
     *
     * @param \SimpleXMLElement $xml Response xml object
     *
     * @return UpdateCardResponse
     */
    protected function newResponse($xml)
    {
        return new UpdateCardResponse($this, $xml);
    }

}

Spamworldpro Mini