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

io.conekta.PaymentSource Maven / Gradle / Ivy

package io.conekta;

import java.util.HashMap;
import locales.Lang;
import org.json.JSONObject;

/**
 *
 * @author L.Carlos
 */
public class PaymentSource extends Resource{
    public Customer customer;
    public String type;
    public String name;
    public String last4;
    public String bin;
    public String brand;
    public String exp_month;
    public String exp_year;
    public String cvc;
    public Address address;
    public Boolean deleted;
    public Integer expires_at;
    
    @Override
    public String instanceUrl() throws Error {
        if (id == null || id.length() == 0) {
            HashMap parameters = new HashMap();
            parameters.put("RESOURCE", this.getClass().getSimpleName());
            throw new Error(Lang.translate("error.resource.id", parameters, Lang.EN),
                    Lang.translate("error.resource.id_purchaser", parameters, Conekta.locale), null, null, null);
        }
        String base = this.customer.instanceUrl();
        return base + "/payment_sources/" + id;
    }
    
    @Override
    public void update(JSONObject params) throws Error, ErrorList {
        super.update(params);
    }

    public PaymentSource delete() throws Error, ErrorList {
        return ((PaymentSource) this.delete(null, null));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy