com.hps.integrator.fluent.GiftCardDeactivateBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of secure-submit Show documentation
Show all versions of secure-submit Show documentation
The SecureSubmit Java SDK simplifies processing of credit card transactions using Heartland Payment Systems' Portico Payment Gateway
package com.hps.integrator.fluent;
import com.hps.integrator.entities.gift.HpsGiftCard;
import com.hps.integrator.entities.gift.HpsGiftCardResponse;
import com.hps.integrator.infrastructure.Element;
import com.hps.integrator.infrastructure.ElementTree;
import com.hps.integrator.infrastructure.HpsException;
import com.hps.integrator.services.fluent.HpsFluentGiftService;
public class GiftCardDeactivateBuilder extends HpsBuilderAbstract {
HpsGiftCard card;
public GiftCardDeactivateBuilder withCard(HpsGiftCard value) {
this.card = value;
return this;
}
public GiftCardDeactivateBuilder(HpsFluentGiftService service) {
super(service);
}
@Override
public HpsGiftCardResponse execute() throws HpsException {
super.execute();
Element transaction = Et.element("GiftCardBalance");
Element block1 = Et.subElement(transaction, "Block1");
block1.append(service.hydrateGiftCardData(card));
ElementTree response = service.submitTransaction(transaction);
return new HpsGiftCardResponse().fromElementTree(response);
}
@Override
protected void setupValidations() throws HpsException {
this.addValidation(new HpsBuilderValidation("cardIsNotNull", "Card is required."));
}
private boolean cardIsNotNull() { return this.card != null; }
}