Payments' contexts aren't set (only Payment::context_data, which is useless when doing DB operations). The attached patch sets Payment::context using the format payment_webform_[nid]_[cid].

Comments

xano’s picture

Status: Active » Needs review
StatusFileSize
new703 bytes

Status: Needs review » Needs work

The last submitted patch, payment_webform_1824654_00.patch, failed testing.

xano’s picture

Status: Needs work » Needs review
StatusFileSize
new705 bytes
xano’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

klapper’s picture

Version: 7.x-1.x-dev » 7.x-1.0
Status: Closed (fixed) » Needs work

This patch leads to
Notice: Undefined index: cid in payment_webform_payment_finish() (line 230 of ...\sites\all\modules\payment_webform\payment_webform.module).

with a paypal payment and a 403 error, so the webform cant be submitted.

After re-adding the context_data (see below) everything works fine.

function payment_webform_page_payment($node, $cid) {
  $component = $node->webform['components'][$cid];
  $payment = new Payment(array(
    'context_data' => array(
       'cid' => $cid,
    ),  
    'context' => 'payment_webform_' . $node->nid . '_' . $cid,
    'currency_code' => $component['extra']['payment_currency_code'],
    'description' => $component['extra']['payment_description'],
    'finish_callback' => 'payment_webform_payment_finish',
  ));
  foreach ($component['extra']['payment_line_items'] as $line_item) {
    $line_item->name = 'payment_webform_' . $line_item->name;
    $payment->setLineItem($line_item);
  }

  return drupal_get_form('payment_form_standalone', $payment);
}

This is in the 7.x-1.0 version.

xano’s picture

Status: Needs work » Fixed
StatusFileSize
new628 bytes

Thanks for reporting this!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xano’s picture

Assigned: xano » Unassigned