PHP code example of thoth-pharaoh-ken / laravel-goldflow

1. Go to this page and download the library: Download thoth-pharaoh-ken/laravel-goldflow library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

thoth-pharaoh-ken / laravel-goldflow example snippets


use ThothPharaohKen\laravelGoldFlow\EcPay;

class XXX 
{
    public function __construct(EcPay $ecpay)
    {
        $this->ecpay = $ecpay;
    }
    
    public function send()
    {
        //有三種方法可選用 CVS, ATM, Credit
        return $this->ecpay->CVS(500, 1440)->CreateTrade();
    }

}

use ThothPharaohKen\laravelGoldFlow\EcPay;

class XXX 
{
    public function __construct(EcPay $ecpay)
    {
        $this->ecpay = $ecpay;
    }
    
    public function send()
    {
        //有三種方法可選用 CVS, ATM, Credit
        return $this->ecpay->ATM(500, 1)->CreateTrade();
    }

}

use ThothPharaohKen\laravelGoldFlow\EcPay;

class XXX 
{
    public function __construct(EcPay $ecpay)
    {
        $this->ecpay = $ecpay;
    }
    
    public function send()
    {
        //有三種方法可選用 CVS, ATM, Credit
        return $this->ecpay->Creidt(500)->CreateTrade();
    }

}

use ThothPharaohKen\laravelGoldFlow\EcPay;

class XXX 
{
    public function __construct(EcPay $ecpay)
    {
        $this->ecpay = $ecpay;
    }
    
    public function send()
    {
        //有三種方法可選用 CVS, ATM, Credit
        return $this->ecpay->Creidt(500)->CreateTrade('thothken123456789');
    }

}

    use ThothPharaohKen\laravelGoldFlow\EcPay;
    
    class XXX 
    {
        public function __construct(EcPay $ecpay)
        {
            $this->ecpay = $ecpay;
        }
        
        public function send()
        {
            //有三種方法可選用 CVS, ATM, Credit
            return $this->ecpay->Creidt(500)->CreateTrade(null, true);
        }
    
    }
    

[
  "MerchantID" => "2000132"
  "SPToken" => "97885BE649034B4DA8377C5FB29BA81B"
  "PaymentType" => "ATM"
]

    use ThothPharaohKen\laravelGoldFlow\CheckMacValue;
    
    class XXX 
    {        
        public function check()
        {
            $testvalue = [
                      "RtnCode" => "1",
                      "RtnMsg" => "成功",
                      "SPToken" => "A8F2AAC8AD9343ADA67E8BB6539CAE72",
                      "MerchantID" => "2000132",
                      "MerchantTradeNo" => "thoth160195586727",
                      "CheckMacValue" => "2FFA4DA0C9198AB64CA0F3886FCAE15FFE4B9A4A57E29901DB57FE66CD8973F7"
                    ];
            return CheckMacValue::comparison($testvalue);// true or false
        }
    
    }
bash
php artisan vendor:publish --tag=ecpay