@lap v0.3
# Machine-readable API spec. Each @endpoint block is one API call.
@api Giftcard Hub API
@base https://apiexamples.vtexcommercestable.com.br
@version 1.0
@auth ApiKey X-VTEX-API-AppKey in header | ApiKey X-VTEX-API-AppToken in header | ApiKey VtexIdclientAutCookie in header
@common_fields {Content-Type: str=application/json # Type of the content being sent., Accept: str=application/json # HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand.}
@endpoints 15
@toc api(15)

@endpoint GET /api/giftcardproviders
@desc List all gift card providers
@optional {REST-Range: str=resources=0-49 # Pagination control. This query variable must follow the format `_resources={from}-{to}_`.}
@returns(200) OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}
@desc Get a gift card provider by ID
@required {giftCardProviderId: str # Gift card provider identification.}
@returns(200) {id: str, serviceUrl: str, oauthProvider: str, caption: str, preAuthEnabled: bool, cancelEnabled: bool, _self: map} # OK
@errors {500: Object reference not set to an instance of an object (The gift card provider described does not exist).}

@endpoint PUT /api/giftcardproviders/{giftCardProviderId}
@desc Create or update a gift card provider by ID
@required {giftCardProviderId: str # Gift card provider identification.}
@returns(200) {id: str, serviceUrl: str, oauthProvider: str, preAuthEnabled: bool, cancelEnabled: bool, _self: map} # OK

@endpoint DELETE /api/giftcardproviders/{giftCardProviderId}
@desc Delete a gift card provider by ID
@required {giftCardProviderId: str # Gift card provider identification.}
@returns(200) OK. This endpoint does not return any data in the response body.
@errors {404: Not Found}

@endpoint POST /api/giftcardproviders/{giftCardProviderId}/giftcards
@desc Create a gift card at a gift card provider
@required {giftCardProviderId: str # Gift card provider identification.}
@returns(200) {id: str, emissionDate: str, expiringDate: str, caption: str, provider: str, discount: bool, currencyCode: str, transaction: map{href: str}} # OK

@endpoint POST /api/giftcardproviders/{giftCardProviderId}/giftcards/_search
@desc Get a gift card from a gift card provider
@required {giftCardProviderId: str # Gift card provider identification.}
@optional {REST-Range: str=resources=0-49 # Pagination control. This query variable must follow the format `_resources={from}-{to}_`.}
@returns(200) OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}
@desc Get a gift card from a gift card provider by ID
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification.}
@returns(200) {id: str, redemptionToken: str, redemptionCode: str, balance: num, emissionDate: str, expiringDate: str, currencyCode: str, discount: bool, transactions: map{href: str}} # OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions
@desc List all gift card transactions
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification.}
@returns(200) OK

@endpoint POST /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions
@desc Create a gift card transaction
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification.}
@returns(200) {cardId: str, id: str, _self: map{href: str}} # OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions/{transactionId}
@desc Get a gift card transaction by ID
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification., transactionId: str # Transaction identification.}
@returns(200) {value: num, description: str, date: str, requestId: str, settlement: map{href: str}, cancellation: map{href: str}, authorization: map{href: str}, operation: str} # OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions/{tId}/authorization
@desc Get a gift card transaction authorization
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification., tId: str # Transaction ID generated by the provider. It is different from the `transactionId` generated by VTEX.}
@returns(200) {oid: str, value: num, date: str} # OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions/{tId}/settlements
@desc List all gift card transactions settlements
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification., tId: str # Transaction ID generated by the provider. It is different from the `transactionId` generated by VTEX.}
@returns(200) OK

@endpoint POST /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions/{tId}/settlements
@desc Settle a gift card transaction
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification., tId: str # Transaction ID generated by the provider. It is different from the `transactionId` generated by VTEX., value: num # Transaction value., requestId: str # Request identification of the transaction.}
@returns(200) OK

@endpoint GET /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions/{tId}/cancellations
@desc List all gift card transactions cancellations
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification., tId: str # Transaction ID generated by the provider. It is different from the `transactionId` generated by VTEX.}
@returns(200) OK

@endpoint POST /api/giftcardproviders/{giftCardProviderId}/giftcards/{giftCardId}/transactions/{tId}/cancellations
@desc Cancel a gift card transaction
@required {giftCardProviderId: str # Gift card provider identification., giftCardId: str # Gift card identification., tId: str # Transaction ID generated by the provider. It is different from the `transactionId` generated by VTEX.}
@returns(200) {oid: str, value: num, date: str} # OK

@end
