Promotions and Vouchers

Promotions


Get all promotions of a Customer


Use this method to get all available promotions that are defined for this Customer.

Declared In

SNRPromotions.h

Method Name

Promotions.getPromotions(success:failure:)

Declaration

func getPromotions(success: ((PromotionResponse) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Promotions.getPromotions(success: { (promotionResponse) in
	// success
	print(promotionResponse.items)
}, failure: { (error) in
	// failure
})

Get promotions with query parameters


Use this method to get promotions that match the parameters defined in an API query.

Declared In

SNRPromotions.h

Method Name

Promotions.getPromotions(apiQuery:success:failure:)

Declaration

func getPromotions(apiQuery: PromotionsApiQuery, success: ((PromotionResponse) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
apiQuery SNRPromotionsApiQuery no - Object that stores all query parameters
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let apiQuery = PromotionsApiQuery()
apiQuery.types = [SNR_PROMOTION_TYPE_GENERAL]
apiQuery.statuses = [SNR_PROMOTION_STATUS_ACTIVE, SNR_PROMOTION_STATUS_ASSIGNED]
apiQuery.types = [SNR_PROMOTION_TYPE_GENERAL]
apiQuery.sorting = [
	[SNR_PROMOTION_SORTING_KEY_EXPIRE_AT: SNR_API_QUERY_SORTING_ASC],
	[SNR_PROMOTION_SORTING_KEY_TYPE: SNR_API_QUERY_SORTING_DESC]
]
apiQuery.limit = 50
apiQuery.page = 1
apiQuery.includeMeta = true
Promotions.getPromotions(apiQuery: apiQuery, success: { (promotionResponse) in
	// success
}, failure: { (error) in
	// failure
})

Get promotion by UUID


Use this method to get the promotion with the specified UUID.

Declared In

SNRPromotions.h

Method Name

Promotions.getPromotion(uuid:success:failure:)

Declaration

func getPromotion(uuid: String, success: ((PromotionResponse) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
uuid String yes - UUID of the promotion
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let UUID: String = "UUID"
Promotions.getPromotion(uuid: UUID, success: { (promotion) in
	// success
	print(promotion.code)
	print(promotion.discountValue)
}, failure: { (error) in
	// failure
})

Get promotion by code


Use this method to get the promotion with the specified code.

Declared In

SNRPromotions.h

Method Name

Promotions.getPromotion(code:success:failure:)

Declaration

func getPromotion(code: String, success: ((PromotionResponse) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
code String true - Code of the promotion
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let code: String = "CODE"
Promotions.getPromotion(code: code, success: { (promotion) in
	// success
	print(promotion.code)
	print(promotion.discountValue)
}, failure: { (error) in
	// failure
})

Activate promotion by UUID


Use this method to activate the promotion with the specified UUID.

Declared In

SNRPromotions.h

Method Name

Promotions.activatePromotion(uuid:success:failure:)

Declaration

func activatePromotion(uuid: String, success: ((Bool) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
uuid String yes - UUID of the promotion
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let UUID: String = "UUID"
Promotions.activatePromotion(uuid: UUID, success: { (isSuccess) in
	// success
}, failure: { (error) in
	// failure
})

Activate promotion by code


Use this method to activate the promotion with the specified code.

Declared In

SNRPromotions.h

Method Name

Promotions.activatePromotion(code:success:failure:)

Declaration

func activatePromotion(code: String, success: ((Bool) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
code String yes - Code of the promotion
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let code: String = "CODE"
Promotions.activatePromotion(code: code, success: { (isSuccess) in
	// success
}, failure: { (error) in
	// failure
})

Deactivate promotion by UUID


Use this method to de-activate the promotion with the specified UUID.

Declared In

SNRPromotions.h

Method Name

Promotions.deactivatePromotion(uuid:success:failure:)

Declaration

func deactivatePromotion(uuid: String, success: ((Bool) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
uuid String yes - UUID of the promotion
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let UUID: String = "UUID"
Promotions.deactivatePromotion(uuid: UUID, success: { (isSuccess) in
	// success
}, failure: { (error) in
	// failure
})

Deactivate promotion by code


Use this method to de-activate the promotion with the specified code.

Declared In

SNRPromotions.h

Method Name

Promotions.deactivatePromotion(code:success:failure:)

Declaration

func deactivatePromotion(code: String, success: ((Bool) -> ()), failure: ((Error) -> ())) -> Void) -> Void

Parameters

Parameter Type Mandatory Default Description
code String yes - Code of the promotion
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let code: String = "CODE"
Promotions.deactivatePromotion(code: code, success: { (isSuccess) in
	// success
}, failure: { (error) in
	// failure
})

Vouchers


Get or assign voucher from pool


Use this method to get voucher code only once or assign voucher with provided pool UUID for the customer.

Declared In

SNRPromotions.h

Method Name

Promotions.getOrAssignVoucher(poolUUID:success:failure:)

Declaration

func getOrAssignVoucher(poolUUID: String, success: ((SNRAssignVoucherResponse) -> ()), failure: ((Error) -> ()))

Parameters

Parameter Type Mandatory Default Description
poolUUID String no - Pool’s universally unique identifier
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let poolUUID: String = "POOL_UUID"
Promotions.getOrAssignVoucher(poolUUID: poolUUID, success: { (assignVoucherResponse) in
	// success
failure: { (error) in
	// failure
})

Assign voucher code from pool


Use this method to assign voucher with provided pool UUID for the customer.

Every request returns different code until the pool is empty.

Declared In

SNRPromotions.h

Method Name

Promotions.assignVoucherCode(poolUUID:success:failure:)

Declaration

func assignVoucherCode(poolUUID: String, success: ((SNRAssignVoucherResponse) -> ()), failure: ((Error) -> ()))

Parameters

Parameter Type Mandatory Default Description
poolUUID String no - Pool’s universally unique identifier
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

let poolUUID: String = "POOL_UUID"
Promotions.assignVoucherCode(poolUUID: poolUUID, success: { (assignVoucherResponse) in
	// success
}, failure: { (error) in
	// failure
})

Get Customer-assigned voucher codes


Use this method to get customer’s voucher codes.

Declared In

SNRPromotions.h

Method Name

Promotions.getAssignedVoucherCodes(success:failure:)

Declaration

func getAssignedVoucherCodes(success: ((SNRVoucherCodesResponse) -> ()), failure: ((Error) -> ()))

Parameters

Parameter Type Mandatory Default Description
success Block/Closure no - Block/closure to be executed when the operation finishes successfully
failure Block/Closure no - Block/closure to be executed when the operation finishes unsuccessfully

Return Value

There is no return value.

Example

Promotions.getAssignedVoucherCodes(success: { (voucherCodesResponse) in
	// success
}, failure: { (error) in
	// failure
})
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.