diff --git a/ang/gocardless/GoCardlessSettings.html b/ang/gocardless/GoCardlessSettings.html index ed520aa..8a5f447 100644 --- a/ang/gocardless/GoCardlessSettings.html +++ b/ang/gocardless/GoCardlessSettings.html @@ -4,7 +4,7 @@

{{ts('GoCardless settings')}}

+ {1: 'href="https://docs.civicrm.org/gocardless/en/latest/reference/settings/" target="_blank" rel="noopener noreferrer"'})">

diff --git a/cli/import-from-gc.php b/cli/import-from-gc.php index 2b2d69e..8ce7551 100644 --- a/cli/import-from-gc.php +++ b/cli/import-from-gc.php @@ -43,6 +43,9 @@ // What financial type do you want to use? define('GC_IMPORT_FINANCIAL_TYPE_NAME', 'Donation (regular)'); +// What price field do you want to use? Make sure the id exists! +define('GC_IMPORT_PRICE_FIELD_ID', 1); + // You can set a date here, or use NULL // define('GC_IMPORT_SINCE', '2019-05-01T00:00:00Z'); define('GC_IMPORT_SINCE', NULL); @@ -64,6 +67,9 @@ class GCImport /** @var int financial type. */ public $financialTypeID; + /** @var int Price Field */ + public $priceFieldID; + /** @var null|string date. */ public $importSince; @@ -124,7 +130,7 @@ class GCImport * @param String $financialTypeName * @param null|String $importSince (date) */ - public function __construct($financialTypeName, $importSince = NULL, $confirmCreateRecur=TRUE, $logDir=NULL) { + public function __construct($financialTypeName, $priceFieldID, $importSince = NULL, $confirmCreateRecur=TRUE, $logDir=NULL) { civicrm_initialize(); if ($logDir !== NULL) { @@ -145,6 +151,8 @@ public function __construct($financialTypeName, $importSince = NULL, $confirmCre throw new InvalidArgumentException("Failed to find financial type '$financialTypeName'"); } + $this->priceFieldID = $priceFieldID; + $this->confirmCreateRecur = (bool) $confirmCreateRecur; if ($importSince) { @@ -328,7 +336,7 @@ public function getPaymentsToImport($subscription) { 'financial_type_id' => $this->financialTypeID, 'line_total' => $payment->amount / 100, 'unit_price' => $payment->amount / 100, - "price_field_id" => 1, + 'price_field_id' => $this->priceFieldID, 'qty' => 1, ]] ] @@ -488,7 +496,7 @@ public function createInitialPendingContrib($subscription, $contactID, $contribR 'line_item' => [[ 'line_total' => $subscription->amount / 100, 'unit_price' => $subscription->amount / 100, - "price_field_id" => 1, + 'price_field_id' => $this->priceFieldID, 'financial_type_id' => $this->financialTypeID, 'qty' => 1, ]] @@ -622,6 +630,7 @@ public function saveAffectedSummary() { try { $importer = new GCImport( GC_IMPORT_FINANCIAL_TYPE_NAME, + GC_IMPORT_PRICE_FIELD_ID, GC_IMPORT_SINCE, GC_CONFIRM_BEFORE_CREATING_RECUR, GC_PRIVATE_OUTPUT_DIR diff --git a/docs/tutorial/contribution-page.md b/docs/tutorial/contribution-page.md index b547de8..c14357d 100644 --- a/docs/tutorial/contribution-page.md +++ b/docs/tutorial/contribution-page.md @@ -2,7 +2,7 @@ Setting up a contribution page is a big topic because there are so many options, so this tutorial is going to cover the minimal setup required to -start taking regular monthly donations. +start taking regular monthly donations. See the User Guide for more details - [Creating Contribution Pages](https://docs.civicrm.org/user/en/latest/contributions/online-contributions/). Go to **Contributions » New Contribution Page**. @@ -47,7 +47,7 @@ Then click **Save and Done** If you want to take one-offs, it's not your friend; it won't work and it will cause a lot of confusion/frustration. -## Make a contribution. +## Make a contribution You should now be on the list of Contribution Pages. (If not, find it under **Contributions » Manage Contribution Pages**) @@ -65,7 +65,8 @@ Click the **Links** link next to your new contribution page and click Remember earlier we said GoCardless doesn't do one-offs? Well this is important here because if a user does not check the "I want to - contribute every month" option then it will simply crash(!). + contribute every month" option then it will simply crash(!). You can + force this option on the [GoCardless Settings](../reference/settings.md#force-recurring) page. You should now be on GoCardless' website, seeing one of their forms. @@ -135,4 +136,3 @@ because we already know. If you're geeky you might like to [continue the tutorial](extra-marks.md) which will simulate the payment being made and updating CiviCRM; and cancelling the subscription. - diff --git a/docs/tutorial/install.md b/docs/tutorial/install.md index ce71622..29b2151 100644 --- a/docs/tutorial/install.md +++ b/docs/tutorial/install.md @@ -9,10 +9,10 @@ This extension can be installed from within CiviCRM itself (assuming your implementation allows that, some do not for security reasons). !!! info Alternatives - You can install manually or from the git repo (developers) but [see notes](../howto/alternative-installs/) + You can install manually or from the git repo (developers) but [see notes](../howto/alternative-installs.md) In your CiviCRM site, go to **Administer » System Settings » Extensions** -then visit the **Add New** tab. You can ee the CiviCRM user manual for details: [Installing +then visit the **Add New** tab. You can see the CiviCRM user manual for details: [Installing extensions](https://docs.civicrm.org/user/en/latest/introduction/extensions/#installing-extensions). **GoCardless Direct Debit Payment Processor** should be listed there, click the @@ -71,6 +71,6 @@ put something in. Click *Save*. You should now see your payment processor listed. -## Next step: set up your webhooks - +## Next step +[Set up your webhooks](webhook.md) diff --git a/docs/tutorial/webhook.md b/docs/tutorial/webhook.md index e56c098..990ab2a 100644 --- a/docs/tutorial/webhook.md +++ b/docs/tutorial/webhook.md @@ -1,8 +1,11 @@ # Set up your webhook +!!! note + While we're on this settings page. You will want to tick the Force Recurring checkbox (see [Settings](../reference/settings.md#force-recurring)). + ## Figure out your webhook endpoint URL -A "webhook endpoint" is a URL that GoCardless's system will use to tell +A "webhook endpoint" is a URL that GoCardless' system will use to tell your CRM about payments. !!! note @@ -12,20 +15,6 @@ your CRM about payments. In CiviCRM, visit **Administer » CiviContribute » GoCardless Settings**. This page will show you the URLs that you need. -## Fix Contribution Pages problem with non-recurring - -While we're on this settings page... - -This GoCardless extension cannot handle one-offs; only recurring -contributions are allowed. CiviContribute's pages offer the user -a checkbox asking if they want to make it regular. If they don't check -that, and they're using a GoCardless payment processor, it will crash. - -We can fix this by forcing contributions to use recurring payments if -a GoCardless processor is selected, which is what that Force Recurring -checkbox is about. **Check the force recurring checkbox and then click -Save**. - ## Set up the webhooks at GoCardless Login to your GoCardless sandbox account again (it's at @@ -51,7 +40,7 @@ You should now see your webhook listed with a green dot and "enabled" in the Status column. !!! note - You can't setup a webhook to a private URL. e.g. if you have + You can't set up a webhook to a private URL. e.g. if you have a development/staging server that's not publicly available, this is not going to work. GoCardless needs to be able to reach the webhook URL.