0

Easypay.ptをopengatewayと統合する必要があるので、これについて何か知っている人がいれば、誰かがこれを助けることができるかどうか知りたいです。

4

1 に答える 1

0
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;
}
于 2013-11-16T18:51:44.933 に答える