Is there a way to specify a tax rate in the payment reference module?

I couldn't find it and tried to hardcode a taxrate in in the instance of the PaymentLineItem class paymentreference_field_widget_form. After that the taxrate appeared on the form, the tax was calculated and added to total but also to amount. the former is correct but the latter not.

Comments

xano’s picture

Title: Tax rate in paymentreference » Tax rate in payment reference
Version: 7.x-1.6 » 7.x-1.x-dev
Category: bug » feature

This is not possible yet. I would welcome and help review any patches that add this feature. Note that in version 8.x-2.x tax rates are likely to disappear (see #1822376: Refactor line items).

Anonymous’s picture

Thank you for your quick reply.

I'll try to make a patch but maybe my programming skills are not sophisticated enough to do that. Firstly I wonder why the tax is added to the amount and the total as well when I hard coded the input of the taxrate in the simpel way as shown below. The calculation by function payment_form_standalone works well in other situations.

function betalingen_paymentreference_page(array $instance) {
  $payment = new Payment(array(
    'context_data' => array(
      'paymentreference' => TRUE,
      'entity_type' => $instance['entity_type'],
      'bundle' => $instance['bundle'],
      'field_name' => $instance['field_name'],
    ),
    'currency_code' => $instance['settings']['currency_code'],
    'description' => $instance['settings']['description'],
    'finish_callback' => 'paymentreference_payment_finish',
  ));
  $payment->setLineItem(new PaymentLineItem(array(
    'amount' => $instance['settings']['amount'],
'tax_rate' => 0.21,
    'description' => $instance['settings']['description'],
    'name' => 'paymentreference',
  )));dpm($payment);

  return drupal_get_form('payment_form_standalone', $payment);
}
Anonymous’s picture

Status: Active » Closed (won't fix)

Question cancelled, see discussion: http://drupal.org/node/1822376