Billhighway Cloud API

<back to all web services

DonationAchRequest

The following routes are available for this service:
POST/donations/ach
import 'package:servicestack/servicestack.dart';

class DonationRecurringInfo implements IConvertible
{
    /**
    * How often donation is collected automatically
    */
    // @ApiMember(Description="How often donation is collected automatically", IsRequired=true, Name="Frequency")
    String? Frequency;

    /**
    * Number of recurring donation cycles.
    */
    // @ApiMember(Description="Number of recurring donation cycles.", IsRequired=true, Name="NumberOfOccurrences")
    int? NumberOfOccurrences;

    /**
    * Allows the submitter to set a future date for the donation
    */
    // @ApiMember(Description="Allows the submitter to set a future date for the donation", Name="FutureDonationDate")
    DateTime? FutureDonationDate;

    DonationRecurringInfo({this.Frequency,this.NumberOfOccurrences,this.FutureDonationDate});
    DonationRecurringInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Frequency = json['Frequency'];
        NumberOfOccurrences = json['NumberOfOccurrences'];
        FutureDonationDate = JsonConverters.fromJson(json['FutureDonationDate'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Frequency': Frequency,
        'NumberOfOccurrences': NumberOfOccurrences,
        'FutureDonationDate': JsonConverters.toJson(FutureDonationDate,'DateTime',context!)
    };

    getTypeName() => "DonationRecurringInfo";
    TypeContext? context = _ctx;
}

class JsonObject extends Map<String,String?> implements IConvertible
{
    JsonObject();
    JsonObject.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "JsonObject";
    TypeContext? context = _ctx;
}

class DonationRequestBase implements IConvertible
{
    /**
    * Client value for Group. String must already be configured in Billhighway system.
    */
    // @ApiMember(Description="Client value for Group. String must already be configured in Billhighway system.", IsRequired=true, Name="GroupID")
    String? GroupId;

    /**
    * Amount of the payment. Must be an amount less than $10,000,000.00.
    */
    // @ApiMember(Description="Amount of the payment. Must be an amount less than $10,000,000.00.", IsRequired=true, Name="Amount")
    double? Amount;

    /**
    * The currency the payment is being made in. Three digit currency code (see ISO 4217) for a valid currency supported by Billhighway.  Defaults to USD
    */
    // @ApiMember(Description="The currency the payment is being made in. Three digit currency code (see ISO 4217) for a valid currency supported by Billhighway.  Defaults to USD", ExcludeInSchema=true, Name="CurrencyCode")
    String? CurrencyCode;

    /**
    * Notes about the donation. Maximum 70 characters.
    */
    // @ApiMember(Description="Notes about the donation. Maximum 70 characters.", Name="Memo")
    String? Memo;

    // @ApiMember()
    DonationRecurringInfo? DonationRecurringInfo;

    /**
    * Custom fields
    */
    // @ApiMember(Description="Custom fields", Name="MetaData")
    JsonObject? MetaData;

    DonationRequestBase({this.GroupId,this.Amount,this.CurrencyCode,this.Memo,this.DonationRecurringInfo,this.MetaData});
    DonationRequestBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        GroupId = json['GroupId'];
        Amount = JsonConverters.toDouble(json['Amount']);
        CurrencyCode = json['CurrencyCode'];
        Memo = json['Memo'];
        DonationRecurringInfo = JsonConverters.fromJson(json['DonationRecurringInfo'],'DonationRecurringInfo',context!);
        MetaData = JsonConverters.fromJson(json['MetaData'],'JsonObject',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'GroupId': GroupId,
        'Amount': Amount,
        'CurrencyCode': CurrencyCode,
        'Memo': Memo,
        'DonationRecurringInfo': JsonConverters.toJson(DonationRecurringInfo,'DonationRecurringInfo',context!),
        'MetaData': JsonConverters.toJson(MetaData,'JsonObject',context!)
    };

    getTypeName() => "DonationRequestBase";
    TypeContext? context = _ctx;
}

class DonationAchResponse implements IHaveErrorField, IConvertible
{
    /**
    * Legacy ErrorCode
    */
    // @ApiMember(Description="Legacy ErrorCode", ExcludeInSchema=true)
    // @Ignore()
    int? ErrorCode;

    String? ErrorMessage;
    bool? IsError;
    /**
    * Donation Transaction ID
    */
    // @ApiMember(Description="Donation Transaction ID")
    String? TransactionId;

    DonationAchResponse({this.ErrorCode,this.ErrorMessage,this.IsError,this.TransactionId});
    DonationAchResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ErrorCode = json['ErrorCode'];
        ErrorMessage = json['ErrorMessage'];
        IsError = json['IsError'];
        TransactionId = json['TransactionId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ErrorCode': ErrorCode,
        'ErrorMessage': ErrorMessage,
        'IsError': IsError,
        'TransactionId': TransactionId
    };

    getTypeName() => "DonationAchResponse";
    TypeContext? context = _ctx;
}

class DonationDonorInfo implements IConvertible
{
    /**
    * Name of donor. Maximum 100 characters. Format must be Firstname {space} Lastname.
    */
    // @ApiMember(Description="Name of donor. Maximum 100 characters. Format must be Firstname {space} Lastname.", IsRequired=true, Name="FullName")
    String? FullName;

    /**
    * Billing address. Maximum 100 characters.
    */
    // @ApiMember(Description="Billing address. Maximum 100 characters.", IsRequired=true, Name="Address")
    String? Address;

    /**
    * Billing city. Maximum 100 characters.
    */
    // @ApiMember(Description="Billing city. Maximum 100 characters.", IsRequired=true, Name="City")
    String? City;

