From 77034e33b7cee5052ced14719900449f1b0c18fc Mon Sep 17 00:00:00 2001 From: Matthew Wire Date: Thu, 12 Aug 2021 01:28:15 +0100 Subject: [PATCH] Make price_field_id configurable. Set payment_processor_id on payments --- cli/konp.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cli/konp.php b/cli/konp.php index 7c11a1a..725a298 100644 --- a/cli/konp.php +++ b/cli/konp.php @@ -38,6 +38,8 @@ define('GC_IMPORT_SINCE', NULL); define('GC_PRIVATE_OUTPUT_DIR', '/tmp/'); // Do you want the process to stop and ask whether to create a subscription that can't be found? define('GC_CONFIRM_BEFORE_CREATING_RECUR', FALSE); +// Default price_field for lineitems +define('GC_DEFAULT_PRICE_FIELD_ID', 1); // Import Code begins // ================== @@ -321,7 +323,7 @@ class GCImport 'financial_type_id' => $this->financialTypeID, // xxx 'line_total' => $payment->amount / 100, 'unit_price' => $payment->amount / 100, - "price_field_id" => 1, + "price_field_id" => GC_DEFAULT_PRICE_FIELD_ID, 'qty' => 1, ]] ] @@ -496,7 +498,7 @@ class GCImport ]); } - print "✔ Created ContributionRecur $recurID for subscription $subscription->id $structures[membershipType]\n"; + print "✔ Created ContributionRecur $recurID for subscription $subscription->id {$structures['membershipType']}\n"; return $structures + ['contribution_recur' => reset($recur['values']), 'membership' => $membership]; } @@ -527,7 +529,7 @@ class GCImport 'line_item' => [[ 'line_total' => $subscription->amount / 100, 'unit_price' => $subscription->amount / 100, - "price_field_id" => 1, + "price_field_id" => GC_DEFAULT_PRICE_FIELD_ID, 'financial_type_id' => $financialTypeID, 'qty' => 1, ]] @@ -645,6 +647,7 @@ class GCImport 'trxn_date' => $payment['receive_date'], 'trxn_id' => $payment['trxn_id'], 'is_send_contribution_notification' => 0, + 'payment_processor_id' => $this->processor->getID(), ]; $paymentCreateResult = civicrm_api3('Payment', 'create', $paymentCreateParams); if (!$paymentCreateResult['is_error']) { -- GitLab