首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何将Easypay.pt API与Opengateway集成

如何将Easypay.pt API与Opengateway集成
EN

Stack Overflow用户
提问于 2013-09-29 02:52:18
回答 1查看 1.1K关注 0票数 0

我需要将Easypay.pt与opengateway集成起来,所以如果有人对此有所了解,我想知道是否有人能在这方面提供帮助,我将非常感谢。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-11-16 18:51:44

代码语言:javascript
复制
function Settings () {
    $settings = array();
    $settings['name'] = 'Easypay';
    $settings['class_name'] = 'easypay';
    $settings['external'] = FALSE;
    $settings['no_credit_card'] = FALSE;
    $settings['description'] =
        'Easypay is a portuguese company that offers a universal payment
        platform and is certified by SIBS, Unicre, Visa and MasterCard.  Our
        primary mission is helping the market to shorten the payment
        processing time and offer greater flexibility and convenience in
        payment.';
    $settings['is_preferred'] = 1;
    $settings['setup_fee'] = '$0.00';
    $settings['monthly_fee'] = '$30.00';
    $settings['transaction_fee'] = '2.5% + $0.30';
    $settings['purchase_link'] = 'https://www.easypay.pt/_s/api_easypay_01BG.php';
    $settings['allows_updates'] = 0;
    $settings['url_live'] = 'https://www.easypay.pt/_s/api_easypay_01BG.php ';
    $settings['url_test'] = 'http://test.easypay.pt/_s/api_easypay_01BG.php';
    $settings['allows_refunds'] = 1;
    $settings['requires_customer_information'] = 1;
    $settings['requires_customer_ip'] = 1;
    $settings['required_fields'] = array(
        'enabled',
        'mode',
        'ep_cin',
        'ep_user',
        'ep_ref_type',
        'ep_entity',
        't_key',
        'ep_language',
        'ep_country'
    );

    $settings['field_details'] = array(
        'enabled' => array(
            'text' => 'Enable this gateway?',
            'type' => 'radio',
            'options' => array(
                '1' => 'Enabled',
                '0' => 'Disabled'
            )
        ),
        'mode' => array(
            'text' => 'Mode',
            'type' => 'select',
            'options' => array(
                'live' => 'Live Mode',
                'test' => 'Test Mode'
            )
        ),
        'ep_cin' => array(
            'text' => 'Client Identification Number',
            'type' => 'text'
        ),              
        'ep_user' => array(
            'text' => 'Username',
            'type' => 'text'
        ),
        'ep_ref_type' => array(
            'text' => 'Type of Identifier',
            'type' => 'select',
            'options' => array(
                'auto' => 'Auto',
            )
        ),
        'ep_type' => array(
            'text' => 'Type',
            'type' => 'select',
            'options' => array(
                'boleto' => 'Boleto',
            )
        ),      
        'ep_entity' => array(
            'text' => 'Entity in use by Your Account.',
            'type' => 'text',
        ),
        't_key' => array(
            'text' => 'Transaction key',
            'type' => 'text',
        ),              
        'ep_language' => array(
            'text' => 'Language',
            'type' => 'select',
            'options' => array(
                'PT' => 'PT',
            )
        ),
        'ep_country' => array(
            'text' => 'Currency',
            'type' => 'select',
            'options' => array(
                'PT' => 'PT',
            )
        )
    );

    return $settings;
}

function TestConnection($client_id, $gateway) {
    // Get the proper URL
    switch($gateway['mode']) {
        case 'live':
            $post_url = $gateway['url_live'];
            break;
        case 'test':
            $post_url = $gateway['url_test'];
            break;
    }

    $post = array();
    $post['ep_cin'] = $gateway['ep_cin'];
    $post['ep_user'] = $gateway['ep_user'];
    $post['ep_entity'] = $gateway['ep_entity'];
    $post['ep_ref_type'] = $gateway['ep_ref_type'];
    $post['ep_type'] = 'boleto';
    $post['t_value'] = '504.4';
    $post['ep_country'] = $gateway['ep_country'];
    $post['ep_language'] = $gateway['ep_language'];
    $post['s_code'] = 'sssssssssssyour  code ddddddd';
    $post['t_key'] = $gateway['t_key'];;

    $response = $this->Process($post_url, $post);

    $status=$response->ep_status;
    //$CI =& get_instance();
    if($status != 'err1') {
        return TRUE;
    } else {    
        return FALSE;
    }
}

//--------------------------------------------------------------------
function Process($url, $post, $order_id = FALSE) {
    $response = simplexml_load_file(
        $url . "ep_cin=" . $post['ep_cin'] . "&ep_user=" . $post['ep_user']
        . "&ep_entity=" . $post['ep_entity'] . "&ep_ref_type=" . $post['ep_ref_type']
        . "&ep_type=" . $post['ep_type'] . "&ep_country=" . $post['ep_country']
        . "&ep_language='" . $post['ep_language'] . "'&s_code=" . $post['s_code']
        . "&t_key=" . $post['t_key'] . "&t_value=" . $post['t_value']
    );

    return $response;
}

//--------------------------------------------------------------------
//--------------------------------------------------------------------
private function response_to_array($string) {
    $string = urldecode($string);
    $pairs = explode('&', $string);
    $values = array();

    foreach($pairs as $pair) {
        list($key, $value) = explode('=', $pair);
        $values[$key] = $value;
    }

    return $values;
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/19073909

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档