iOS


7. Reward List

You can get list reward from goodie by calling Goodie.setRewardList() function. And with this function you can use it to show reward detail. If you fill rewardId parameter with “Empty String”, function will retrieve all reward. And if you want to retrieves specific reward, you can fill rewardId parameter with specific id where you get the Id from previous reward list.

Here is example:

1.	orderBy :   
2.	1 = ascending  
3.	2 = descending  
4.	  
5.	orderType :  
6.	1 = reward  
7.	2 = product  
8.	3 = point  
9.	4 = expired date  
10.	  
11.	nRecord = number of records  
12.	  
13.	GoodieCore.rewardList(authToken: "authToken", deviceUniqueId: "deviceUniqueId", keyword: "keyword", rewardId: "rewardId", memberId: "memberId", merchantId: "merchantId", orderBy: "1", orderType: "1", nRecords: "10", page: "0", completion: { (RewardListResponse) in  
14.	    if RewardListResponse.abstractResponse?.responseStatus == "INQ000" {  
15.	        //success, do something  
16.	    }else{  
17.	        //failed  
18.	    }  
19.	    }) { (Error) in  
20.	        //error  
21.	    }  
                    

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
keyword String keyword is used for filtering specific reward by name.
rewardId String rewardId is used for retrieves all reward or specific reward by Id
orderBy integer It used for filtering reward by name in alphabet. Sample : 1 = Ascending, 2 = Descending
orderType Integer It used for filtering reward by type. Sample : 1 = reward, 2 = product, 3 = point, 4 = expired date
nRecords integer It is used to limit data displayed in one page
page integer It is used to pagination, starts from 0

Response Reward List :
8.	{  
9.	    "rewards": [  
10.	        {  
11.	            "rewardId": "6C7475C2-ECC1-4C0F-BE43-A648F3E9BB6D",  
12.	            "rewardName": "Alfamart Bahagia Voucher Lebaran Rp 50.000",  
13.	            "description": "<p>Ini alpha testing product UV</p>\n",  
14.	            "termAndCondition": "T&C",  
15.	            "requiredPoint": 1,  
16.	            "expiredDate": "30/06/2019",  
17.	            "productName": "Voucher Digital Alfamart Rp 50.000",  
18.	            "productImage": "https://dev.goodie.id/ViewImage?fileName=Alfamart_Logo.png",  
19.	            "productType": "Voucher",  
20.	            "amountValue": 50000,  
21.	            "percentageValue": null,  
22.	            "stock": null  
23.	        },  
24.	        {  
25.	            "rewardId": "BFC60EF6-00D4-4799-9E51-6FD48A77A0AA",  
26.	            "rewardName": "Product UV",  
27.	            "description": "<p></p>\n",  
28.	            "termAndCondition": "untuk pengguna baru ",  
29.	            "requiredPoint": 20,  
30.	            "expiredDate": "31/07/2019",  
31.	            "productName": "Voucher Digital Bakmi Gm Rp. 50.000",  
32.	            "productImage": "https://dev.goodie.id/ViewImage?fileName=Bakmi_GM.jpg",  
33.	            "productType": "Voucher",  
34.	            "amountValue": 50000,  
35.	            "percentageValue": null,  
36.	            "stock": null  
37.	        },  
38.	        {  
39.	            "rewardId": "DAA7C3C4-AFC0-4CC3-AD69-F0DF7164B8DA",  
40.	            "rewardName": "Reward Akhir Tahun",  
41.	            "description": "<p><p>Test Reward Akhir Tahun</p></p>\n<p></p>\n",  
42.	            "termAndCondition": "Reward Akhir Tahun",  
43.	            "requiredPoint": 1,  
44.	            "expiredDate": "14/04/2022",  
45.	            "productName": "Voucher BNI Rp 500.000",  
46.	            "productImage": "https://dev.goodie.id/ViewImage?fileName=ViewImage%3FfileName%3D%2523VoEq5rfstNpWGF%25401tqwY%2525yv%2540U76cdCD.png",  
47.	            "productType": "Voucher",  
48.	            "amountValue": 5000,  
49.	            "percentageValue": null,  
50.	            "stock": 0  
51.	        }  
52.	    ],  
53.	    "recordInfo": {  
54.	        "totalRecords": 3,  
55.	        "page": 0,  
56.	        "nrecords": 10  
57.	    },  
58.	    "abstractResponse": {  
59.	        "responseStatus": "INQ000",  
60.	        "responseMessage": "Inquiry success"  
61.	    }  
62.	}