You are here

protected function AdminForm::getPaymentProcessorValue in Webform CiviCRM Integration 8.5

Return payment processor id as per is_test flag set on the webform.

Parameters

int $ppId.: Payment Processor ID.

Return value

int id of the payment processor as per is_test flag.

1 call to AdminForm::getPaymentProcessorValue()
AdminForm::rebuildData in src/AdminForm.php
Build $this->data array for webform settings; called while rebuilding or post-processing the admin form.

File

src/AdminForm.php, line 2372
Webform CiviCRM module's admin form.

Class

AdminForm
@file Webform CiviCRM module's admin form.

Namespace

Drupal\webform_civicrm

Code

protected function getPaymentProcessorValue($ppId) {
  $utils = \Drupal::service('webform_civicrm.utils');
  $pName = $utils
    ->wf_civicrm_api('PaymentProcessor', 'getvalue', [
    'return' => "name",
    'id' => $ppId,
  ]);
  $params = [
    'is_test' => $this->settings['civicrm_1_contribution_1_contribution_is_test'] ?? 0,
    'is_active' => 1,
    'name' => $pName,
  ];
  return key($utils
    ->wf_crm_apivalues('PaymentProcessor', 'get', $params));
}