Hi!

This is a collection of utilities used by Destiny Rescue/Child Rescue.


Donation Form

A donation form which can be added to any page. Example:

<script src=https://utils.destinyrescue.org/donation-form/form.js async defer></script>
<div
    class=donation-form
    data-fn=US
    data-methods=cc,paypal
    data-cc-provider-id=a0p28000004ghhWAAQ
    data-confirmation-email="Rescue_Partner_Email_US.html"
></div>

Parameters

data-fn

Identifier for the Funding Nation. Available options are US, AUS.

data-mode

The options that are available to the donor. Available options are:

1Recurring only (no option displayed, default)
2One-time only (no option displayed)
3Recurring or One-time (option displayed)

For example:

data-mode=1

data-methods

Comma-separated list of allowed payment methods. Available options are cc, ach, paypal.

ach is equivalent to Direct Debit in Australia/New Zealand.

data-minimum The minimum donation allowed.
data-default-amount The default amount displayed in the amount box. For example:

data-default-amount="" blank default amount
data-default-amount="20" default amount of $20
data-<name>-provider-id

Each method must have a provider Id. This Id is found in the "Long Id" field in the Payment Provider details in Salesforce. The Id is specified by adding a parameter, in the format . Every payment method must have a provider Id specified.

data-<name>-name

Each method may also have a name, to allow localising the names of methods, for example:

data-ach-name="Direct Debit"

data-entity

The sponsorship entity ID that recurring donations should be attached to.

data-confirmation-email

The name of the confirmation email document from Salesforce to send. For example:

data-confirmation-email="Rescue_Partner_Email_US.html"

These should all be in the "Shared Documents" folder.


Get User's Country

Uses Cloudflare's CF-IPCountry header to return the user's country in ISO 3166-1 Alpha 2 format.

More information

$.getJSON('https://utils.destinyrescue.org/get-country').then(function(country) { alert(country); });

Get List of Countries

Sends back a list of countries in a name => ISO JSON format

$.getJSON('https://utils.destinyrescue.org/get-countries').then(function(countries) { console.log(countries); });

JavaScript Error Logger

One line which logs all client-side errors to a database.

<script crossorigin=anonymous src="https://utils.destinyrescue.org/js-error-logger"></script>