PatronProxy

public class PatronProxy

Class to manage all Ticketing SDK

  • Success data handler for any request

    • Response: Data callback

    Declaration

    Swift

    public typealias SuccessDataHandler = ((_ responseObject: Data?) -> Void)
  • Success handler with JSON object callback

    • Response: JSON data callback

    Declaration

    Swift

    public typealias SuccessHandler = ((_ responseObject: [String : Any]?) -> Void)
  • Failure handler

    • Response: Error callback

    Declaration

    Swift

    public typealias FailureHandler = ((_ error: Error) -> Void)
  • Check internet status

    Declaration

    Swift

    public var isReachable: Bool { get }
  • Current logged in token This token will be get from patron login The token session management will be done by BO through expire status

    Declaration

    Swift

    public var currentToken: String { get }

CONSTRUCTOR

APP VERSIONS

PATRON

  • Send a request to the Patron API that will activate a user.

    Declaration

    Swift

    public func patronActivate(activateToken: String, patronActivateCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    activateToken

    This token will be received from Deep link

  • Send a request to the Patron API that creates a token. This API is call at first in order to invoke next one


    Sample response: { “token_type”: “Bearer”, “expires_in”: 31622400, “access_token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IjcxNTBmYjllODdjNmY1YTUzYWUyY2QyM2Y5ZjlhYWExMDc5ZDU1YWMzY2FlY2E4YWM5ZDFjYjg0M2I0NzdiZjQwYTUwZjU3ZjNiNGJiM2NhIn0.eyJhdWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDIiLCJqdGkiOiI3MTUwZmI5ZTg3YzZmNWE1M2FlMmNkMjNmOWY5YWFhMTA3OWQ1NWFjM2NhZWNhOGFjOWQxY2I4NDNiNDc3YmY0MGE1MGY1N2YzYjRiYjNjYSIsImlhdCI6MTU1NTkyMzQyNCwibmJmIjoxNTU1OTIzNDI0LCJleHAiOjE1ODc1NDU4MjQsInN1YiI6IiIsInNjb3BlcyI6WyJtb2JpbGUiXX0.ZuPYh_Kd5qdJQEgjMcEjsuxQUr9HDIbjPKHbXAULt472jdpUliyM9skKkfAno6qeJyA0OeVdOvyh16Exvt_YhUSljZ7wOic8KUI2WAhUwOwdE7BKVSAG5ajRy9xoVzfXgcFrq8Oqo2uS6tJhET9YoNHHo_4WwSG5I4GS4lN_NryFT96pV79KtHtIQCOgxX-bsLcTzDpOZGktXG6iDqsikdOdumkFkiRfIlh1RUS63K3yEJyD2zUJoZv0KDIJFO8CdunIAaGXMZHuQJ5x8CplL1nLa-F0_zfPkIn0sE_HFk95qUxX3jUZfUE3iQQmcQgGsgVLPYOm09wZ9VRZh9Hjt3a3uJIsX8AOa5cMYnI9w6A91n6B23ypLMuGBf2VHKUfcjn4gso5G694iZKX9kz2abAjsRozEiCkYPgT6pSNVoayFD4qprk7VKX8aQumwjaofP0_WfusSg0ruwadhZ1WbiHfDCqbIFI_NzMf_LGgEM79Bcc7eaM2ME55nQFIs6HbnREq9qlBhsNr7R1fKsqwHNY-JxQSpQsfnujVPuY2ly_JB9C4UCOdffjRqn6hgUlqimn7DgcvPqGNfezd2Fuq5c77aTmUm-2LUqZfDdCFvVQYYpi-UIMX8yBvMRTGs4wqICN4Zozg5pZo-lqpdx6MA15AbnalPyGZZBkN9EUhCrQ” }, “refresh_token”: “def50200383ef381596ed9f12e798a6741b396831d6fed712fc2de00abf682cf72f72f1063636bc3c52a2af3c2798d5312c92495d6ce32395f97f4c0b09f037a309ca712c2525ca1dd6d4740b63a57acf725e7c1dae591a09e66520cfd739c0649dab509d08e0e5727d312fa0c9ed676b78447042602d4d7bd910d8d0c3bb9007cb60dd11158aed4427b75b0a5f060de09ff04b4661568cd8ce8df6c55bc2a0f56c4e6fe018cbd15e571e4c5d92f3fd81eeda5af3b5ff177bfae4577a47e7f02e758390e08f117a156b4e54d8d6917c29c06fd916b4fddb56160864bcb57b0209131d76c60fff79c22a50f3dda2949a126731c444dddc8ab83436b2d7be13466ae0a158065d27d6b1daf03054e7166907ce516655848bceee346e8ccdb6628b24689b0843e92258246604fcdf043066ac5148039f00dfce03dbf4bf2f324540312c2c1c4873e7172c19ccf19344421a21687292a8b4b294e66a9c1450b179f039a0fde647c62e4f39588968ad00cc017fc8f7bd3c07b426faa11b58591793a562b44988153”


    The token will be collect as:

    Declaration

    Swift

    public func refreshToken(_ refreshToken: String, successCallback: @escaping (MKToken?) -> (), failure: FailureHandler?)

    Parameters

    refresh_token

    the the token for refresh

    clientId

    the client id - fixed one

    clientSecret

    The secret id - fixed one

    grant_type

    refresh_token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that creates a patron (user). This API is involve after mobile login

    Sample response: { “data”: { “id”: 19, “client_id”: 1, “name”: null, “email”: “ext-dang.than1@flowbird.group”, “phone”: null, “birthday”: null, “company_name”: null, “company_employee_id”: null, “patron_status_id”: 1, “pin”: null, “created_at”: “2019-04-22 08:58:27”, “updated_at”: “2019-04-22 08:58:27” } }

    Declaration

    Swift

    public func createPatron(email: String, password: String, profileCallback: @escaping (Patron?) -> (), failure: FailureHandler?)

    Parameters

    email

    user email

    password

    user password - This point can be secured

    token

    token response from mobile login API

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that request a login session. This API is to login and get user info


    Sample response: { “token_type”: “Bearer”, “expires_in”: 31622400, “access_token”: “eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImRkNmM5NzcyZGExODE3Nzk1NmVmNzBjZTcyMWM5ZmE0ZGMzNGI1ZGQyNjk1NDkzYTMwOTlmNGM1YTQ5MzkzMDNmNDI4ZDk2M2U1MmE3Y2VhIn0.eyJhdWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDIiLCJqdGkiOiJkZDZjOTc3MmRhMTgxNzc5NTZlZjcwY2U3MjFjOWZhNGRjMzRiNWRkMjY5NTQ5M2EzMDk5ZjRjNWE0OTM5MzAzZjQyOGQ5NjNlNTJhN2NlYSIsImlhdCI6MTU1NTkyNDUzNCwibmJmIjoxNTU1OTI0NTM0LCJleHAiOjE1ODc1NDY5MzQsInN1YiI6IjEyIiwic2NvcGVzIjpbXX0.hqbRb6W4eA1skvItaRjUj7vnNBVnkDvvsDVPuu3K1vF74uCHRRvlSTWv3me8OyFudL-7KVUmeR_PajjziKItb4JTsGupGMNaPr6p3NKxf_UN_SDhwD8a-0UVxZXurgIpdvOVCu2vwSWBz_ofw91XFNipFzzgTejjbB4UK9DH3MXOtTiMJLUaNgpaS7NV9XDYim9YiGL0tCIOWxMN3W2k9cW5lZE3rN6sK_H5mlYPDxk1ZWjpJ2ECDHoTXKs-Q_I75hjoFb-W_zTWH_P5mjvS2adP77GRVZfcvwt3F6oI0_BTJPmiYyumc_tNwQARaDknNcoUk2wBUnP_Ks88k797DSzc6EIO5hNhX-ZWu2C7pum5TebH1nkYpL0IpjTOho0XjZ0NlnAIYBhksjebjUIA2BTZYQr883cVw7PDYfGI9zrJF-B1M2p86E-TJsh-DXsot71niXnR9JG0kmYQjPvg9ALLIKxmwhA7fyYlDtMycq0jTolbLmyDuV0PNz1wzN4fnWpqV-C0LYaQooaVPA6VIHwecd1bDU3KHEHS5b8Qdzyo8aykGUj6VI-CEh6Jcp-0-cuk__kxoJBS5bG8pGrWrhde15Hhl2WKaReqdfyJTd74j9Nt0U08TBUAbUnqVXk90SzuM8OKqf1Ku_jpcTEDMKURg-zhEg8bX91L3CZqprE”, “refresh_token”: “def50200383ef381596ed9f12e798a6741b396831d6fed712fc2de00abf682cf72f72f1063636bc3c52a2af3c2798d5312c92495d6ce32395f97f4c0b09f037a309ca712c2525ca1dd6d4740b63a57acf725e7c1dae591a09e66520cfd739c0649dab509d08e0e5727d312fa0c9ed676b78447042602d4d7bd910d8d0c3bb9007cb60dd11158aed4427b75b0a5f060de09ff04b4661568cd8ce8df6c55bc2a0f56c4e6fe018cbd15e571e4c5d92f3fd81eeda5af3b5ff177bfae4577a47e7f02e758390e08f117a156b4e54d8d6917c29c06fd916b4fddb56160864bcb57b0209131d76c60fff79c22a50f3dda2949a126731c444dddc8ab83436b2d7be13466ae0a158065d27d6b1daf03054e7166907ce516655848bceee346e8ccdb6628b24689b0843e92258246604fcdf043066ac5148039f00dfce03dbf4bf2f324540312c2c1c4873e7172c19ccf19344421a21687292a8b4b294e66a9c1450b179f039a0fde647c62e4f39588968ad00cc017fc8f7bd3c07b426faa11b58591793a562b44988153” }


    The expected behavior in this case is to get token. In order to use for different API as Auth, we need to combine token to following format: Example: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6ImRkNmM5NzcyZGExODE3Nzk1NmVmNzBjZTcyMWM5ZmE0ZGMzNGI1ZGQyNjk1NDkzYTMwOTlmNGM1YTQ5MzkzMDNmNDI4ZDk2M2U1MmE3Y2VhIn0.eyJhdWQiOiIwMDAwMDAwMC0wMDAwLTAwMDAtMDAwMC0wMDAwMDAwMDAwMDIiLCJqdGkiOiJkZDZjOTc3MmRhMTgxNzc5NTZlZjcwY2U3MjFjOWZhNGRjMzRiNWRkMjY5NTQ5M2EzMDk5ZjRjNWE0OTM5MzAzZjQyOGQ5NjNlNTJhN2NlYSIsImlhdCI6MTU1NTkyNDUzNCwibmJmIjoxNTU1OTI0NTM0LCJleHAiOjE1ODc1NDY5MzQsInN1YiI6IjEyIiwic2NvcGVzIjpbXX0.hqbRb6W4eA1skvItaRjUj7vnNBVnkDvvsDVPuu3K1vF74uCHRRvlSTWv3me8OyFudL-7KVUmeR_PajjziKItb4JTsGupGMNaPr6p3NKxf_UN_SDhwD8a-0UVxZXurgIpdvOVCu2vwSWBz_ofw91XFNipFzzgTejjbB4UK9DH3MXOtTiMJLUaNgpaS7NV9XDYim9YiGL0tCIOWxMN3W2k9cW5lZE3rN6sK_H5mlYPDxk1ZWjpJ2ECDHoTXKs-Q_I75hjoFb-W_zTWH_P5mjvS2adP77GRVZfcvwt3F6oI0_BTJPmiYyumc_tNwQARaDknNcoUk2wBUnP_Ks88k797DSzc6EIO5hNhX-ZWu2C7pum5TebH1nkYpL0IpjTOho0XjZ0NlnAIYBhksjebjUIA2BTZYQr883cVw7PDYfGI9zrJF-B1M2p86E-TJsh-DXsot71niXnR9JG0kmYQjPvg9ALLIKxmwhA7fyYlDtMycq0jTolbLmyDuV0PNz1wzN4fnWpqV-C0LYaQooaVPA6VIHwecd1bDU3KHEHS5b8Qdzyo8aykGUj6VI-CEh6Jcp-0-cuk__kxoJBS5bG8pGrWrhde15Hhl2WKaReqdfyJTd74j9Nt0U08TBUAbUnqVXk90SzuM8OKqf1Ku_jpcTEDMKURg-zhEg8bX91L3CZqprE


    We also need to handle the expires time. Here is the flow: In case of unauth(401) for every request, we need to kick user out in order to re-authenticate


    Declaration

    Swift

    public func patronLogin(username: String, password: String, success: @escaping (MKToken?) -> (), failure: FailureHandler?)

    Parameters

    username

    user email

    password

    user password - This point can be secured

    callback

    Callback executed after the request end.

PATRON INFO

  • Send a request to the Patron API that update patron password.


    Sample response:


    Declaration

    Swift

    public func updatePassword(token: String? = nil, currentPassword: String, newPassword: String, profileCallback: @escaping (Patron?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    label

    card label we would edit

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that update phatron phone nunber


    Sample response:


    Declaration

    Swift

    public func updatePhone(token: String? = nil, phoneCode: String, phone: String, profileCallback: @escaping (Patron?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    label

    card label we would edit

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that update PIN for patron


    Sample response:


    Declaration

    Swift

    public func updatePin(token: String? = nil, pin: String, profileCallback: @escaping (Patron?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    label

    card label we would edit

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that Update patron info


    Sample response:


    Declaration

    Swift

    public func updatePatron(token: String? = nil, patron: Patron, profileCallback: @escaping (Patron?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    patron

    Patron info data

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to delete patron.


    Sample response:


    Declaration

    Swift

    public func deletePatron(token: String? = nil, password: String, success: SuccessHandler?, failure: FailureHandler?)

    Parameters

    token

    user current login token

    password

    The password for confirmation

    success

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to reset the patron’s password.


    Sample response:


    Declaration

    Swift

    public func resetPatronPassword(email: String, patronActivateCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    email

    Email of the patron

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get transaction histories.


    Sample response:


    Declaration

    Swift

    public func updatePatronPassword(password: String, forgotPwdToken: String, patronActivateCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    Id of the media

    callback

    Callback executed after the request end.

WALLETS AND TICKETS

  • Send a request to the Patron API that request tickets list. =


    Sample response: { “data”: [ { “number”: 5966215829816894, “secret”: null, “balance”: “$0.00”, “ticket_status_id”: 1, “ticket_status_name”: “Unassigned”, “ticket_type_id”: 3, “ticket_type_name”: “Digital”, “client_id”: 1, “patron_id”: null, “linked_patron_id”: null, “device_id”: null, “external_number”: null, “batch_number”: null, “roll_number”: null, “activated_date”: null, “expired_date”: null, “auto_refill_threshold”: null, “auto_refill_amount”: null }, { … }, { … }, { … } ] }


    Declaration

    Swift

    public func getTickets(token: String? = nil, ticketsCallback: @escaping ([Ticket]) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get details of a ticket.


    Sample response:


    Declaration

    Swift

    public func getTicket(token: String? = nil, mediaId: String, ticketCallback: @escaping (Ticket?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    Id of the ticket

    ticketCallback

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API that request a Tickets list. =


    Sample response: { “data”: { “number”: 3454995658706575, “secret”: “JPYzVd”, “balance”: “$0.00”, “balance_int”: “0”, “ticket_status_id”: 1, “ticket_status_name”: “Unassigned”, “ticket_type_id”: 3, “ticket_type_name”: “Digital”, “client_id”: 1, “patron_id”: null, “linked_patron_id”: null, “device_id”: null, “external_number”: null, “batch_number”: null, “roll_number”: null, “activated_date”: null, “expired_date”: null, “auto_refill_threshold”: null, “auto_refill_threshold_int”: null, “auto_refill_amount”: null, “auto_refill_amount_int”: null, “label”: null } }


    Declaration

    Swift

    public func getRideNow(token: String? = nil, ticketCallback: @escaping (Ticket?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get wallets. =


    Sample response: { “data”: [ { “card_name”: “Nolan Braun V”, “card_brand”: “Discover Card”, “last_4_digits”: “4991”, “expiration_date”: “2020-06-30”, “is_default”: 1 } ] }


    Declaration

    Swift

    public func getWallets(token: String? = nil, walletsCallback: @escaping ([Wallet]) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to create a wallet.


    Sample response:


    Declaration

    Swift

    public func addWallet(token: String? = nil, walletToken: String, wallet: Wallet, walletCallback: @escaping (Wallet) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    walletToken

    SimplePay token

    wallet

    Wallet object, contain the info needed

    walletCallback

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to update a wallet.


    Sample response:


    Declaration

    Swift

    public func updateWallet(token: String? = nil, isDefault: Int, walletId: Int, walletCallback: @escaping (Wallet) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    walletId

    Id of the wallet

    isDefault

    Make this wallet to be default for selection or not

    walletCallback

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to delete a wallet.


    Sample response:


    Declaration

    Swift

    public func deleteWallet(token: String? = nil, walletId: Int, success: SuccessHandler?, failure: FailureHandler?)

    Parameters

    token

    user current login token

    walletId

    Id of the wallet

    walletCallback

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to get patron (profile info). =


    Sample response: { “data”: { “id”: 11, “client_id”: 1, “name”: null, “email”: “ext-dang.than14@flowbird.group”, “phone”: null, “birthday”: null, “company_name”: null, “company_employee_id”: null, “patron_status_id”: 1, “pin”: null, “created_at”: “2019-04-24 05:31:42”, “updated_at”: “2019-04-24 05:31:42” } }


    Declaration

    Swift

    public func getPatron(token: String? = nil, profileCallback: @escaping (Patron?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that add value to a ticket. =


    Sample response: { “data”: { “number”: 5966215829816894, “secret”: null, “balance”: “$40.00”, “ticket_status_id”: 1, “ticket_status_name”: “Unassigned”, “ticket_type_id”: 3, “ticket_type_name”: “Digital”, “client_id”: 1, “patron_id”: null, “linked_patron_id”: null, “device_id”: null, “external_number”: null, “batch_number”: null, “roll_number”: null, “activated_date”: null, “expired_date”: null, “auto_refill_threshold”: null, “auto_refill_amount”: null } }


    Declaration

    Swift

    public func addValue(token: String? = nil, mediaId: String, value: Int, walletId: Int, ticketCallback: @escaping (Ticket) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    callback

    Callback executed after the request end.

FARE CARDS

  • Send a request to the Patron API that transfer balance from an account to other account. =


    Sample response: { “data”: { “number”: 7356282788845858, “secret”: “$2y$10$WN3JCpYO0WFf/dzDt27iKORIRVDxu33Ldl.XFd1pcKZtsQOfLVQJq”, “balance”: “$0.45”, “ticket_status_id”: 1, “ticket_status_name”: “Unassigned”, “ticket_type_id”: 1, “ticket_type_name”: “Paper”, “client_id”: 1, “patron_id”: null, “linked_patron_id”: null, “device_id”: null, “external_number”: null, “batch_number”: null, “roll_number”: null, “activated_date”: null, “expired_date”: null, “auto_refill_threshold”: null, “auto_refill_amount”: null } }


    Declaration

    Swift

    public func transferBalance(token: String? = nil, mediaId: String, transferNumber: String, value: Int, ticketCallback: @escaping (Ticket) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    transferNumber

    the target number for transfer

    value

    the number of money to transfer

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that edit a card label. =


    Sample response:


    Declaration

    Swift

    public func editCardLabel(token: String? = nil, mediaId: String, label: String, ticketCallback: @escaping (Ticket) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    label

    card label we would edit

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that link an email to a fare card. =


    Sample response:


    Declaration

    Swift

    public func linkMyFareCard(token: String? = nil, mediaId: String, email: String, ticketCallback: @escaping (Ticket) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    email

    email to link to set card

    callback

    Callback executed after the request end.

  • Send a request to the Patron API that add a fare card to current user. =


    Sample response:


    Declaration

    Swift

    public func addFareCard(token: String? = nil, secretCode: String, mediaId: String, label: String, ticketCallback: @escaping (Ticket) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    transferNumber

    the target number for transfer

    value

    the number of money to transfer

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to delete a fare card.


    Sample response:


    Declaration

    Swift

    public func deleteFareCard(token: String? = nil, cardId: String, success: SuccessHandler?, failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    cardId

    Id of the fare card

    success

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API that paring a fare card. =


    Sample response:


    Declaration

    Swift

    public func paringFareCard(token: String? = nil, pairingToken: String, label: String?, success: SuccessHandler?, failure: FailureHandler?)

    Parameters

    token

    user current login token

    mediaId

    get from get Ticket as field number

    transferNumber

    the target number for transfer

    value

    the number of money to transfer

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to delete a linked fare card.


    Sample response:


    Declaration

    Swift

    public func deleteCardLink(token: String? = nil, mediaId: String, patronId: Int, success: SuccessHandler?, failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    mediaId

    Id of media aka fare card

    patronId

    Id of the linked patron

    success

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to report lost or slolen of a fare card.


    Sample response:


    Declaration

    Swift

    public func reportLostOrStolen(token: String? = nil, mediaId: String, ticketCallback: @escaping (Ticket) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    mediaId

    Id of media aka fare card

    ticketCallback

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to get linked patrons.


    Sample response:


    Declaration

    Swift

    public func getLinkedPatrons(token: String? = nil, mediaId: String, patronsCallback: @escaping ([Patron]) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    mediaId

    Id of media

    patronsCallback

    Success callback

    failure

    Failure callback

PROFILE

  • Send a request to the Patron API to add an user profile.


    Sample response:


    Declaration

    Swift

    public func addProfile(token: String? = nil, enrollmentCode: String, mediaId: String, profileCallback: @escaping (Profile) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    enrollmentCode

    Enrollment code

    mediaId

    Id of media

    profilesCallback

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to get user profiles.


    Sample response:


    Declaration

    Swift

    public func getProfiles(token: String? = nil, mediaId: String, profilesCallback: @escaping ([Profile]) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    mediaId

    Id of media

    profilesCallback

    Success callback

    failure

    Failure callback

MESSAGES

Application PARAMETERS

  • Send a request to the Patron API to get application parameters.


    Sample response:


    Declaration

    Swift

    public func getAppParams(packageName: String, versionName: String, paramsCallback: @escaping ([AppParam]) -> (), failure: FailureHandler?)

    Parameters

    packageName

    The Bundle identifier of the app

    versionName

    Current app version

    paramsCallback

    Success callback

    failure

    Failure callback

CITATIONS

  • Send a request to the Patron API to citation list.


    Sample response:


    Declaration

    Swift

    public func getCitations(token: String? = nil, citationsCallback: @escaping ([[String : [Citation]]]) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    citationsCallback

    The callback on request end

  • Send a request to the Patron API to make the payment of a single citation.


    Sample response:


    Declaration

    Swift

    public func payCitation(token: String? = nil, citationId: Int, cardId: Int, citationCallback: @escaping (Citation?) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    citationId

    Id of citation

    cardId

    Id of a wallet

    citationsCallback

    The callback on request end

  • Send a request to the Patron API to make the payment of a list of citations.


    Sample response:


    Declaration

    Swift

    public func payCitations(token: String? = nil, citationIds: [Int], cardId: Int, citationsCallback: @escaping ([String : [Citation]]) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    citationIds

    List of citation Ids

    cardId

    Id of a wallet

    citationsCallback

    The callback on request end

ADDRESS

  • Send a request to the Patron API to create an address.


    Sample response:


    Declaration

    Swift

    public func createAddress(token: String? = nil, address: Address, complete: @escaping (Address?) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    address

    Address object

    complete

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to update an address.


    Sample response:


    Declaration

    Swift

    public func updateAddress(token: String? = nil, address: Address, complete: @escaping (Address?) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    address

    Address object

    complete

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to get address list.


    Sample response:


    Declaration

    Swift

    public func getAddresses(token: String? = nil, complete: @escaping ([Address]) -> (), failure: FailureHandler?)

    Parameters

    token

    The token of current logged user

    complete

    Success callback

    failure

    Failure callback

  • Send a request to the Patron API to delete an address.


    Sample response:


    Declaration

    Swift

    public func deleteAddress(token: String? = nil, addressId: Int, success: SuccessHandler?, failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    addressId

    Id of the address

    success

    Success callback

    failure

    Failure callback

  • Send a request to the SIMPLE PAY Server to get the simple-pay token.


    Sample response:


    Declaration

    Swift

    public func getSimplePayToken(cardNumber: String, expMonth: String, expYear: String, cvv: String, cardBrand: String, cardHolder: String, simplePayUrl: String, simplePayAuthenToken: String, entityId: String, complete: @escaping (_ token: String?) -> Void)

    Parameters

    token

    Token of current logged user

    cardNumber

    Credit card number

    expMonth

    Credit card expiry month

    expYear

    Credit card expiry year

    cvv

    Credit card cvv

    cardBrand

    Credit card brand

    cardHolder

    Credit card name

    simplePayUrl

    SimplePay server url

    simplePayAuthenToken

    SimplePay authentication token

    entityId

    Entity Id

    complete

    Callback executed after the request end.

  • Send a request to the Patron API to get notifation settings by email.


    Sample response:


    Declaration

    Swift

    public func getNotificationByEmail(token: String? = nil, notificationCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    notificationCallback

    Callback executed after the request end.

  • Send a request to the Patron API to change notifation settings by email.


    Sample response:


    Declaration

    Swift

    public func setNotificationByEmail(token: String, isOn: Int, notificationCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    isOn

    To turn on/off for receiving notification

    notificationCallback

    Callback executed after the request end.

  • Send a request to the Patron API to get notifation settings by text.


    Sample response:


    Declaration

    Swift

    public func getNotificationByText(token: String? = nil, notificationCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    notificationCallback

    Callback executed after the request end.

  • Send a request to the Patron API to change notifation settings by text.


    Sample response:


    Declaration

    Swift

    public func setNotificationByText(token: String? = nil, isOn: Int, notificationCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    isOn

    To turn on/off for receiving notification

    notificationCallback

    Callback executed after the request end.

  • Send a request to the Patron API to get notifation settings by credit card.


    Sample response:


    Declaration

    Swift

    public func getNotificationByCreditCard(token: String? = nil, notificationCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    notificationCallback

    Callback executed after the request end.

  • Send a request to the Patron API to change notifation settings by credit card.


    Sample response:


    Declaration

    Swift

    public func setNotificationByCreditCard(token: String? = nil, isOn: Int, notificationCallback: @escaping (Bool) -> (), failure: FailureHandler?)

    Parameters

    token

    Token of current logged user

    isOn

    To turn on/off for receiving notification

    notificationCallback

    Callback executed after the request end.

TRANSACTION HISTORY

PASSES

  • Send a request to the Patron API to get the pass list.


    Sample response:


    Declaration

    Swift

    public func getPasses(token: String? = nil, callback: @escaping ([Pass]) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get the detais of a pass.


    Sample response:


    Declaration

    Swift

    public func showPass(token: String? = nil, passId: Int, callback: @escaping (Pass?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    passId

    Id of the pass

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to create a pass.


    Sample response:


    Declaration

    Swift

    public func createPass(token: String? = nil, productId: Int, concessionId: Int, programId: Int?, callback: @escaping (Pass) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    productId

    Id of the product

    concessionId

    Id of the concession

    programId

    Id of the program

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to active a pass.


    Sample response:


    Declaration

    Swift

    public func activePass(token: String? = nil, passId: Int, createdAt: Int, callback: @escaping (Pass) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    passId

    Id of the pass

    createdAt

    The timestamp

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get locations for displaying in the map.


    Sample response:


    Declaration

    Swift

    public func getLocations(token: String? = nil, callback: @escaping ([PFareLocation]) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get fare list.


    Sample response:


    Declaration

    Swift

    public func getFares(token: String? = nil, callback: @escaping ([PProvider]) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get product list of a location.


    Sample response:


    Declaration

    Swift

    public func getProductsLocation(token: String? = nil, locationId: Int, callback: @escaping ([PProduct]) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    locationId

    Id of a location

    callback

    Callback executed after the request end.

  • Send a request to the Patron API to get the details of a location.


    Sample response:


    Declaration

    Swift

    public func getLocation(token: String? = nil, locationId: Int, callback: @escaping (PFareLocation?) -> (), failure: FailureHandler?)

    Parameters

    token

    user current login token

    locationId

    Id of a location

    callback

    Callback executed after the request end.

Cart management