diff --git a/README.md b/README.md index 400ab86..b4450f1 100644 --- a/README.md +++ b/README.md @@ -56,27 +56,79 @@ and cancel previously submitted donation. ### Submit donation +This API action processes submitted Twingle donations and donor information. + - Entity: `TwingleDonation` - Action: `Submit` -*This section is to be completed: Add parameters documentation and describe what -the action does. In the meantime, refer to -[the code](https://github.com/systopia/de.systopia.twingle/blob/master/api/v3/TwingleDonation/Submit.php)* +The action accepts the following parameters: + +| Parameter | Type | Description | Values/Format | Required | +|----------------------------------------|---------|-------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------| +| `project_id` | String | The Twingle project ID | | Yes | +| `trx_id` | String | The unique transaction ID of the donation | A unique transaction ID for the donation. | Yes | +| `confirmed_at` | String | The date when the donation was issued | A string representing a date in the format `YYYYMMDD` | Yes | +| `purpose` | String | The purpose of the donation | | | +| `amount` | Integer | The donation amount in minor currency unit | | Yes | +| `currency` | String | The ISO-4217 currency code of the donation | A valid ISO-4217 currency code | Yes | +| `newsletter` | Boolean | Whether to subscribe the contact to the newsletter group defined in the profile | | | +| `postinfo` | Boolean | Whether to subscribe the contact to the postal mailing group defined in the profile | | | +| `donation_receipt` | Boolean | Whether the contact requested a donation receipt | | | +| `payment_method` | String | The Twingle payment method used for the donation | One of:
| Yes | +| `donation_rhythm` | String | The interval which the donation is recurring in | One of:
| Yes | +| `debit_iban` | String | The IBAN for SEPA Direct Debit payments | A valid ISO 13616-1:2007 IBAN | Yes, if `payment_method` is `debit_manual` and CiviSEPA is used | +| `debit_bic` | String | The BIC for SEPA Direct Debit payments | A valid ISO 9362 BIC | Yes, if `payment_method` is `debit_manual` and CiviSEPA is used | +| `debit_mandate_reference` | String | The mandate reference for SEPA Direct Debit payments | | | +| `debit_account_holder` | String | The account holder for SEPA Direct Debit payments | | | +| `is_anonymous` | Boolean | Whether the donation is submitted anonymously | | | +| `user_gender` | String | The gender of the contact | | | +| `user_birthdate` | String | The date of birth of the contact | A string representing a date in the format `YYYYMMDD` | | +| `user_title` | String | The formal title of the contact | | | +| `user_email` | String | The e-mail address of the contact | A valid e-mail address | | +| `user_firstname` | String | The first name of the contact | | | +| `user_lastname` | String | The last name of the contact | | | +| `user_street` | String | The street address of the contact | | | +| `user_postal_code` | String | The postal code of the contact | | | +| `user_city` | String | The city of the contact | | | +| `user_telephone` | String | The telephone number of the contact | | | +| `user_company` | String | The company of the contact | | | +| `user_extrafield` | String | Additional information of the contact | | | + +You may also refer to +[the code](https://github.com/systopia/de.systopia.twingle/blob/master/api/v3/TwingleDonation/Submit.php) +for more insight into this API action. ### End recurring donation - Entity: `TwingleDonation` - Action: `Endrecurring` -*This section is to be completed: Add parameters documentation and describe what -the action does. In the meantime, refer to -[the code](https://github.com/systopia/de.systopia.twingle/blob/master/api/v3/TwingleDonation/Endrecurring.php)* +The action accepts the following parameters: + +| Parameter | Type | Description | Values/Format | Required | +|---------------------------|---------|------------------------------------------------|-------------------------------------------------------|----------| +| `project_id` | String | The Twingle project ID | | Yes | +| `trx_id` | String | The unique transaction ID of the donation | A unique transaction ID for the donation. | Yes | +| `ended_at` | Integer | The date when the recurring donation was ended | A string representing a date in the format `YYYYMMDD` | Yes | + +You may also refer to +[the code](https://github.com/systopia/de.systopia.twingle/blob/master/api/v3/TwingleDonation/Endrecurring.php) +for more insight into this API action. ### Cancel donation - Entity: `TwingleDonation` - Action: `Cancel` -*This section is to be completed: Add parameters documentation and describe what -the action does. In the meantime, refer to -[the code](https://github.com/systopia/de.systopia.twingle/blob/master/api/v3/TwingleDonation/Cancel.php)* +The action accepts the following parameters: + +| Parameter | Type | Description | Values/Format | Required | +|------------------------------|--------|----------------------------------------------------|-------------------------------------------------------|----------| +| `project_id` | String | The Twingle project ID | | Yes | +| `trx_id` | String | The unique transaction ID of the donation | A unique transaction ID for the donation. | Yes | +| `cancelled_at` | String | The date when the recurring donation was cancelled | A string representing a date in the format `YYYYMMDD` | Yes | +| `cancel_reason` | String | he reason for the donation being cancelled | | Yes | + +You may also refer to +[the code](https://github.com/systopia/de.systopia.twingle/blob/master/api/v3/TwingleDonation/Cancel.php) +for more insight into this API action. diff --git a/api/v3/TwingleDonation/Submit.php b/api/v3/TwingleDonation/Submit.php index 3a44c73..82c565e 100644 --- a/api/v3/TwingleDonation/Submit.php +++ b/api/v3/TwingleDonation/Submit.php @@ -44,7 +44,7 @@ function _civicrm_api3_twingle_donation_Submit_spec(&$params) { $params['confirmed_at'] = array( 'name' => 'confirmed_at', 'title' => 'Confirmed at', - 'type' => CRM_Utils_Type::T_INT, + 'type' => CRM_Utils_Type::T_STRING, 'api.required' => 1, 'description' => 'The date when the donation was issued, format: YYYYMMDD.', ); @@ -123,14 +123,14 @@ function _civicrm_api3_twingle_donation_Submit_spec(&$params) { 'title' => 'SEPA Direct Debit Mandate reference', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => 0, - 'description' => 'The mandate for SEPA Direct Debit payments.', + 'description' => 'The mandate reference for SEPA Direct Debit payments.', ); $params['debit_account_holder'] = array( 'name' => 'debit_account_holder', 'title' => 'SEPA Direct Debit Account holder', 'type' => CRM_Utils_Type::T_STRING, 'api.required' => 0, - 'description' => 'The mandate for SEPA Direct Debit payments.', + 'description' => 'The account holder for SEPA Direct Debit payments.', ); $params['is_anonymous'] = array( 'name' => 'is_anonymous',