All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.konduto.sdk.adapters.KondutoBoletoPaymentSerializer Maven / Gradle / Ivy

Go to download

Easily integrate with Konduto (https://konduto.com), a fraud prevention service.

There is a newer version: 2.17.4
Show newest version
package com.konduto.sdk.adapters;

import com.google.gson.JsonObject;
import com.konduto.sdk.models.KondutoBoletoPayment;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by rsampaio on 9/8/16.
 *
 * Serializes a boleto payment.
 * Note the expiration date formatting.
 */
public class KondutoBoletoPaymentSerializer extends KondutoPaymentSerializer {
    public JsonObject completeSerialization(JsonObject paymentAsJson, KondutoBoletoPayment boletoPayment) {
        Date expirationDate = boletoPayment.getExpirationDate();
        if(expirationDate == null) { return paymentAsJson; }
        SimpleDateFormat boletoDateFormat = new SimpleDateFormat("yyyy-MM-dd");
        paymentAsJson.addProperty("expiration_date", boletoDateFormat.format(expirationDate));
        return paymentAsJson;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy