PHP code example of redberry / georgian-card-gateway

1. Go to this page and download the library: Download redberry/georgian-card-gateway 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/ */

    

redberry / georgian-card-gateway example snippets




namespace App\Library;

use Redberry\GeorgianCardGateway\Contracts\GeorgianCardHandler;
use Illuminate\Http\Request;

class GeorgianCard implements GeorgianCardHandler
{
  /**
   * Get primary transaction id
   * for recurrent transactions.
   * 
   * @param   Request $request
   * @return  string|null
   */
  public function getPrimaryTransactionId( Request $request )
  {
    // Return primary transaction id
  }

  /**
   * Determine if it should save card or pay
   * and proceed accordingly.
   * 
   * @param   Request  $request
   * 
   * @return  void
   */
  public function update( Request $request )
  {
    // Do things...
  }

  /**
   * Success method will be executed if
   * transaction is to end successfully.
   * 
   * @return mixed
   */
  public function success()
  {
    dump( 'Success' );
  }

  /**
   * Failed method will be executed if
   * transaction is to end with failure.
   * 
   * @return mixed
   */
  public function failure()
  {
    dump( 'Failure' );
  }
}

namespace App\Providers;

use App\Library\GeorgianCard;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this -> app -> bind( 'redberry.georgian-card.handler', GeorgianCard :: class );
    }

use Redberry\GeorgianCardGateway\Transaction;

$transaction = new Transaction;

$transaction 
      -> setOrderId   ( $orderId    )
      -> setAmount    ( $amount     ) // 100 = 1 lari
      -> setUserId    ( $userId     ) // optional
      -> setUserCardId( $userCardId ) // optional
      -> set( 'rame'  , 'rume' ) 
      -> execute();

use Redberry\GeorgianCardGateway\Refund;

$refund =  new Refund;

$refund
      -> setTrxId ( $trxId  )
      -> setRRN   ( $RRN    )
      -> setAmount( $amount )
      -> execute();
sh
php artisan vendor:publish --provider="Redberry\GeorgianCardGateway\Support\ServiceProvider"