iOS


8. Reward Redeem

This function Goodie.reedemReward() is used for exchange points into rewards. you can get rewardId while get response from rewardList function.

Here is example:

1.	let rewardReqs = RewardReq()  
2.	rewardReqs.rewardId = "rewardId"  
3.	rewardReqs.quantity = 1  
4.	var listReward = [rewardReqs]  
5.	  
6.	GoodieCore.reedemReward(authToken: "authToken", deviceUniqId: "deviceUniqId", memberId: "memberId", merchantId: "merchantId", listReward: [RewardReq], completion: { (RewardRedemptionResponse) in  
7.	    if RewardListResponse.abstractResponse?.responseStatus == "RWRED000" {  
8.	        //success, do something  
9.	    }else{  
10.	        //failed  
11.	    }  
12.	}, onError: { (Error) in  
13.	    //error  
14.	})  
                    

Where :
Param Type Description
authToken String authToken is used as for header authentication purpose
deviceUniqueId String deviceUniqueId is identify android device
memberId String memberId is identifier that will be used to identity a member
merchantId String merchantId is identifier that will be used to identity a merchant
listReward ArrayList listReward is an ArrayList which is contains quantity and rewardId, (Build construct ArrayList to declare the reward and it can be redeemed more than one reward)

Response Redeem Reward :
1.	{  
2.	    "rewardRedemptionResponse": {  
3.	        "detailResponses": [  
4.	            {  
5.	                "detailResponseId": "RRDTL000",  
6.	                "detailResponseMessage": "Reward has been successfully redeemed",  
7.	                "rewardId": "6C7475C2-ECC1-4C0F-BE43-A648F3E9BB6D",  
8.	                "rewardCode": "INKALFA50",  
9.	                "rewardName": "Alfamart Bahagia Voucher Lebaran Rp 50.000",  
10.	                "pointUsed": 1,  
11.	                "productType": "1",  
12.	                "producTypeDescription": "Voucher",  
13.	                "voucher": [  
14.	                    {  
15.	                        "voucherId": "ALD50-20190528-0881",  
16.	                        "voucherCode": "cTEyNDMyNQ==",  
17.	                        "expiredDate": "2020-01-01",  
18.	                        "url": "https://dev.uvcr.me/1c8b648a30ec586b8199a9af877fb84e/1561101066"  
19.	                    }  
20.	                ]  
21.	            }  
22.	        ],  
23.	        "totalPointUsed": 1,  
24.	        "currentBalance": 297,  
25.	        "transactionIdReference": "80CACB97-928D-4DE3-A92A-CEF5734D0D4B"  
26.	    },  
27.	    "abstractResponse": {  
28.	        "responseStatus": "RWRED000",  
29.	        "responseMessage": "Reward Redemption Successful"  
30.	    }  
31.	}