Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Скриптовые языки программирования > PHP
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 20.05.2017, 20:50   #1
timurus
Новичок
Джуниор
 
Регистрация: 20.05.2017
Сообщений: 1
По умолчанию Как передать URL страницы с параметрами action=? - PHP

Как передать 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()
    {
timurus вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск


Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
[РЕШЕНО] Как передать значение из <select> в action формы polluxstar HTML и CSS 8 15.04.2016 11:38
как отправить url страницы с формой belvision PHP 1 04.12.2010 16:25
Как узнать URL страницы с которой перейшли на мою SeRhy PHP 2 08.07.2009 22:19
Динамическое изменение URL страницы в JavaScript без перезагрузки страницы ilusha JavaScript, Ajax 7 25.02.2009 09:59