    /**
    * Billing state. Two characters, must match valid US state code.
    */
    // @ApiMember(Description="Billing state. Two characters, must match valid US state code.", IsRequired=true, Name="State")
    String? State;

    /**
    * Credit Card billing address postal code. Maximum 10 characters.
    */
    // @ApiMember(Description="Credit Card billing address postal code. Maximum 10 characters.", IsRequired=true, Name="PostalCode")
    String? PostalCode;

    /**
    * Email address of donor. Maximum 100 characters. If provided, must be valid email format.
    */
    // @ApiMember(Description="Email address of donor. Maximum 100 characters. If provided, must be valid email format.", Name="EmailAddress")
    String? EmailAddress;

    /**
    * Preferred phone number. Maximum 12 characters.
    */
    // @ApiMember(Description="Preferred phone number. Maximum 12 characters.", Name="Phone")
    String? Phone;

    DonationDonorInfo({this.FullName,this.Address,this.City,this.State,this.PostalCode,this.EmailAddress,this.Phone});
    DonationDonorInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        FullName = json['FullName'];
        Address = json['Address'];
        City = json['City'];
        State = json['State'];
        PostalCode = json['PostalCode'];
        EmailAddress = json['EmailAddress'];
        Phone = json['Phone'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'FullName': FullName,
        'Address': Address,
        'City': City,
        'State': State,
        'PostalCode': PostalCode,
        'EmailAddress': EmailAddress,
        'Phone': Phone
    };

    getTypeName() => "DonationDonorInfo";
    TypeContext? context = _ctx;
}

class DonationMemberInfo implements IConvertible
{
    // @ApiMember(IsRequired=true)
    int? BhUserId;

    DonationMemberInfo({this.BhUserId});
    DonationMemberInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        BhUserId = json['BhUserId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'BhUserId': BhUserId
    };

    getTypeName() => "DonationMemberInfo";
    TypeContext? context = _ctx;
}

class DonationAchRequest extends DonationRequestBase implements IDonationRequestWithDonorInfo, IConvertible
{
    /**
    * Not required if MemberInfo is present on request
    */
    // @ApiMember(Description="Not required if MemberInfo is present on request")
    DonationDonorInfo? DonorInfo;

    /**
    * Not required if DonorInfo is present on request
    */
    // @ApiMember(Description="Not required if DonorInfo is present on request")
    DonationMemberInfo? MemberInfo;

    /**
    * Use GET /campaigns to retreive valid list of campaignIDs
    */
    // @ApiMember(Description="Use GET /campaigns to retreive valid list of campaignIDs")
    int? CampaignId;

    /**
    * RoutingNumber and AccountNumber are not required if AchRef is provided
    */
    // @ApiMember(Description="RoutingNumber and AccountNumber are not required if AchRef is provided")
    String? AchRef;

    /**
    * Required if AchRef is not provided
    */
    // @ApiMember(Description="Required if AchRef is not provided")
    String? RoutingNumber;

    /**
    * Required if AchRef is not provided
    */
    // @ApiMember(Description="Required if AchRef is not provided")
    String? AccountNumber;

    DonationAchRequest({this.DonorInfo,this.MemberInfo,this.CampaignId,this.AchRef,this.RoutingNumber,this.AccountNumber});
    DonationAchRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        DonorInfo = JsonConverters.fromJson(json['DonorInfo'],'DonationDonorInfo',context!);
        MemberInfo = JsonConverters.fromJson(json['MemberInfo'],'DonationMemberInfo',context!);
        CampaignId = json['CampaignId'];
        AchRef = json['AchRef'];
        RoutingNumber = json['RoutingNumber'];
        AccountNumber = json['AccountNumber'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'DonorInfo': JsonConverters.toJson(DonorInfo,'DonationDonorInfo',context!),
        'MemberInfo': JsonConverters.toJson(MemberInfo,'DonationMemberInfo',context!),
        'CampaignId': CampaignId,
        'AchRef': AchRef,
        'RoutingNumber': RoutingNumber,
        'AccountNumber': AccountNumber
    });

    getTypeName() => "DonationAchRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'devapi.billhighway.com', types: <String, TypeInfo> {
    'DonationRecurringInfo': TypeInfo(TypeOf.Class, create:() => DonationRecurringInfo()),
    'JsonObject': TypeInfo(TypeOf.Class, create:() => JsonObject()),
    'DonationRequestBase': TypeInfo(TypeOf.Class, create:() => DonationRequestBase()),
    'DonationAchResponse': TypeInfo(TypeOf.Class, create:() => DonationAchResponse()),
    'DonationDonorInfo': TypeInfo(TypeOf.Class, create:() => DonationDonorInfo()),
    'DonationMemberInfo': TypeInfo(TypeOf.Class, create:() => DonationMemberInfo()),
    'DonationAchRequest': TypeInfo(TypeOf.Class, create:() => DonationAchRequest()),
});

Dart DonationAchRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /donations/ach HTTP/1.1 
Host: devapi.billhighway.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"DonorInfo":{"FullName":"String","Address":"String","City":"String","State":"String","PostalCode":"String","EmailAddress":"String","Phone":"String"},"MemberInfo":{"BhUserId":0},"CampaignId":0,"AchRef":"String","RoutingNumber":"String","AccountNumber":"String","GroupId":"String","Amount":0,"CurrencyCode":"String","Memo":"String","DonationRecurringInfo":{"Frequency":"String","NumberOfOccurrences":0,"FutureDonationDate":"0001-01-01T00:00:00.0000000"},"MetaData":{"String":"String"}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ErrorCode":0,"ErrorMessage":"String","IsError":false,"TransactionId":"String"}