Community

Parse error: syntax error, unexpected T_VARIABLE in /home/xx/vv/av_payment/av_payment.module on line 3

i try to deploy mymodule "av_payment" that is an test example for users to make payment after requesting for an order, and but i have this error : Parse error: syntax error, unexpected T_VARIABLE in /home/xx/vv/av_payment/av_payment.module on line 3, and i can't correctly identify the problem

please help :

------------------------------------------

<?php
function av_payment_commerce_payment_method_info() {
 $payment_methods = array(); 
 $payment_methods['auth_api'] = array( 
    'title' => t('Method name'),
    'base' => 'av_payment',
   
'display_title' => t('client autorization'),
    'description' => t('Allows users to pay for their order .'),
  );

return
$payment_methods;
}


function
av_payment_submit_form($payment_method, $pane_values, $checkout_pane, $order) {

$form = array();

$pane_values = array(
'name' => '',
);

$form['name'] = array (
'#type' => 'textfield',
'#title' =>  t ('nom '),
'#description' => t ('Your API Login ID used to login to your account.'),
'#default_value' => $pane_values['name'],
'#required' => TRUE,
);

return
$form;
}



function
av_payment_submit_form_validate($payment_method, $pane_form, $pane_values, $order, $form_parents = array()) {

if (empty(
$pane_values['name'])) {

drupal_set_message(t('check the correct values for the input.'));
return
FALSE;
}





function
av_payment_submit_form_submit($form, &$form_state,$payment_method, $pane_values, $charge, $order) {

$order->data['auth_api'] = $pane_values;
$form = array();
$db_url['drupal'] = 'mysql://root:password@localhost/drupal';
db_set_active('drupal');
$account = db_query("SELECT * FROM {users} WHERE name = :name AND status = 1", array(':name' => $form_state['values']['name']))->fetchObject();

  if(
$account) {
    if (
variable_get('user_failed_login_identifier_uid_only', FALSE)) {
      
       
$identifier = $account->name/**we can cheek also the user ID-uid*/
     
if ($form_state['values']['name'] == $pane_values['name']) {
       
av_payment_transaction($payment_method, $order, $charge, $pane_values['name']);
      }
      else {
       
drupal_set_message( t('The user login %name is not registred in the database.'));
      }
    }
 
}
}


function
av_payment_transaction($payment_method, $order, $charge, $pane_values['name']) {

$response = av_payment_request($payment_method,$nvp);
                            
$transaction = commerce_payment_transaction_new('auth_api,$order->order_id');
                            
$transaction->instance_id = $payment_method->instance_id;
                            
$transaction->remote_id = $response[6];
                            
$transaction->amount = $charge['amount'];
                            
$transaction->currency_code = $charge['currency_code'];
                            
$transaction->payload[REQUEST_TIME] = $response;
                            
                                if (
$response[0] != '1')
{
                                            
$transaction->status = COMMERCE_PAYMENT_STATUS_FAILED;
                             }

                               else {
                                    
$transaction->status = COMMERCE_PAYMENT_STATUS_SUCCESS;

                                    
drupal_set_message( t('Commerce payment operation had been seccess!.'));
                                    }
                            

                          
commerce_payment_transaction_save($transaction);
}
?>

Comments

<?php$transaction =

<?php
$transaction
= commerce_payment_transaction_new('auth_api,$order->order_id');
?>

should be

<?php
$transaction
= commerce_payment_transaction_new('auth_api',$order->order_id);
?>

seems to be the issue :)

RTFM!
For further support or projects contact me.
Issue solved? Add [Solved] to the title

--> N1ghteyes : I just

--> N1ghteyes : I just wanted to thank you for taking the time to reply to my problem , but I still have the same error message.and i can not understand why ! :(

thinks

See Drave's reply bellow :).

See Drave's reply below :). hes caught the cause for the error, what I caught would cause you problems later on :)

RTFM!
For further support or projects contact me.
Issue solved? Add [Solved] to the title

I see nothing wrong on line

I see nothing wrong on line 3, but if clause in av_payment_submit_form_validate() is missing closing } - proper indenting would have helped you to catch that.

Nice catch there :D, I missed

Nice catch there :D, I missed that one when I looked (should of copied into netbeans when i checked really)

RTFM!
For further support or projects contact me.
Issue solved? Add [Solved] to the title

_

it also helps alot to use code tags with the post -- the op left off the closing tag.

_
Don't be a Help Vampire - read and abide the forum guidelines.
If you find my assistance useful, please pay it forward to your fellow drupalers.

A quick bit of friendly

A quick bit of friendly advice for the OP,

Try using an IDE like Netbeans or Eclipse, or a more basic editor like Sublime Text 2. They will help you to spot issues like this, and make reading the code a little easier :). They will also help with correct indentations, formatting and such which make following code easier.

RTFM!
For further support or projects contact me.
Issue solved? Add [Solved] to the title