POST | /sales/agreement/add | Set up a package that will be sold to an existing user | Set 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. |
---|
using System;
using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization;
using ServiceStack;
using ServiceStack.DataAnnotations;
using ClubReady.Web.Api.Sales.Agreement;
using ClubReady.Web.Api;
namespace ClubReady.Web.Api
{
public partial class ApiResponse2Base
{
public virtual bool success { get; set; }
public virtual string message { get; set; }
}
public enum RestrictedResourceType
{
Store,
Chain,
User,
Undefined,
}
}
namespace ClubReady.Web.Api.Sales.Agreement
{
public partial class AddResponse
: ApiResponse2Base
{
public virtual string incompleteAgreementToken { get; set; }
public virtual int? contractId { get; set; }
}
[ApiResponse(Description="", ResponseType=typeof(ClubReady.Web.Api.Sales.Agreement.AddResponse), StatusCode=200)]
public partial class AgreementAddEndpoint
: IAddEndpoint, IRestrictedApiRequest
{
///<summary>
///IP address of the end user
///</summary>
[ApiMember(Description="IP address of the end user", IsRequired=true, Name="X-Forwarded-For", ParameterType="header")]
public virtual string XForwardedFor { get; set; }
///<summary>
///Api Authentication Key
///</summary>
[ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")]
public virtual string ApiKey { get; set; }
///<summary>
///Member Id of the user buying the Package
///</summary>
[ApiMember(Description="Member Id of the user buying the Package", IsRequired=true, ParameterType="query")]
public virtual int MemberId { get; set; }
public virtual int? ChainId { get; set; }
///<summary>
///Id of the store for the user
///</summary>
[ApiMember(Description="Id of the store for the user", IsRequired=true)]
public virtual int? StoreId { get; set; }
///<summary>
///Package Id number of the package being purchased
///</summary>
[ApiMember(Description="Package Id number of the package being purchased", IsRequired=true)]
public virtual int PackageId { get; set; }
///<summary>
///Installment Plan Id being purchased. If empty, the default package will be selected.
///</summary>
[ApiMember(Description="Installment Plan Id being purchased. If empty, the default package will be selected.")]
public virtual int? InstallmentId { get; set; }
///<summary>
///Date contract takes affect
///</summary>
[ApiMember(Description="Date contract takes affect")]
public virtual DateTime? StartDate { get; set; }
///<summary>
///Promo code to apply a discount.
///</summary>
[ApiMember(Description="Promo code to apply a discount.")]
public virtual string PromoCode { get; set; }
///<summary>
///Staff Id of salesperson who sold the agreement.
///</summary>
[ApiMember(Description="Staff Id of salesperson who sold the agreement.")]
public virtual int? StaffId { get; set; }
public virtual int? RestrictedId { get; set; }
public virtual RestrictedResourceType RestrictedResourceType { get; set; }
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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: text/csv
Content-Type: text/csv
Content-Length: length
{"XForwardedFor":"String","ApiKey":"String","MemberId":0,"ChainId":0,"StoreId":0,"PackageId":0,"InstallmentId":0,"StartDate":"0001-01-01T00:00:00.0000000","PromoCode":"String","StaffId":0,"RestrictedId":0,"RestrictedResourceType":"Store"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"incompleteAgreementToken":"String","contractId":0,"success":false,"message":"String"}