| POST | /payfast/webhook/{PublicAccessGuid} |
|---|
import 'package:servicestack/servicestack.dart';
import 'dart:collection';
class PayFastWebHook implements IConvertible
{
// @DataMember(Name="m_payment_id")
String? m_payment_id;
// @DataMember(Name="pf_payment_id")
String? pf_payment_id;
// @DataMember(Name="payment_status")
String? payment_status;
// @DataMember(Name="item_name")
String? item_name;
// @DataMember(Name="item_description")
String? item_description;
// @DataMember(Name="amount_gross")
double? amount_gross;
// @DataMember(Name="amount_fee")
double? amount_fee;
// @DataMember(Name="amount_net")
double? amount_net;
// @DataMember(Name="custom_str1")
String? custom_str1;
// @DataMember(Name="custom_str2")
String? custom_str2;
// @DataMember(Name="custom_str3")
String? custom_str3;
// @DataMember(Name="custom_str4")
String? custom_str4;
// @DataMember(Name="custom_str5")
String? custom_str5;
// @DataMember(Name="custom_int1")
int? custom_int1;
// @DataMember(Name="custom_int2")
int? custom_int2;
// @DataMember(Name="custom_int3")
int? custom_int3;
// @DataMember(Name="custom_int4")
int? custom_int4;
// @DataMember(Name="custom_int5")
int? custom_int5;
// @DataMember(Name="name_first")
String? name_first;
// @DataMember(Name="name_last")
String? name_last;
// @DataMember(Name="email_address")
String? email_address;
// @DataMember(Name="merchant_id")
String? merchant_id;
// @DataMember(Name="signature")
String? signature;
// @DataMember(Name="token")
String? token;
// @DataMember(Name="billing_date")
DateTime? billing_date;
String? PublicAccessGuid;
bool? Sandbox;
PayFastWebHook({this.m_payment_id,this.pf_payment_id,this.payment_status,this.item_name,this.item_description,this.amount_gross,this.amount_fee,this.amount_net,this.custom_str1,this.custom_str2,this.custom_str3,this.custom_str4,this.custom_str5,this.custom_int1,this.custom_int2,this.custom_int3,this.custom_int4,this.custom_int5,this.name_first,this.name_last,this.email_address,this.merchant_id,this.signature,this.token,this.billing_date,this.PublicAccessGuid,this.Sandbox});
PayFastWebHook.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
m_payment_id = json['MPaymentId'];
pf_payment_id = json['PfPaymentId'];
payment_status = json['PaymentStatus'];
item_name = json['ItemName'];
item_description = json['ItemDescription'];
amount_gross = JsonConverters.toDouble(json['AmountGross']);
amount_fee = JsonConverters.toDouble(json['AmountFee']);
amount_net = JsonConverters.toDouble(json['AmountNet']);
custom_str1 = json['CustomStr1'];
custom_str2 = json['CustomStr2'];
custom_str3 = json['CustomStr3'];
custom_str4 = json['CustomStr4'];
custom_str5 = json['CustomStr5'];
custom_int1 = json['CustomInt1'];
custom_int2 = json['CustomInt2'];
custom_int3 = json['CustomInt3'];
custom_int4 = json['CustomInt4'];
custom_int5 = json['CustomInt5'];
name_first = json['NameFirst'];
name_last = json['NameLast'];
email_address = json['EmailAddress'];
merchant_id = json['MerchantId'];
signature = json['Signature'];
token = json['Token'];
billing_date = JsonConverters.fromJson(json['BillingDate'],'DateTime',context!);
PublicAccessGuid = json['PublicAccessGuid'];
Sandbox = json['Sandbox'];
return this;
}
Map<String, dynamic> toJson() => {
'm_payment_id': m_payment_id,
'pf_payment_id': pf_payment_id,
'payment_status': payment_status,
'item_name': item_name,
'item_description': item_description,
'amount_gross': amount_gross,
'amount_fee': amount_fee,
'amount_net': amount_net,
'custom_str1': custom_str1,
'custom_str2': custom_str2,
'custom_str3': custom_str3,
'custom_str4': custom_str4,
'custom_str5': custom_str5,
'custom_int1': custom_int1,
'custom_int2': custom_int2,
'custom_int3': custom_int3,
'custom_int4': custom_int4,
'custom_int5': custom_int5,
'name_first': name_first,
'name_last': name_last,
'email_address': email_address,
'merchant_id': merchant_id,
'signature': signature,
'token': token,
'billing_date': JsonConverters.toJson(billing_date,'DateTime',context!),
'PublicAccessGuid': PublicAccessGuid,
'Sandbox': Sandbox
};
getTypeName() => "PayFastWebHook";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'duengageapi.uat.scadsoftware.com', types: <String, TypeInfo> {
'PayFastWebHook': TypeInfo(TypeOf.Class, create:() => PayFastWebHook()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /payfast/webhook/{PublicAccessGuid} HTTP/1.1
Host: duengageapi.uat.scadsoftware.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
m_payment_id: String,
pf_payment_id: String,
payment_status: String,
item_name: String,
item_description: String,
amount_gross: 0,
amount_fee: 0,
amount_net: 0,
custom_str1: String,
custom_str2: String,
custom_str3: String,
custom_str4: String,
custom_str5: String,
custom_int1: 0,
custom_int2: 0,
custom_int3: 0,
custom_int4: 0,
custom_int5: 0,
name_first: String,
name_last: String,
email_address: String,
merchant_id: String,
signature: String,
token: String,
billing_date: 0001-01-01,
PublicAccessGuid: 00000000000000000000000000000000,
Sandbox: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
}