CAPI - PT2U
This document guides the developer on how to use CAPI services
to purchase a PT2U. The reader is advised to familiarise
himself/herself with the PT2U process by reading
CReME™-PT2U
before this. This process consists of the following processes:
- Select a Trainer Package
- Input Delivery Address
- Verify Computed Delivery Address
- Proceed to Checkout
The user is also assumed to be familiar with
CAPI - Introduction.
To display the Personal Trainer list, the following request is submitted:
-
Request URI: https://capi.bizt.my:8888/v1/PT2U/ListOfTrainers
-
Body: ChannelKey:CEV75FGS6TA2VMYHF6G9MKV7 (there is no ";" at the end of
the request)
- Response:
[
{
"PersonId": 20012,
"ImageBase64": "/9j/4AAQSkZJRgABAQEBLAEsAAD…[truncated]...PLiCotVpbUi+pzG"
"Fullname": "Guru Twoo",
"Description": "A dedicated fitness trainer with a passion for improving
client health, wellness and quality of life. Deliver high-energy training
using latest techniques in exercise science, cardio programmes and
strength training.\r\nBody transformation specialist adept in helping
diverse populations achieve their fitness, weight loss and conditioning
goals faster than they ever thought possible. ",
"Packages": [
{
"Title": "PT 1",
"Price": 120,
"PackagePersonalTrainerId": 2079361
},
{
"Title": "PT 10",
"Price": 1100,
"PackagePersonalTrainerId": 2079362
}
]
},
{
"PersonId": 20481,
"ImageBase64": "/9j/4AAQSkZJRgABAQEBLAEsAAD/…[truncated]...75mdFBe8D+dWE"
"Fullname": "Guru Ampat ",
"Description": "Personal trainer with 4+ years of health and wellness
experience across multiple fitness centres. Possesses proven track record
in helping clients achieve fitness goals through customised exercise
programmes and diet plans.",
"Packages": [
{
"Title": "PT 10",
"Price": 1100,
"PackagePersonalTrainerId": 2079363
}
]
},
{
"PersonId": 20482,
"ImageBase64":
"/9j/4AAQSkZJRgABAQEBLAEsAAD/…[truncated]...5rhPB+teTY2e4sNoUY/Krj+K"
"Fullname": "Guru Lima ",
"Description": "Energetic and passionate fitness instructor and trainer
with several years of experience teaching one on one classes. Highly
trained and experienced in the areas of Yoga, Pilates, Flexibility
Training and Aerobics.",
"Packages": [
{
"Title": "PT 1",
"Price": 120,
"PackagePersonalTrainerId": 2079364
}
]
}
]
The response consists of an array of trainers. In the above example, there
are 3 Personal Trainers listed. Each Personal Trainer has the following
attributes:
-
PersonId: the unique identifer of the Personal Trainer
-
ImageBase64: this is a very long string of characters. In the example
above, it has been truncated (shortened) showing only the beginning and
end of the string.
- Fullname: Trainer's name
- Description: Description of the trainer
-
Packages: an array of Packages with each package haveing 3 attributes:
- Title
- Price
- PackagePersonalTrainerId
There are two types of Delivery Address:
DeliveryAddressInputted> and
DeliveryAddressComputed>. After the user inputs the Delivery
Address, CReME calculates the distance between that address and the home
club of the member.
-
Request URI: https://capi.bizt.my:8888/v1/PT2U/GetComputedAddress
-
Body: ChannelKey:CEV75FGS6TA2VMYHF6G9MKV7;OtherEmailAddress:member1@bizt.my;DeliveryAddressInputted:Paradigm
Mall Kelana Jaya (there is no ";" at the end of the request)
- Response:
{
"Status": "OK",
"AddressOrigin": "241, Suria KLCC, Kuala Lumpur City Centre, 50088 Kuala
Lumpur, Wilayah Persekutuan Kuala Lumpur, Malaysia",
"AddressDestination": "1, Jalan SS 7/26a, Ss 7, 47301 Petaling Jaya,
Selangor, Malaysia",
"DistanceInKmTo": 21.429,
"DistanceInKmFrom": 23.333,
"TravelDurationInMinutesTo": 28,
"TravelDurationInMinutesFrom": 26
}
The response consists of the following attributes:
-
Status: should be "OK". If not, the user should be asked to re-input the
DeliveryAddressInputted
-
AddressOrigin: the address of the home club of
OtherEmailAddress
-
AddressDestination: the DeliveryAddressComputed which is how
CReME has interpreted the DeliveryAddressInputted. It is
important for the user to verify that CReME has understood the
DeliveryAddressInputted correctly by checking that the
DeliveryAddressComputed is correct.
-
DistanceInKmTo: distance from the home club to the
DeliveryAddressComputed
-
DistanceInKmFrom: distance of the return trip
-
TravelDurationInMinutesTo: estimated travelling time from the home club
to the DeliveryAddressComputed
-
estimated travalling time for the return trip
If the status of the response is "OK", the user can proceed to
Checkout. Checkout can be initiated by issuing the following
request:
-
Request URI: https://capi.bizt.my:8888/v1/PT2U/Checkout
-
Body: ChannelKey:CEV75FGS6TA2VMYHF6G9MKV7;SessionKey:UFJA86JGNPEVZMJ634BGMSAJ;OtherEmailAddress:member1@bizt.my;PackagePersonalTrainerId:2079361;DeliveryAddressInputted:Paradigm
Mall Kelana Jaya;DeliveryAddressComputed:1, Jalan SS 7/26a, Ss 7, 47301
Petaling Jaya, Selangor,
Malaysia;DistanceInKmTo:21.429;DistanceInKmFrom:23.333;TravelDurationInMinutesTo:28;TravelDurationInMinutesFrom:26
" (there is no ";" at the end of the request)
- Response:
{
"Code": "128.50.0",
"Description": "DeliveryCharges successfully calculated",
"Payload": "46.00"
}
A successful response contains "DeliveryCharges successfully calculated"
as the response. Any other response indicates the request failed. The
Payload value is the cost of the Delivery Charges. In this example, it is
RM46.00
There are two types of Delivery Address:
DeliveryAddressInputted> and
DeliveryAddressComputed>. After the user inputs the Delivery
Address, CReME calculates the distance between that address and the home
club of the member.
After "Delivery Charges successfully calculated", the contents of the
Shopping Cart can be read by issuing the following request:
-
Request URI: https://capi.bizt.my:8888/v1/ShoppingCart/Read
-
Body: ChannelKey:CEV75FGS6TA2VMYHF6G9MKV7;SessionKey:UFJA86JGNPEVZMJ634BGMSAJ;eMailAddress:member1@bizt.my
(there is no ";" at the end of the request)
- Response:
[
{
"Selected": true,
"Id": 2079413,
"PackageTitle": "PT 1",
"PriceByCash": 127.2,
"PriceByCreditCard": 127.2,
"PriceByDirectDebit": 127.2,
"PriceByCHIPS": 127.2,
"PriceByCheque": 127.2,
"PriceByFundsTransfer": 127.2,
"TermsAndConditionStatus": null
},
{
"Selected": true,
"Id": 2079414,
"PackageTitle": "Delivery Charges",
"PriceByCash": 46,
"PriceByCreditCard": 46,
"PriceByDirectDebit": 46,
"PriceByCHIPS": 46,
"PriceByCheque": 46,
"PriceByFundsTransfer": 46,
"TermsAndConditionStatus": null
}
]
The above response consists of the following fields:
For further information on how to process the items in Shopping Cart,
please refer to CAPI-Purchase beginning
at https://capi.bizt.my:8888/v1/ShoppingCart/SelectedItems/Value.