Cheetah
Public Member Functions | Protected Member Functions | List of all members
ChPmtBitPay Class Reference
Inheritance diagram for ChPmtBitPay:
ChPmtProvider

Public Member Functions

 __construct ($oDb, $oConfig, $aConfig)
 
 initializeCheckout ($iPendingId, $aCartInfo, $bRecurring=false, $iRecurringDays=0)
 
 finalizeCheckout (&$aData)
 
 checkoutFinished ()
 
 createInvoice ($orderId, $price, $posData, $options=array())
 
 getInvoice ($invoiceId, $apiKey=false)
 
 getCurrencyList ()
 
 getRate ($code='USD')
 
- Public Member Functions inherited from ChPmtProvider
 needRedirect ()
 

Protected Member Functions

 _initializeOptions ()
 
 _verifyNotification ()
 
 _verifyPosData ($aPosData)
 
 _verifyAmount ($aPosData, $fAmount)
 
 _decodeResponse ($response)
 
 _hash ($data, $key)
 
 _curl ($url, $apiKey, $post=false)
 
 _log ($contents)
 
- Protected Member Functions inherited from ChPmtProvider
 getOptionsByPending ($iPendingId)
 
 getOption ($sName)
 

Additional Inherited Members

- Public Attributes inherited from ChPmtProvider
 $_oDb
 
 $_oConfig
 
 $_iId
 
 $_sName
 
 $_sCaption
 
 $_sPrefix
 
 $_aOptions
 
 $_bRedirectOnResult
 

Detailed Description

Definition at line 21 of file ChPmtBitPay.php.

Constructor & Destructor Documentation

◆ __construct()

ChPmtBitPay::__construct (   $oDb,
  $oConfig,
  $aConfig 
)

Constructor

Reimplemented from ChPmtProvider.

Definition at line 26 of file ChPmtBitPay.php.

Member Function Documentation

◆ _curl()

ChPmtBitPay::_curl (   $url,
  $apiKey,
  $post = false 
)
protected

Handles post/get to BitPay via curl.

Parameters
stringstringboolean$url,$apiKey,$post
Returns
mixed $response
Exceptions
Exception::$e

Definition at line 478 of file ChPmtBitPay.php.

◆ _decodeResponse()

ChPmtBitPay::_decodeResponse (   $response)
protected

Decodes JSON response and returns associative array.

Parameters
string$response
Returns
array $arrResponse
Exceptions
Exception::$e

Definition at line 432 of file ChPmtBitPay.php.

◆ _hash()

ChPmtBitPay::_hash (   $data,
  $key 
)
protected

Generates a base64 encoded keyed hash.

Parameters
stringstring$data,$key
Returns
string $hmac
Exceptions
Exception::$e

Definition at line 456 of file ChPmtBitPay.php.

◆ _initializeOptions()

ChPmtBitPay::_initializeOptions ( )
protected

Definition at line 293 of file ChPmtBitPay.php.

◆ _log()

ChPmtBitPay::_log (   $contents)
protected

Writes $contents to a log file specified in the bp_options file or, if missing, defaults to a standard filename of 'bplog.txt'.

Parameters
mixed$contents
Returns
Exceptions
Exception::$e

Definition at line 563 of file ChPmtBitPay.php.

◆ _verifyAmount()

ChPmtBitPay::_verifyAmount (   $aPosData,
  $fAmount 
)
protected

Definition at line 412 of file ChPmtBitPay.php.

◆ _verifyNotification()

ChPmtBitPay::_verifyNotification ( )
protected

Call from your notification handler to convert $_POST data to an object containing invoice data

Parameters
boolean$apiKey
Returns
mixed $json
Exceptions
Exception::$e

Definition at line 348 of file ChPmtBitPay.php.

◆ _verifyPosData()

ChPmtBitPay::_verifyPosData (   $aPosData)
protected

Call from your notification handler to verify posData

Parameters
array$aPosData
Returns
boolean

Definition at line 394 of file ChPmtBitPay.php.

◆ checkoutFinished()

ChPmtBitPay::checkoutFinished ( )

Reimplemented from ChPmtProvider.

Definition at line 118 of file ChPmtBitPay.php.

◆ createInvoice()

ChPmtBitPay::createInvoice (   $orderId,
  $price,
  $posData,
  $options = array() 
)

Creates BitPay invoice via Bitpay::curl.

Parameters
stringstringstringarray$orderId,$price,$posData,$options
Returns
array $response
Exceptions
Exception::$e

Definition at line 134 of file ChPmtBitPay.php.

◆ finalizeCheckout()

ChPmtBitPay::finalizeCheckout ( $aData)

Reimplemented from ChPmtProvider.

Definition at line 70 of file ChPmtBitPay.php.

◆ getCurrencyList()

ChPmtBitPay::getCurrencyList ( )

Retrieves a list of all supported currencies and returns associative array.

Parameters
none
Returns
array $currencies
Exceptions
Exception::$e

Definition at line 241 of file ChPmtBitPay.php.

◆ getInvoice()

ChPmtBitPay::getInvoice (   $invoiceId,
  $apiKey = false 
)

Retrieves an invoice from BitPay. $options can include 'apiKey'

Parameters
stringboolean$invoiceId,$apiKey
Returns
mixed $json
Exceptions
Exception::$e

Definition at line 208 of file ChPmtBitPay.php.

◆ getRate()

ChPmtBitPay::getRate (   $code = 'USD')

Retrieves the current rate based on $code. The default code us USD, so calling the function without a parameter will return the current BTC/USD price.

Parameters
string$code
Returns
string $rate
Exceptions
Exception::$e

Definition at line 273 of file ChPmtBitPay.php.

◆ initializeCheckout()

ChPmtBitPay::initializeCheckout (   $iPendingId,
  $aCartInfo,
  $bRecurring = false,
  $iRecurringDays = 0 
)

Reimplemented from ChPmtProvider.

Definition at line 34 of file ChPmtBitPay.php.


The documentation for this class was generated from the following file: