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

com.safecharge.request.InitPaymentRequest Maven / Gradle / Ivy

Go to download

SafeCharge’s REST API SDK for Java provides developer tools for accessing Safecharge's REST API. SafeCharge’s REST API is a simple, easy to use, secure and stateless API, which enables online merchants and service providers to process consumer payments through SafeCharge’s payment gateway. The API supports merchants of all levels of PCI certification, from their online and mobile merchant applications, and is compatible with a large variety of payment options, i.e. payment cards, alternative payment methods, etc.

There is a newer version: 1.7.11
Show newest version
package com.safecharge.request;

import javax.validation.ConstraintViolationException;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

import com.safecharge.model.DeviceDetails;
import com.safecharge.model.InitPaymentPaymentOption;
import com.safecharge.model.UrlDetails;
import com.safecharge.model.UserAddress;
import com.safecharge.request.builder.SafechargeBuilder;
import com.safecharge.util.Constants;
import com.safecharge.util.ValidChecksum;
import com.safecharge.util.ValidationUtils;

/**
 * Copyright (C) 2007-2019 SafeCharge International Group Limited.
 * 

* Request for initiation of payment process for transactions. *

*/ @ValidChecksum(orderMappingName = Constants.ChecksumOrderMapping.API_GENERIC_CHECKSUM_MAPPING) public class InitPaymentRequest extends SafechargeRequest { @Size(max = 255, message = "userTokenId size must be up to 255 characters long!") private String userTokenId; @Size(max = 255, message = "clientUniqueId size must be up to 255 characters long!") private String clientUniqueId; /** * The three character ISO currency code. */ @NotNull(message = "currency parameter is mandatory!") private String currency; /** * The transaction amount. */ @NotNull(message = "amount parameter is mandatory!") private String amount; private DeviceDetails deviceDetails; private InitPaymentPaymentOption paymentOption; private UrlDetails urlDetails; @Size(max = 255, message = "customData size must be up to 255 characters long!") private String customData; private UserAddress billingAddress; @Size(max = 255) private String userId; private final String sourceApplication = "JAVA_SDK"; public String getUserTokenId() { return userTokenId; } public void setUserTokenId(String userTokenId) { this.userTokenId = userTokenId; } public String getClientUniqueId() { return clientUniqueId; } public void setClientUniqueId(String clientUniqueId) { this.clientUniqueId = clientUniqueId; } public String getCurrency() { return currency; } public void setCurrency(String currency) { this.currency = currency; } public String getAmount() { return amount; } public void setAmount(String amount) { this.amount = amount; } public DeviceDetails getDeviceDetails() { return deviceDetails; } public void setDeviceDetails(DeviceDetails deviceDetails) { this.deviceDetails = deviceDetails; } public InitPaymentPaymentOption getPaymentOption() { return paymentOption; } public void setPaymentOption(InitPaymentPaymentOption paymentOption) { this.paymentOption = paymentOption; } public UrlDetails getUrlDetails() { return urlDetails; } public void setUrlDetails(UrlDetails urlDetails) { this.urlDetails = urlDetails; } public String getCustomData() { return customData; } public void setCustomData(String customData) { this.customData = customData; } public UserAddress getBillingAddress() { return billingAddress; } public void setBillingAddress(UserAddress billingAddress) { this.billingAddress = billingAddress; } public String getUserId() { return userId; } public void setUserId(String userId) { this.userId = userId; } @Override public String toString() { final StringBuilder sb = new StringBuilder(); sb.append(super.toString()); sb.append(", userTokenId=").append(userTokenId) .append(", clientUniqueId=").append(clientUniqueId) .append(", currency=").append(currency) .append(", amount=").append(amount) .append(", DeviceDetails=").append(deviceDetails) .append(", PaymentOption=").append(paymentOption) .append(", urlDetails=").append(urlDetails) .append(", customData=").append(customData) .append(", billingAddress=").append(billingAddress) .append(", userId=").append(userId); return sb.toString(); } public static Builder builder() { return new Builder(); } public static class Builder extends SafechargeBuilder { private String userTokenId; private String clientUniqueId; private String currency; private String amount; private DeviceDetails deviceDetails; private InitPaymentPaymentOption paymentOption; private UrlDetails urlDetails; private String customData; private UserAddress billingAddress; private String userId; public Builder addUserTokenId(String userTokenId) { this.userTokenId = userTokenId; return this; } public Builder addClientUniqueId(String clientUniqueId) { this.clientUniqueId = clientUniqueId; return this; } public Builder addCurrency(String currency) { this.currency = currency; return this; } public Builder addAmount(String amount) { this.amount = amount; return this; } public Builder addDeviceDetails(DeviceDetails deviceDetails) { this.deviceDetails = deviceDetails; return this; } public Builder addInitPaymentPaymentOption(InitPaymentPaymentOption paymentOption) { this.paymentOption = paymentOption; return this; } public Builder addUrlDetails(UrlDetails urlDetails) { this.urlDetails = urlDetails; return this; } public Builder addCustomData(String customData) { this.customData = customData; return this; } public Builder addBillingAddress(UserAddress billingAddress) { this.billingAddress = billingAddress; return this; } public Builder addUserId(String userId) { this.userId = userId; return this; } @Override public InitPaymentRequest build() throws ConstraintViolationException { InitPaymentRequest request = new InitPaymentRequest(); request.setAmount(amount); request.setBillingAddress(billingAddress); request.setCurrency(currency); request.setCustomData(customData); request.setDeviceDetails(deviceDetails); request.setPaymentOption(paymentOption); request.setUrlDetails(urlDetails); request.setUserTokenId(userTokenId); request.setClientUniqueId(clientUniqueId); request.setUserId(userId); return ValidationUtils.validate(super.build(request)); } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy