Skip to content

Instantly share code, notes, and snippets.

@JaniKibichi
Created June 14, 2019 17:30
Show Gist options
  • Save JaniKibichi/baf0e3e6b98a76b998f39eaaa2057360 to your computer and use it in GitHub Desktop.
Save JaniKibichi/baf0e3e6b98a76b998f39eaaa2057360 to your computer and use it in GitHub Desktop.
MPESA Plain Old Java Object on the HTTP POST Payload
package com.zawadipay.mpesa;
import java.util.Date;
import java.util.HashMap;
public class Mpesa {
private HashMap<String,String> requestMetadata = new HashMap<String,String>(){ { put("merchantId", "merchantId"); } };
private String sourceType="";
private String source="";
private String provider ="";
private String destinationType ="";
private String description="";
private String providerChannel="";
private String direction="";
private String transactionFee="";
private String providerRefId="";
private HashMap<String,String> providerMetadata = new HashMap<String, String>() {{ put("merchantId","merchantId");} };
private String origin="";
private String status="";
private String productName="";
private String category="";
private String transactionDate="";
private String destination="";
private String value="";
private String transactionId="";
private Date createdAt = new Date();
public Mpesa() {}
public Mpesa(HashMap<String, String> requestMetadata, String sourceType, String source, String provider, String destinationType, String description, String providerChannel, String direction, String transactionFee, String providerRefId, HashMap<String, String> providerMetadata, String origin, String status, String productName, String category, String transactionDate, String destination, String value, String transactionId, Date createdAt) {
this.requestMetadata = requestMetadata;
this.sourceType = sourceType;
this.source = source;
this.provider = provider;
this.destinationType = destinationType;
this.description = description;
this.providerChannel = providerChannel;
this.direction = direction;
this.transactionFee = transactionFee;
this.providerRefId = providerRefId;
this.providerMetadata = providerMetadata;
this.origin = origin;
this.status = status;
this.productName = productName;
this.category = category;
this.transactionDate = transactionDate;
this.destination = destination;
this.value = value;
this.transactionId = transactionId;
this.createdAt = createdAt;
}
public HashMap<String, String> getRequestMetadata() {
return requestMetadata;
}
public String getSourceType() {
return sourceType;
}
public String getSource() {
return source;
}
public String getProvider() {
return provider;
}
public String getDestinationType() {
return destinationType;
}
public String getDescription() {
return description;
}
public String getProviderChannel() {
return providerChannel;
}
public String getDirection() {
return direction;
}
public String getTransactionFee() {
return transactionFee;
}
public String getProviderRefId() {
return providerRefId;
}
public HashMap<String, String> getProviderMetadata() {
return providerMetadata;
}
public String getOrigin() {
return origin;
}
public String getStatus() {
return status;
}
public String getProductName() {
return productName;
}
public String getCategory() {
return category;
}
public String getTransactionDate() {
return transactionDate;
}
public String getDestination() {
return destination;
}
public String getValue() {
return value;
}
public String getTransactionId() {
return transactionId;
}
public Date getCreatedAt() {
return createdAt;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment