paymentgateway in xrowecommerce | plz move to Developer

Author Message

Mischa Markus

Wednesday 22 July 2009 6:07:08 am

heya, tried to add the directebanking gateway to the xrowecommerce extension without success.

tried to add it in the settings but it seems to be wrong way..

[GatewaysSettings]
AvailableGateways[]=xrowInvoice
AvailableGateways[]=xrowCashOnDelivery
AvailableGateways[]=xrowAdvancepayment
AvailableGateways[]=DIRECTebanking

Mischa Markus

Tuesday 28 July 2009 1:40:43 am

got it, i modified the directebankinggateway.php and added it in xrowecommerce.
need it for paypal too. can anybody help me? my ezpaypal isn't ok in xrowecommerce...

directebankinggateway.php

<?php

class DIRECTebankingGateway extends xrowEPaymentGateway
{
    const GATEWAY_STRING = "DIRECTebanking";
    const AUTOMATIC_STATUS = false;

    function __construct()
    {
        $this->logger   = eZPaymentLogger::CreateForAdd( "var/log/DIRECTebankingGateway.log" );
        $this->logger->writeTimedString( 'DIRECTebankingGateway::directeBankingGateway()' );
    }

    function createPaymentObject( $processID, $orderID )
    {
        $this->logger->writeTimedString("createPaymentObject");
        return eZPaymentObject::createNew( $processID, $orderID, 'DIRECTebanking' );
    }

    function createRedirectionUrl( $process )
    {
        $parameters = $process->attribute( 'parameter_list' );
        $orderID = $parameters['order_id'];
        $order = eZOrder::fetch( $orderID );
        
        $directebankingINI = eZINI::instance( 'directebanking.ini' );
        
        $data = array(
            'user_id'               => $directebankingINI->variable( 'EbankingSettings', 'UserID' ),
            'project_id'            => $directebankingINI->variable( 'EbankingSettings', 'ProjectID' ),
            'sender_holder'         => $order->attribute( 'account_name' ),
            'sender_account_number' => '',
            'sender_bank_code'      => '',
            'sender_country_id'     => '',
            'amount'                => $order->attribute('total_inc_vat'),
            'currency_id'           => $order->currencyCode(),
            'reason_1'              => ezi18n( 'extension/directebanking/common', 'Order' ) . " " . $order->ID,
            'reason_2'              => '',
            'user_variable_0'       => '',
            'user_variable_1'       => $orderID,
            'user_variable_2'       => '',
            'user_variable_3'       => '',
            'user_variable_4'       => '',
            'user_variable_5'       => '',
            'project_password'      => $directebankingINI->variable( 'EbankingSettings', 'ProjectPWD' )
        );
        
        $data_serial = implode( '|', $data );
        switch( strtolower($directebankingINI->variable( 'EbankingSettings', 'InputCheckType' )) )
        {
            case 'sha1':
            case 'sha256':
            case 'md5':
            {
                $hash = hash(strtolower($directebankingINI->variable( 'EbankingSettings', 'InputCheckType' )), $data_serial );
            }break;
            default:
            {
                $hash = hash('md5', $data_serial );
            }break;
        }
        
        $server_uri = $directebankingINI->variable( 'ServerSettings', 'RequestURL' );
        
        $variables = '?';
        foreach( $data as $key => $value )
        {
            if( trim($value) != '' )
            {
                $variables .= $key.'='.$value.'&';
            }
        }
        $check = 'hash='.$hash;
        return $server_uri.$variables.$check;
    }

    function execute( $process, $event )
    {
        $processParams = $process->attribute( 'parameter_list' );
        $processID = $process->attribute( 'id' );
        $orderID = $processParams['order_id'];
        $order = eZOrder::fetch( $orderID );
        
        $xmlstring = $order->attribute( 'data_text_1' );
        if ( $xmlstring != null )
        {
            $doc = new DOMDocument( );
            $doc->loadXML( $xmlstring );
            $root = $doc->documentElement;
            $invoice = $doc->createElement( xrowECommerce::ACCOUNT_KEY_PAYMENTMETHOD, DIRECTebankingGateway::GATEWAY_STRING );
            $root->appendChild( $invoice );
            $order->setAttribute( 'data_text_1', $doc->saveXML() );
            $order->store();
        }
        return eZWorkflowType::STATUS_ACCEPTED;
    }

}
xrowEPayment::registerGateway( DIRECTebankingGateway::GATEWAY_STRING, "directebankinggateway", ezi18n( 'kernel/classes/datatypes', 'DIRECTebanking' ) );
?>

Piotr Dabrowski

Saturday 04 December 2010 10:50:23 pm

Hi,

Have you managed to add paypal to xrowecommerce?

Thanks

Peter

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 30 2025 01:02:35
Script start
Timing: Jan 30 2025 01:02:35
Module start 'layout'
Timing: Jan 30 2025 01:02:35
Module start 'content'
Timing: Jan 30 2025 01:02:35
Module end 'content'
Timing: Jan 30 2025 01:02:35
Script end

Main resources:

Total runtime0.0171 sec
Peak memory usage2,048.0000 KB
Database Queries3

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0057 588.3750151.2422
Module start 'layout' 0.00580.0024 739.617236.7109
Module start 'content' 0.00820.0073 776.328194.2031
Module end 'content' 0.01550.0015 870.531333.9922
Script end 0.0171  904.5234 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.002414.0767140.0002
Check MTime0.00116.1634140.0001
Mysql Total
Database connection0.00116.578910.0011
Mysqli_queries0.002313.578930.0008
Looping result0.00000.076710.0000
Template Total0.00116.610.0011
Template load0.00094.994810.0009
Template processing0.00031.579910.0003
Override
Cache load0.00063.585110.0006
General
dbfile0.002715.570280.0003
String conversion0.00000.040440.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 1
 Number of unique templates used: 1

Time used to render debug report: 0.0001 secs