ClubReady Api

<back to all web services

AgreementAddEndpoint

The following routes are available for this service:
POST/sales/agreement/addSet up a package that will be sold to an existing userSet up a package that will be sold to an existing user. The PaymentMethods property is an array of objects describing how you want ClubReady to take payment while selling the PackageId/InstallmentPlanId. If omitted (or null), the preferred on-file profile will be used. The header `X-Forwarded-For` is required and should be set to the IP address of the end user.
import java.math.*;
import java.util.*;
import net.servicestack.client.*;

public class dtos
{

    @ApiResponse(Description="", ResponseType=AddResponse.class, StatusCode=200)
    public static class AgreementAddEndpoint implements IAddEndpoint, IRestrictedApiRequest
    {
        /**
        * IP address of the end user
        */
        @ApiMember(Description="IP address of the end user", IsRequired=true, Name="X-Forwarded-For", ParameterType="header")
        public String XForwardedFor = null;

        /**
        * Api Authentication Key
        */
        @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
        public String ApiKey = null;

        /**
        * Member Id of the user buying the Package
        */
        @ApiMember(Description="Member Id of the user buying the Package", IsRequired=true, ParameterType="query")
        public Integer MemberId = null;

        public Integer ChainId = null;
        /**
        * Id of the store for the user
        */
        @ApiMember(Description="Id of the store for the user", IsRequired=true)
        public Integer StoreId = null;

        /**
        * Package Id number of the package being purchased
        */
        @ApiMember(Description="Package Id number of the package being purchased", IsRequired=true)
        public Integer PackageId = null;

        /**
        * Installment Plan Id being purchased. If empty, the default package will be selected.
        */
        @ApiMember(Description="Installment Plan Id being purchased. If empty, the default package will be selected.")
        public Integer InstallmentId = null;

        /**
        * Date contract takes affect
        */
        @ApiMember(Description="Date contract takes affect")
        public Date StartDate = null;

        /**
        * Promo code to apply a discount.
        */
        @ApiMember(Description="Promo code to apply a discount.")
        public String PromoCode = null;

        /**
        * Staff Id of salesperson who sold the agreement.
        */
        @ApiMember(Description="Staff Id of salesperson who sold the agreement.")
        public Integer StaffId = null;

        public Integer RestrictedId = null;
        public RestrictedResourceType RestrictedResourceType = null;
        
        public String getXForwardedFor() { return XForwardedFor; }
        public AgreementAddEndpoint setXForwardedFor(String value) { this.XForwardedFor = value; return this; }
        public String getApiKey() { return ApiKey; }
        public AgreementAddEndpoint setApiKey(String value) { this.ApiKey = value; return this; }
        public Integer getMemberId() { return MemberId; }
        public AgreementAddEndpoint setMemberId(Integer value) { this.MemberId = value; return this; }
        public Integer getChainId() { return ChainId; }
        public AgreementAddEndpoint setChainId(Integer value) { this.ChainId = value; return this; }
        public Integer getStoreId() { return StoreId; }
        public AgreementAddEndpoint setStoreId(Integer value) { this.StoreId = value; return this; }
        public Integer getPackageId() { return PackageId; }
        public AgreementAddEndpoint setPackageId(Integer value) { this.PackageId = value; return this; }
        public Integer getInstallmentId() { return InstallmentId; }
        public AgreementAddEndpoint setInstallmentId(Integer value) { this.InstallmentId = value; return this; }
        public Date getStartDate() { return StartDate; }
        public AgreementAddEndpoint setStartDate(Date value) { this.StartDate = value; return this; }
        public String getPromoCode() { return PromoCode; }
        public AgreementAddEndpoint setPromoCode(String value) { this.PromoCode = value; return this; }
        public Integer getStaffId() { return StaffId; }
        public AgreementAddEndpoint setStaffId(Integer value) { this.StaffId = value; return this; }
        public Integer getRestrictedId() { return RestrictedId; }
        public AgreementAddEndpoint setRestrictedId(Integer value) { this.RestrictedId = value; return this; }
        public RestrictedResourceType getRestrictedResourceType() { return RestrictedResourceType; }
        public AgreementAddEndpoint setRestrictedResourceType(RestrictedResourceType value) { this.RestrictedResourceType = value; return this; }
    }

    public static enum RestrictedResourceType
    {
        Store,
        Chain,
        User,
        Undefined;
    }

    public static class AddResponse extends ApiResponse2Base
    {
        public String incompleteAgreementToken = null;
        public Integer contractId = null;
        
        public String getIncompleteAgreementToken() { return incompleteAgreementToken; }
        public AddResponse setIncompleteAgreementToken(String value) { this.incompleteAgreementToken = value; return this; }
        public Integer getContractId() { return contractId; }
        public AddResponse setContractId(Integer value) { this.contractId = value; return this; }
    }

    public static class ApiResponse2Base
    {
        public Boolean success = null;
        public String message = null;
        
        public Boolean isSuccess() { return success; }
        public ApiResponse2Base setSuccess(Boolean value) { this.success = value; return this; }
        public String getMessage() { return message; }
        public ApiResponse2Base setMessage(String value) { this.message = value; return this; }
    }

}

Java AgreementAddEndpoint DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /sales/agreement/add HTTP/1.1 
Host: www.clubready.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<AgreementAddEndpoint xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Agreement">
  <ApiKey>String</ApiKey>
  <ChainId>0</ChainId>
  <InstallmentId>0</InstallmentId>
  <MemberId>0</MemberId>
  <PackageId>0</PackageId>
  <PromoCode>String</PromoCode>
  <StaffId>0</StaffId>
  <StartDate>0001-01-01T00:00:00</StartDate>
  <StoreId>0</StoreId>
  <XForwardedFor>String</XForwardedFor>
</AgreementAddEndpoint>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AddResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Agreement">
  <message xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api">String</message>
  <success xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api">false</success>
  <contractId>0</contractId>
  <incompleteAgreementToken>String</incompleteAgreementToken>
</AddResponse>