Perfect Gym api

Contract freezing

This API lets you freeze user contract.

Execute contract freeze alt text

POST Contracts/Freeze

Request freezes user contract.

Parameters

Name Type Description
contractId long Required. Identifier of a contract to be frozen.

Body parameters

Name Type Description
freezeTypeId long Freeze type to be applied identifier.
reasonId long Freeze reason identifier.
startDate string Requested freeze start date.
endDate string Requested freeze end date.

Response

Contract details if freeze is successful, or collection of errors with freeze error codes otherwise.

Example request

In this example we freeze contract with id = 10358 using freeze type with id = 7. Contract will be suspended from 2016-04-01 till 2016-04-07


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
            "freezeTypeId":7,
            "reasonId": 1,
            "startDate": "2016-04-01T00:00:00",
            "endDate": "2016-04-07T00:00:00"        
    }' 
    http://yoursubdomain.perfectgym.com/Api/Contracts/Freeze?contractId=10358

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 10358,
      "timestamp": 350287,
      "signUpDate": "2016-01-26T00:00:00",
      "startDate": "2016-01-26T00:00:00",
      "cancelDate": "",
      "endDate": "",
      "membership": {
        "id": 1,
        "timestamp": 349423,
        "name": "Open",
        "isActive": true,
        "isDeleted": false
      },
      "paymentPlan": {
        "id": 44,
        "timestamp": 447623,
        "name": "Open 24m",
        "isActive": true,
        "isAddOnPaymentPlan": false,
        "isDeleted": false
      },
      "discounts": [
        {
          "id": 10,
          "isActive": true,
          "name": "50%",
          "administartionFeeDiscountType": "ValueDiscount",
          "joiningFeeDiscountType": "None",
          "membershipFeeDiscountType": "PercentDiscount",
          "administartionFeeDiscountValue": 0,
          "joiningFeeDiscountValue": "",
          "membershipFeeDiscountValue": 50
        }
      ],
      "freezes": [
        {
          "startDate": "2016-04-01T00:00:00",
          "endDate": "2016-04-07T23:59:59",
          "fee": 1,
          "status": "NotStarted",
          "reason": {
            "id": 1,
            "name": "Holiday"
          },
          "type": {
            "name": "Daily Freeze",
            "isActive": true,
            "fixedFee": 1,
            "administrationFee": 25,
            "freezePeriod": "Day",
            "minimumInterval": 2,
            "maximumInterval": 8,
            "id": 7,
            "timestamp": 0,
            "isDeleted": false
          },
          "id": 175,
          "timestamp": 692507,
          "isDeleted": false
        }
      ],
      "status": "Current",
      "isCurrent": true,
      "isActive": true,
      "isDeleted": false
    }
  ]
}

Example error response

Freeze time range greater then freeze type maximumInterval generates following error:

Status: 400 Bad Request
{
  "errors ": [
    {
      "message": "Freeze only for 2 - 8 days, not 13",
      "property": "",
      "code": "InvalidFreezeParameters"
    }
  ]
}
Perfect Gym api