| POST | /donations/creditcard |
|---|
import 'package:servicestack/servicestack.dart';
import 'dart:collection';
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 DonationCreditCardResponse 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;
String? CardRef;
DonationCreditCardResponse({this.ErrorCode,this.ErrorMessage,this.IsError,this.TransactionId,this.CardRef});
DonationCreditCardResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ErrorCode = json['ErrorCode'];
ErrorMessage = json['ErrorMessage'];
IsError = json['IsError'];
TransactionId = json['TransactionId'];
CardRef = json['CardRef'];
return this;
}
Map<String, dynamic> toJson() => {
'ErrorCode': ErrorCode,
'ErrorMessage': ErrorMessage,
'IsError': IsError,
'TransactionId': TransactionId,
'CardRef': CardRef
};
getTypeName() => "DonationCreditCardResponse";
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 DonationCreditCardRequest 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;
/**
* Campaign to track donation against and to define fund allocation. Use GET /campaigns to retreive valid list of campaignIDs
*/
// @ApiMember(Description="Campaign to track donation against and to define fund allocation. Use GET /campaigns to retreive valid list of campaignIDs")
int? CampaignId;
/**
* CardRef returned from client-side tokenization. Also handles raw card number if your servers are PCI-DSS-compliant, and in that case this must be a valid card number for the CardType indicated.
*/
// @ApiMember(Description="CardRef returned from client-side tokenization. Also handles raw card number if your servers are PCI-DSS-compliant, and in that case this must be a valid card number for the CardType indicated.", IsRequired=true, Name="CardReferenceOrCardNumber")
String? CardReferenceOrCardNumber;
String? CardType;
/**
* Credit Card Validation value. If Visa, Master Card or Discover, must be 3 digits. If AmEx, must be 4 digits.
*/
// @ApiMember(Description="Credit Card Validation value. If Visa, Master Card or Discover, must be 3 digits. If AmEx, must be 4 digits.", Name="Cvv")
String? Cvv;
// @ApiMember(IsRequired=true)
// @ApiMember(Description="Credit Card expiration month. Valid Values 1-12.", IsRequired=true, Name="ExpirationMonth")
int? ExpirationMonth;
/**
* Credit Card expiration year. Four-digit Year. Value cannot be less than current year or more than 20 years in the future. ExpMonth + ExpYear must not be in the past.
*/
// @ApiMember(Description="Credit Card expiration year. Four-digit Year. Value cannot be less than current year or more than 20 years in the future. ExpMonth + ExpYear must not be in the past.", IsRequired=true, Name="ExpirationYear")
int? ExpirationYear;
DonationCreditCardRequest({this.DonorInfo,this.MemberInfo,this.CampaignId,this.CardReferenceOrCardNumber,this.CardType,this.Cvv,this.ExpirationMonth,this.ExpirationYear});
DonationCreditCardRequest.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'];
CardReferenceOrCardNumber = json['CardReferenceOrCardNumber'];
CardType = json['CardType'];
Cvv = json['Cvv'];
ExpirationMonth = json['ExpirationMonth'];
ExpirationYear = json['ExpirationYear'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'DonorInfo': JsonConverters.toJson(DonorInfo,'DonationDonorInfo',context!),
'MemberInfo': JsonConverters.toJson(MemberInfo,'DonationMemberInfo',context!),
'CampaignId': CampaignId,
'CardReferenceOrCardNumber': CardReferenceOrCardNumber,
'CardType': CardType,
'Cvv': Cvv,
'ExpirationMonth': ExpirationMonth,
'ExpirationYear': ExpirationYear
});
getTypeName() => "DonationCreditCardRequest";
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()),
'DonationCreditCardResponse': TypeInfo(TypeOf.Class, create:() => DonationCreditCardResponse()),
'DonationDonorInfo': TypeInfo(TypeOf.Class, create:() => DonationDonorInfo()),
'DonationMemberInfo': TypeInfo(TypeOf.Class, create:() => DonationMemberInfo()),
'DonationCreditCardRequest': TypeInfo(TypeOf.Class, create:() => DonationCreditCardRequest()),
});
Dart DonationCreditCardRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /donations/creditcard HTTP/1.1
Host: devapi.billhighway.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<DonationCreditCardRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common4.DTO.Donations">
<Amount>0</Amount>
<CurrencyCode>String</CurrencyCode>
<DonationRecurringInfo>
<Frequency>String</Frequency>
<FutureDonationDate>0001-01-01T00:00:00</FutureDonationDate>
<NumberOfOccurrences>0</NumberOfOccurrences>
</DonationRecurringInfo>
<GroupId>String</GroupId>
<Memo>String</Memo>
<MetaData xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<d2p1:KeyValueOfstringstring>
<d2p1:Key>String</d2p1:Key>
<d2p1:Value>String</d2p1:Value>
</d2p1:KeyValueOfstringstring>
</MetaData>
<CampaignId>0</CampaignId>
<CardReferenceOrCardNumber>String</CardReferenceOrCardNumber>
<CardType>String</CardType>
<Cvv>String</Cvv>
<DonorInfo>
<Address>String</Address>
<City>String</City>
<EmailAddress>String</EmailAddress>
<FullName>String</FullName>
<Phone>String</Phone>
<PostalCode>String</PostalCode>
<State>String</State>
</DonorInfo>
<ExpirationMonth>0</ExpirationMonth>
<ExpirationYear>0</ExpirationYear>
<MemberInfo>
<BhUserId>0</BhUserId>
</MemberInfo>
</DonationCreditCardRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <DonationCreditCardResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common4.DTO.Donations"> <CardRef>String</CardRef> <ErrorCode>0</ErrorCode> <ErrorMessage>String</ErrorMessage> <IsError>false</IsError> <TransactionId>String</TransactionId> </DonationCreditCardResponse>