Skip to content

Commit

Permalink
Paypal express compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
rubofvil committed Jun 16, 2023
1 parent 64047d2 commit fd4c695
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/WebformCivicrmConfirmForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ function initialize(FormStateInterface $form_state) {

public function doPayment() {
$paramsDoPayment = $this->form_state->get(['civicrm', 'doPayment']);

if (!empty($paramsDoPayment['payment_processor_id'])) {
$paymentProcessor = \Civi\Payment\System::singleton()->getById($paramsDoPayment['payment_processor_id']);

Expand Down
4 changes: 2 additions & 2 deletions webform_civicrm.module
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ function webform_civicrm_preprocess_webform_confirmation(&$vars) {
$settings = $handler->getConfiguration()['settings'];
$paymentProcessorMode = $settings['civicrm_1_contribution_1_contribution_is_test'] == 1 ? 'test' : 'live';

$paymentProcessor = \CRM_Financial_BAO_PaymentProcessor::getPayment($contribution['payment_instrument_id'], $paymentProcessorMode);
$paymentProcessor = \CRM_Financial_BAO_PaymentProcessor::getPayment($data['civicrm_1_contribution_1_contribution_payment_processor_id_raw'], $paymentProcessorMode);
$payment = \Civi\Payment\System::singleton()->getByProcessor($paymentProcessor);
$result = $payment->doPayment($contribution);

Expand All @@ -970,7 +970,7 @@ function webform_civicrm_preprocess_webform_confirmation(&$vars) {
civicrm_api3('contribution', 'completetransaction', [
'id' => $result['id'],
'trxn_id' => $result['trxn_id'] ?? NULL,
'payment_processor_id' => $result['payment_processor_id'] ?? $contribution['payment_instrument_id'],
'payment_processor_id' => $result['payment_processor_id'] ?? $data['civicrm_1_contribution_1_contribution_payment_processor_id_raw'],
'is_transactional' => FALSE,
'fee_amount' => $result['fee_amount'] ?? NULL,
'receive_date' => $result['receive_date'] ?? NULL,
Expand Down

0 comments on commit fd4c695

Please sign in to comment.