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

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

package com.safecharge.request;

import javax.validation.constraints.Size;

import com.safecharge.request.builder.SafechargeOrderBuilder;
import com.safecharge.util.Constants;
import com.safecharge.util.ValidChecksum;
import com.safecharge.util.ValidationUtils;

/**
 * Copyright (C) 2007-2017 SafeCharge International Group Limited.
 *
 * @author Nikola Dichev
 * @see GetOrderDetailsRequest
 * @see OpenOrderRequest
 * @since 2/17/2017
 */
@ValidChecksum(orderMappingName = Constants.ChecksumOrderMapping.API_GENERIC_CHECKSUM_MAPPING)
public class UpdateOrderRequest extends SafechargeOrderDetailsRequest implements SafechargeOrderRequest {

    @Size(max = 45, message = "orderId size must be up to 45 characters long!")
    private String orderId;

    public static Builder builder() {
        return new Builder();
    }

    public String getOrderId() {
        return orderId;
    }

    @Override
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("UpdateOrderRequest{");
        sb.append("orderId='")
                .append(orderId)
                .append('\'');
        sb.append(", ")
                .append(super.toString());
        sb.append('}');
        return sb.toString();
    }

    public static class Builder extends SafechargeOrderBuilder {

        private String orderId;

        public Builder addOrderId(String orderId) {
            this.orderId = orderId;
            return this;
        }

        /**
         * Builds the request.
         *
         * @return {@link SafechargeRequest} object build from the params set by this builder
         */
        @Override
        public SafechargeBaseRequest build() {
            UpdateOrderRequest updateOrderRequest = new UpdateOrderRequest();
            updateOrderRequest.setOrderId(orderId);
            return ValidationUtils.validate(super.build(updateOrderRequest));
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy