Perfect Gym api

Direct debit

This API lets you assign bank account details to a club user.

Assign bank account details to a club user alt text

POST Users/DirectDebit

Request assigns bank account details to existing club user and selects it as current payment method.

Parameters

Name Type Description
userId long Required. User identifier. Request assigns new bank account details to user identified by userId.

Body parameters

Name Type Description
accountNumber string Bank account number (IBAN format).
ownerName string Bank account owner name.
street int Bank account owner street.
cityAndPostalCode int Bank account owner city and zip code.
countrySymbol string Bank account country symbol.
bic string Bank account BIC number.
isPaidByDifferentPerson bool Indicates if contract is paid by other person.

Response

User details including bank account details if operation is successful, or collection of errors with direct debit error codes.

Example request

In this example we assign bank account details to a user with id = 236.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczolkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "countrySymbol": "pl",           
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/DirectDebit?userId=236

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 236,
      "timestamp": 448035,
      "personalId": "80010101234",
      "number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
      "cardNumber": "",
      "firstName": "John",
      "lastName": "Fibo",
      "email": "john.fibo@perfectgym.pl",
      "emailAddressIsConfirmed": false,
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "photoUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Photo?photoId=78",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczółkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "documentUrl": ""
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2016-01-26T00:00:00",
          "startDate": "2016-01-26T00:00:00",
          "cancelDate": "",
          "endDate": "",
          "isCurrent": true,
          "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
            }
          ],
          "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=120",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}

Example error response

Status: 400 Bad Request
{
  "errors": [
    {
      "code": "InvalidIBAN",
      "property": "",
      "message": ""
    }
  ]
}

Execute direct debit agreement signing alt text

POST Users/SignDirectDebit

Request is used to sign direct debit agreement PDF document with a user signature.

Body parameters

Name Type Description
contractId long Contract unique identifier. User has to have valid contract to sign direct debit agreement.
languageCode string Language identifier direct debit agreement should be translated to (for example EN, DE etc.).
signatureData string Signature data base64 encoded.
sourceIp string IP address of client user signs direct debit agreement on.
comment string Contract signing comment

Response

User details including signed direct debit agreement URL.

Example request

In this example we sign direct debit agreement for user with id = 236.


curl -X POST 
     -H "Authorization: Bearer $ACCESS_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
        "contractId": "10358",
        "languageCode": "EN",
        "signatureData": "... signature data ...",  
        "sourceIp": "192.168.1.100",
        "comment": "Sample comment" 
    }' 
    http://yoursubdomain.perfectgym.com/Api/Users/SignDirectDebit

Example response

Status: 200 OK
{
  "elements": [
    {
      "id": 236,
      "timestamp": 448035,
      "personalId": "80010101234",
      "number": "2b7b02df-08ae-4720-a3ce-a594bfc46d47",
      "cardNumber": "",
      "firstName": "John",
      "lastName": "Fibo",
      "email": "john.fibo@perfectgym.pl",
      "emailAddressIsConfirmed": false,
      "phoneNumber": "0048123456789",
      "idCardName": "Passport",
      "idCardNumber": "ABC 123456",
      "legalGuardian": "",
      "photoUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Photo?photoId=78",
      "coverPhotoUrl": "",
      "birthDate": "1978-06-01T00:00:00",
      "isForeigner": false,
      "sex": "Male",
      "newsletterAgreement": false,
      "termsAndConditionsAgreement": false,
      "address": {
        "country": "Poland",
        "city": "Warszawa",
        "postalCode": "02-962",
        "line1": "ul. Przyczolkowa 334",
        "line2": ""
      },
      "directDebit": {
        "accountNumber": "61 1090 1014 0000 0712 1981 2874",
        "ownerName": "John Fibo",
        "street": "Przyczółkowa 334",
        "cityAndPostalCode": "02-962 Warszawa",
        "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=123"
      },
      "homeClubId": 12,
      "registeredAtClubId": "",
      "isActive": true,
      "isDeleted": false,
      "contracts": [
        {
          "id": 10358,
          "timestamp": 350287,
          "signUpDate": "2016-01-26T00:00:00",
          "startDate": "2016-01-26T00:00:00",
          "cancelDate": "",
          "endDate": "",
          "isCurrent": true,
          "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
            }
          ],
          "documentUrl": "http://yoursubdomain.perfectgym.com/Api/Files/Files?fileId=120",
          "isActive": true,
          "isDeleted": false
        }
      ]
    }
  ]
}
Perfect Gym api