Как передать URL страницы с параметрами action=? - PHP
PHP код:
<?php
/**
* [PHPFOX_HEADER]
*/
defined('PHPFOX') or exit('NO DICE!');
class Phpfox_Gateway_Api_belentlik implements Phpfox_Gateway_Interface
{
/**
* Holds an ARRAY of settings to pass to the form
*
* @var array
*/
private $_aParam = array();
/**
* Holds an ARRAY of supported currencies for this payment gateway
*
* @var array
*/
private $_aCurrency = array('USD');
/**
* Class constructor
*
*/
public function __construct()
{
}
/**
* Set the settings to be used with this class and prepare them so they are in an array
*
* @param array $aSetting ARRAY of settings to prepare
*/
public function set($aSetting)
{
$this->_aParam = $aSetting;
if (Phpfox::getLib('parse.format')->isSerialized($aSetting['setting']))
{
$this->_aParam['setting'] = unserialize($aSetting['setting']);
}
}
/**
* Each gateway has a unique list of params that must be passed with the HTML form when posting it
* to their site. This method creates that set of custom fields.
*
* @return array ARRAY of all the custom params
*/
public function getEditForm()
{
return array(
'apiKey' => array(
'phrase' => Phpfox::getPhrase('apiKey'),
'phrase_info' => Phpfox::getPhrase('apiKey_info'),
'value' => (isset($this->_aParam['setting']['apiKey']) ? $this->_aParam['setting']['apiKey'] : '')
),
'merchantAccountCode' => array(
'phrase' => Phpfox::getPhrase('merchantAccountCode'),
'phrase_info' => Phpfox::getPhrase('merchantAccountCode_info'),
'value' => (isset($this->_aParam['setting']['merchantAccountCode']) ? $this->_aParam['setting']['merchantAccountCode'] : '')
)
);
}
/**
* Returns the actual HTML <form> used to post information to the 3rd party gateway when purchasing
* an item using this specific payment gateway
*
* @return bool FALSE if we can't use this payment gateway to purchase this item or ARRAY if we have successfully created a form
*/
public function getForm()
{
$bCurrencySupported = true;
if (!in_array($this->_aParam['currency_code'], $this->_aCurrency))
{
if (!empty($this->_aParam['alternative_cost']))
{
$aCosts = unserialize($this->_aParam['alternative_cost']);
foreach ($aCosts as $aCost)
{
$sCode = key($aCost);
$iPrice = $aCost[key($aCost)];
if (in_array($sCode, $this->_aCurrency))
{
$this->_aParam['amount'] = $iPrice;
$this->_aParam['currency_code'] = $sCode;
$bCurrencySupported = false;
break;
}
}
if ($bCurrencySupported === true)
{
return false;
}
}
else
{
return false;
}
}
$aParts = explode('|', $this->_aParam['item_number']);
$aForm = array(
'url' => 'https://lk.belentlik.tm/gates/signature?',
'param' => array(
'requestType' => 'Sale',
'merchantAccountCode' => $this->_aParam['setting']['merchantAccountCode'],
'transactionIndustryType' => 'EC',
'accountType' => 'R',
'accountNumber' => '4111111111111111',
'accountAccessory' => '0422',
'CVV2' => '123',
'amount' => '10',
'currency' => $this->_aParam['currency_code'],
'lang' => 'RU',
'item Code' => '999999',
'transactionCode' => '0000000001',
'customerAccountCode' => '1818',
'ticketNumber' => $this->_aParam['item_number'],
'memo' => 'xyz',
'itemCount' => '2',
'items' => '',
'holderType' => 'P',
'holderName' => 'MARS+SNIKERS',
'holderBirthdate' => '',
'countryCode' => 'US',
'state'=>'',
'street'=>'',
'city'=>'',
'zipCode'=>'',
'phone'=>'',
'email'=>'',
'apiKey' => $this->_aParam['setting']['apiKey']
)
);
'header' => "Location: https://lk.belentlik.tm/gates/paypage?action=",
if ($this->_aParam['is_test'])
{
$aForm['param']['demo'] = 'Y';
}
return $aForm;
}
/**
* Performs the callback routine when the 3rd party payment gateway sends back a request to the server,
* which we must then back and verify that it is a valid request. This then connects to a specific module
* based on the information passed when posting the form to the server.
*
*/
public function callback()
{