| POST | /api/creditcard/createcardref | Creates, records and returns a 'cardRef' | Creates, records and returns a 'reference' to a credit card. This so called 'cardRef' can then be usedas an alternative value to pass to other credit card transactions such as Verfy or Sale potentially improving securityby not passing card numbers. |
|---|
import 'package:servicestack/servicestack.dart';
class CreditCardCloudServiceResponse implements IHaveErrorField, IConvertible
{
bool? IsDuplicate;
bool? IsSuccessful;
String? ErrorCode;
String? Message;
int? GatewayId;
String? ConfirmationNumber;
String? NetworkTransactionId;
bool? IsError;
CreditCardCloudServiceResponse({this.IsDuplicate,this.IsSuccessful,this.ErrorCode,this.Message,this.GatewayId,this.ConfirmationNumber,this.NetworkTransactionId,this.IsError});
CreditCardCloudServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
IsDuplicate = json['IsDuplicate'];
IsSuccessful = json['IsSuccessful'];
ErrorCode = json['ErrorCode'];
Message = json['Message'];
GatewayId = json['GatewayId'];
ConfirmationNumber = json['ConfirmationNumber'];
NetworkTransactionId = json['NetworkTransactionId'];
IsError = json['IsError'];
return this;
}
Map<String, dynamic> toJson() => {
'IsDuplicate': IsDuplicate,
'IsSuccessful': IsSuccessful,
'ErrorCode': ErrorCode,
'Message': Message,
'GatewayId': GatewayId,
'ConfirmationNumber': ConfirmationNumber,
'NetworkTransactionId': NetworkTransactionId,
'IsError': IsError
};
getTypeName() => "CreditCardCloudServiceResponse";
TypeContext? context = _ctx;
}
class CreditCardType
{
static const CreditCardType AmericanExpress = const CreditCardType._(0);
static const CreditCardType Discover = const CreditCardType._(1);
static const CreditCardType MasterCard = const CreditCardType._(2);
static const CreditCardType Visa = const CreditCardType._(3);
static const CreditCardType DinersClub = const CreditCardType._(4);
static const CreditCardType DinersCartBlanche = const CreditCardType._(5);
static const CreditCardType Unknown = const CreditCardType._(6);
final int _value;
const CreditCardType._(this._value);
int get value => _value;
static List<CreditCardType> get values => const [AmericanExpress,Discover,MasterCard,Visa,DinersClub,DinersCartBlanche,Unknown];
}
class CreateCardRefResponse extends CreditCardCloudServiceResponse implements IConvertible
{
String? CardRef;
CreditCardType? CardType;
CreateCardRefResponse({this.CardRef,this.CardType});
CreateCardRefResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
CardRef = json['CardRef'];
CardType = JsonConverters.fromJson(json['CardType'],'CreditCardType',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'CardRef': CardRef,
'CardType': JsonConverters.toJson(CardType,'CreditCardType',context!)
});
getTypeName() => "CreateCardRefResponse";
TypeContext? context = _ctx;
}
class CreateCardRef extends CreateCardRef implements IConvertible
{
CreateCardRef();
CreateCardRef.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() => "CreateCardRef";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'devapi.billhighway.com', types: <String, TypeInfo> {
'CreditCardCloudServiceResponse': TypeInfo(TypeOf.Class, create:() => CreditCardCloudServiceResponse()),
'CreditCardType': TypeInfo(TypeOf.Enum, enumValues:CreditCardType.values),
'CreateCardRefResponse': TypeInfo(TypeOf.Class, create:() => CreateCardRefResponse()),
'CreateCardRef': TypeInfo(TypeOf.Class, create:() => CreateCardRef()),
});
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 /api/creditcard/createcardref HTTP/1.1
Host: devapi.billhighway.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateCardRef xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://www.billhighway.com/api">
<CardNumber xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">String</CardNumber>
<CardType xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">AmericanExpress</CardType>
<CurrencyCode xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">String</CurrencyCode>
<ExpirationMonth xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">0</ExpirationMonth>
<ExpirationYear xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">0</ExpirationYear>
<GroupId xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">0</GroupId>
<Location xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">String</Location>
<NameOnCard xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">String</NameOnCard>
<UserId xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">0</UserId>
<ValidationNum xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO">String</ValidationNum>
</CreateCardRef>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateCardRefResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BH.CloudAPI.Common.DTO"> <ConfirmationNumber>String</ConfirmationNumber> <ErrorCode>String</ErrorCode> <GatewayId>0</GatewayId> <IsDuplicate>false</IsDuplicate> <IsSuccessful>false</IsSuccessful> <Message>String</Message> <NetworkTransactionId>String</NetworkTransactionId> <CardRef>String</CardRef> <CardType>AmericanExpress</CardType> </CreateCardRefResponse>