com.banxa.model.request.PostRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-sdk Show documentation
Show all versions of java-sdk Show documentation
The Java SDK for integration with Banxa's API
The newest version!
package com.banxa.model.request;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
public abstract class PostRequest implements Request {
@Override
@JsonIgnore
public String getMethod() {
return "POST";
}
@Override
@JsonIgnore
public String getPayload() throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
mapper.setDefaultPropertyInclusion(JsonInclude.Include.NON_NULL);
return mapper.writeValueAsString(this);
}
}