Panagiotis Triantafyllou

Update README.md

Showing 1 changed file with 925 additions and 0 deletions
...@@ -6,3 +6,928 @@ gradlew warply-android-sdk:publishReleasePublicationToSonatypeRepository ...@@ -6,3 +6,928 @@ gradlew warply-android-sdk:publishReleasePublicationToSonatypeRepository
6 6
7 @Close and Release Repository 7 @Close and Release Repository
8 gradlew closeAndReleaseSonatypeStagingRepository 8 gradlew closeAndReleaseSonatypeStagingRepository
9 +
10 +
11 +
12 +
13 +
14 +
15 +
16 +
17 +
18 +Prerequisites
19 +• Android 6 or greater
20 +• Android Studio 3.6 or greater
21 +• JDK 8 or greater
22 +
23 +Installation
24 +1. Top level build.gradle
25 +In repositories section of the buildscript and the allProjects block add
26 +mavenCentral()
27 +
28 +2. Module level build.gradle
29 +dependencies {
30 + implementation 'ly.warp:warply-android-sdk:4.5.0'
31 +}
32 +
33 +Configuration - SDK
34 +We need to add to the assets folder the below file
35 +warply.properties
36 +
37 +Uuid The app uuid the warply sdk need to connect to the engage server
38 +Business section will provide it for you
39 +Debug If we need to see logs in Logcat
40 +BaseURL Production or Development environment of the engage server
41 +Production: https://engage.warp.ly
42 +Development: https://engage-stage.warp.ly
43 +ProgressColor Replace the color with one you want the progress bar to have depending on you app theme coloring
44 +If not defined the colorPrimary will be used
45 +ProgressDrawable Replace the drawable with one you want (this will show when webview loading)
46 +If not defined the launcher icon will be used
47 +PushColor If not defined the colorPrimary will be used
48 +PushIcon If not defined the launcher icon will used (better use the clipart icons for support black/white icons on 24+)
49 +PushSound If not defined the default will be used
50 +SendPackages If the device packages need to be send to the engage server
51 +Language The app language
52 +MerchantId The merchant id for some requests
53 +LoginType The login type must be one of the below:
54 +email, msisdn, username
55 +DL_URL_SCHEME Only for react native app
56 +The deeplink url scheme for react native campaigns
57 +
58 +Configuration - Push Notifications (FCM/HMS)
59 +1. Top level build.gradle
60 +In repositories section of the buildscript and the allProjects block add
61 +maven { url 'https://developer.huawei.com/repo/' }
62 +This is only for HMS
63 +
64 +2. Top level build.gradle
65 +In dependencies section add
66 +classpath 'com.google.gms:google-services:4.3.10'
67 +classpath 'com.huawei.agconnect:agcp:1.6.2.300'
68 +
69 +3. Module level build.gradle, at the top of it add
70 +apply plugin: 'com.google.gms.google-services'
71 +apply plugin: 'com.huawei.agconnect'
72 +
73 +4. Inside the app folder we need to add each or both json file(s)
74 + google-services
75 +agconnect-services
76 +
77 +Initialization
78 +1. In the starting activity of the application (i.e SplashActivity), we have to add the lines below
79 +
80 +1a.
81 +private WarplyInitializer mWarplyInitializer;
82 +1b.
83 + @Override
84 + protected void onCreate(Bundle savedInstanceState) {
85 + super.onCreate(savedInstanceState);
86 + setContentView(R.layout.activity_splash);
87 +
88 + mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() {
89 + @Override
90 + public void onWarplyReady() {
91 + //Maybe go to next Activity or whatever
92 + }
93 +
94 + @Override
95 + public void onWarplyInitTimeOut() {
96 +
97 + }
98 +
99 + @Override
100 + public void onWarplyPermissionsDenied() {
101 +
102 + }
103 + });
104 +}
105 +
106 +
107 +
108 +
109 +1c.
110 +@Override
111 + protected void onResume() {
112 + super.onResume();
113 + mWarplyInitializer.initWithPermissions(this);
114 + }
115 +1d. If we have a BaseActivity that other activities extend it, optionally (or in the starting activity), we can track when our application created, resumed or paused.
116 +
117 +@Override
118 + public void onCreate(Bundle savedInstanceState) {
119 + super.onCreate(savedInstanceState);
120 + WarplySessionManager.onCreateActivity(this);
121 + }
122 +
123 + @Override
124 + protected void onStart() {
125 + super.onStart();
126 + WarplySessionManager.onStartActivity(this);
127 + }
128 +
129 + @Override
130 + protected void onStop() {
131 + super.onStop();
132 + WarplySessionManager.onStopActivity(this);
133 + }
134 +
135 +
136 +
137 +
138 +
139 +
140 +
141 +
142 +Requests
143 +
144 +1. Campaigns
145 +
146 +Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);
147 +
148 +
149 +private CallbackReceiver<CampaignList> mInboxReceiver =
150 + new CallbackReceiver<CampaignList>() {
151 + @Override
152 + public void onSuccess(CampaignList result) {
153 +
154 + }
155 +
156 + @Override
157 + public void onFailure(int errorCode) {
158 +
159 + }
160 + };
161 +
162 +
163 +2. Products
164 +
165 +The “gift” parameter refers to the category of the product (gift, fruit, other custom category etc) that has been created on the engage platform. Empty parameter or without the .setProductFilter method, we will get all the products from all categories that have been created on the engage platform.
166 +* The setLanguage method is used to search on the language we provide.
167 +WarplyManager.getProducts(new WarplyProductsRequest().setProductFilter("gift"), mProductsReceiver);
168 +
169 +
170 +private CallbackReceiver<ProductList> mProductsReceiver = new CallbackReceiver<ProductList>() {
171 + @Override
172 + public void onSuccess(ProductList result) {
173 +
174 + }
175 +
176 + @Override
177 + public void onFailure(int errorCode) {
178 +
179 + }
180 +};
181 +
182 +
183 +3. Merchants
184 +
185 +Better use (30 : Merchants Multilingual request)
186 +WarplyManager.getMerchants(new WarplyMerchantsRequest(), mShopsReceiver);
187 +
188 +
189 +private CallbackReceiver<MerchantList> mShopsReceiver = new CallbackReceiver<MerchantList>() {
190 + @Override
191 + public void onSuccess(MerchantList result) {
192 +
193 + }
194 +
195 + @Override
196 + public void onFailure(int errorCode) {
197 +
198 + }
199 +};
200 +
201 +
202 +4. Content
203 +
204 +The “Article” parameter refers to the category that each content has been created on the engage platform. Empty parameter or without the .setContentCategory method, we will get all content from all categories that have been created on the engage platform.
205 +Respectively and in combination with content category we also have the .setTags method that refers to keywords every content item may has (i.e fun, beach, book etc).
206 +* The .setTags method takes an list with keyword names as string.
207 +* The setLanguage method is used to search on the language we provide.
208 +WarplyManager.getContent(new WarplyContentRequest().setContentCategory("Article").setTags(ArrayList<String>), mContentReceiver);
209 +
210 +
211 +private CallbackReceiver<ContentList> mContentReceiver = new CallbackReceiver<ContentList>() {
212 + @Override
213 + public void onSuccess(ContentList result) {
214 +
215 + }
216 +
217 + @Override
218 + public void onFailure(int errorCode) {
219 +
220 + }
221 +};
222 +
223 +
224 +5. Merchant Categories
225 +
226 +Returns the merchant categories the merchants belong to.
227 +* The setLanguage method is used to search on the language we provide.
228 +WarplyManager.getMerchantCategories(new WarplyMerchantCategoriesRequest(), mShopCategoriesReceiver);
229 +
230 +
231 +private CallbackReceiver<MerchantCategoriesList> mShopCategoriesReceiver = new CallbackReceiver<MerchantCategoriesList>() {
232 + @Override
233 + public void onSuccess(MerchantCategoriesList result) {
234 +
235 + }
236 +
237 + @Override
238 + public void onFailure(int errorCode) {
239 +
240 + }
241 +};
242 +
243 +
244 +6. Tags Categories
245 +
246 +Returns the categories of the tags that has been created on the engage platform.
247 +* The setLanguage method is used to search on the language we provide.
248 +WarplyManager.getTagsCategories(new WarplyTagsCategoriesRequest(), mTagsCategoriesReceiver);
249 +
250 +
251 +private CallbackReceiver<TagsCategoriesList> mTagsCategoriesReceiver = new CallbackReceiver<TagsCategoriesList>() {
252 + @Override
253 + public void onSuccess(TagsCategoriesList result) {
254 +
255 + }
256 +
257 + @Override
258 + public void onFailure(int errorCode) {
259 +
260 + }
261 +};
262 +
263 +
264 +7. Tags
265 +
266 +Returns the tags that has been created on the engage platform.
267 +Each tag item includes a category kay so in combination with the (6) to know in which category it belongs to.
268 +Each tag item has a name and a uuid key. The name can be used in (4 : setTags) and the uuid in (31 : setTags).
269 +* The setLanguage method is used to search on the language we provide.
270 +WarplyManager.getTags(new WarplyTagsRequest(), mTagsReceiver);
271 +
272 +
273 +private CallbackReceiver<TagsList> mTagsReceiver = new CallbackReceiver<TagsList>() {
274 + @Override
275 + public void onSuccess(TagsList result) {
276 +
277 + }
278 +
279 + @Override
280 + public void onFailure(int errorCode) {
281 +
282 + }
283 +};
284 +
285 +
286 +
287 +
288 +8. Contact
289 +
290 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
291 +WarplyManager.sendContact(new WarplyContactRequest()
292 + .setContactSubject("Other")
293 + .setContactName("Testaros")
294 + .setContactEmail("test@test.com")
295 + .setContactNumber("")
296 + .setContactMessage("Test comments"),
297 + mContactReceiver);
298 +
299 +
300 +private CallbackReceiver<JSONObject> mContactReceiver = new CallbackReceiver<JSONObject>() {
301 + @Override
302 + public void onSuccess(JSONObject result) {
303 +
304 + }
305 +
306 + @Override
307 + public void onFailure(int errorCode) {
308 +
309 + }
310 +};
311 +
312 +
313 +9. Login
314 +
315 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
316 +The .setId method must be one of email, msisdn or username and refers to the LoginType in warply.properties file.
317 +WarplyManager.login(new WarplyLoginRequest()
318 + .setId("email/msisdn/username")
319 + .setPassword(""),
320 + mLoginReceiver);
321 +
322 +
323 +private CallbackReceiver<JSONObject> mLoginReceiver = new CallbackReceiver<JSONObject>() {
324 + @Override
325 + public void onSuccess(JSONObject result) {
326 +
327 + }
328 +
329 + @Override
330 + public void onFailure(int errorCode) {
331 +
332 + }
333 +};
334 +
335 +
336 +10. Register
337 +
338 +The .setId and .setPassword methods are mandatory.
339 +The .setAutologin method is used if we want to autologin after the successful register flow.
340 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
341 +WarplyManager.register(new WarplyRegisterRequest()
342 + .setAutologin(true)
343 + .setId("panost+6@warp.ly")
344 + .setPassword("123456")
345 + .setFirstName("Test")
346 + .setLastName("Test")
347 + .setEmail("test@test.com")
348 + .setMsisdn("1234567890")
349 + .setSalutation("Mr")
350 + .setNickname("Testaros")
351 + .setGender("male")
352 + .setBirthDate("01/01/1970")
353 + .setNewsletter(false)
354 + .setSms(false)
355 + .setPersonalizedNewsletter(true)
356 + .setPersonalizedSms(true),
357 + mRegisterReceiver);
358 +
359 +
360 +private CallbackReceiver<JSONObject> mRegisterReceiver = new CallbackReceiver<JSONObject>() {
361 + @Override
362 + public void onSuccess(JSONObject result) {
363 +
364 + }
365 +
366 + @Override
367 + public void onFailure(int errorCode) {
368 +
369 + }
370 +};
371 +
372 +
373 +11. User Profile
374 +
375 +We have to be logged in.
376 +If the errorCode == 401 then a logout must follow.
377 +WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver);
378 +
379 +
380 +private CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() {
381 + @Override
382 + public void onSuccess(Consumer result) {
383 +
384 + }
385 +
386 + @Override
387 + public void onFailure(int errorCode) {
388 +
389 + }
390 +};
391 +
392 +
393 +12. Logout
394 +
395 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
396 +WarplyManager.logout(mLogoutReceiver);
397 +
398 +
399 +private CallbackReceiver<JSONObject> mLogoutReceiver = new CallbackReceiver<JSONObject>() {
400 + @Override
401 + public void onSuccess(JSONObject result) {
402 +
403 + }
404 +
405 + @Override
406 + public void onFailure(int errorCode) {
407 +
408 + }
409 +};
410 +
411 +
412 +13. Change Password
413 +
414 +WarplyManager.changePassword(new WarplyChangePasswordRequest()
415 + .setOldPassword("123456")
416 + .setNewPassword("1234567"),
417 + mChangePasswordReceiver);
418 +
419 +
420 +private CallbackReceiver<JSONObject> mChangePasswordReceiver = new CallbackReceiver<JSONObject>() {
421 + @Override
422 + public void onSuccess(JSONObject result) {
423 +
424 + }
425 +
426 + @Override
427 + public void onFailure(int errorCode) {
428 +
429 + }
430 +};
431 +
432 +
433 +14. Edit User Profile
434 +
435 +We have to be logged in.
436 +If the errorCode == 401 then a logout must follow.
437 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
438 +Fields that can be changed:
439 +* setFirstName, setLastName, setEmail, setSalutation, setMsisdn, setNickname, setGender, setBirthDate, setNameday, setTaxId
440 +* setOptin -> If we want to change the communications (i.e info via newsletter or sms or both, same for personalized), if true then we set the below fields (all are boolean):
441 +setNewsletter, setSms, setPersonalizedNewsletter, setPersonalizedSms
442 +* setHasProfileMetadata -> If we want to save custom info on consumer. If true then we set also the below field as a json object: setProfileMetadata
443 +* Note: We only use the fields we want to change.
444 +WarplyManager.editConsumer(new WarplyEditConsumerRequest()
445 + .setFirstName("test")
446 + .setLastName("test"), mEditConsumerReceiver);
447 +
448 +
449 +private CallbackReceiver<JSONObject> mEditConsumerReceiver = new CallbackReceiver<JSONObject>() {
450 + @Override
451 + public void onSuccess(JSONObject result) {
452 +
453 + }
454 +
455 + @Override
456 + public void onFailure(int errorCode) {
457 +
458 + }
459 +};
460 +
461 +
462 +15. Change User Photo
463 +
464 +We have to be logged in.
465 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
466 +The setUserId method must be the consumer.uuid, we can find it in Consumer object from (11 : User Profile request).
467 +The setImageBase64 method must be the base64 string of the image we want to upload.
468 +WarplyManager.uploadConsumerPhoto(new WarplyUploadConsumerPhotoRequest()
469 + .setUserId("")
470 + .setImageBase64(""), mUploadConsumerPhotoReceiver);
471 +
472 +
473 +private CallbackReceiver<JSONObject> mUploadConsumerPhotoReceiver = new CallbackReceiver<JSONObject>() {
474 + @Override
475 + public void onSuccess(JSONObject result) {
476 +
477 + }
478 +
479 + @Override
480 + public void onFailure(int errorCode) {
481 +
482 + }
483 +};
484 +
485 +
486 +16. Add Card
487 +
488 +We have to be logged in.
489 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
490 +If the errorCode == 4 then the card is already added.
491 +WarplyManager.addCard(new WarplyAddCardRequest()
492 + .setCardIssuer("Visa")
493 + .setCardNumber("1234567812345678")
494 + .setCardHolder("test test")
495 + .setCardExpMonth("01")
496 + .setCardExpYear("2026"), mAddCardReceiver);
497 +
498 +
499 +private CallbackReceiver<Card> mAddCardReceiver = new CallbackReceiver<Card>() {
500 + @Override
501 + public void onSuccess(Card result) {
502 +
503 + }
504 +
505 + @Override
506 + public void onFailure(int errorCode) {
507 +
508 + }
509 +};
510 +
511 +
512 +17. Get Cards
513 +
514 +We have to be logged in.
515 +If the errorCode == 401 then a logout must follow.
516 +WarplyManager.getCards(new WarplyGetCardsRequest(), mGetCardsReceiver);
517 +
518 +
519 +private CallbackReceiver<CardList> mGetCardsReceiver = new CallbackReceiver<CardList>() {
520 + @Override
521 + public void onSuccess(CardList result) {
522 +
523 + }
524 +
525 + @Override
526 + public void onFailure(int errorCode) {
527 +
528 + }
529 +};
530 +
531 +
532 +18. Delete Card
533 +
534 +We have to be logged in.
535 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
536 +If the errorCode == 401 then a logout must follow.
537 +WarplyManager.deleteCard(new WarplyDeleteCardRequest()
538 + .setCardToken("af993aead7d24abfbac716c276d8c6f5"), mDeleteCardReceiver);
539 +
540 +
541 +private CallbackReceiver<JSONObject> mDeleteCardReceiver = new CallbackReceiver<JSONObject>() {
542 + @Override
543 + public void onSuccess(JSONObject result) {
544 +
545 + }
546 +
547 + @Override
548 + public void onFailure(int errorCode) {
549 +
550 + }
551 +};
552 +
553 +
554 +19. Verify Ticket
555 +
556 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
557 +WarplyManager.verifyTicket(new WarplyVerifyTicketRequest()
558 + .setGuid("")
559 + .setTicket(""),
560 + mVerifyTicketReceiver);
561 +
562 +
563 +private CallbackReceiver<JSONObject> mVerifyTicketReceiver = new CallbackReceiver<JSONObject>() {
564 + @Override
565 + public void onSuccess(JSONObject result) {
566 +
567 + }
568 +
569 + @Override
570 + public void onFailure(int errorCode) {
571 +
572 + }
573 +};
574 +
575 +
576 +20. User Coupons
577 +
578 +We have to be logged in.
579 +If the errorCode == 401 then a logout must follow.
580 +WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
581 +
582 +
583 +private CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
584 + @Override
585 + public void onSuccess(CouponList result) {
586 +
587 + }
588 +
589 + @Override
590 + public void onFailure(int errorCode) {
591 +
592 + }
593 +};
594 +
595 +
596 +21. Transactions History
597 +
598 +We have to be logged in.
599 +If the errorCode == 401 then a logout must follow.
600 +WarplyManager.getTransactionHistory(new WarplyTransactionHistoryRequest(), mTransactionHistoryReceiver);
601 +
602 +
603 +private CallbackReceiver<TransactionsList> mTransactionHistoryReceiver = new CallbackReceiver<TransactionsList>() {
604 + @Override
605 + public void onSuccess(TransactionsList result) {
606 +
607 + }
608 +
609 + @Override
610 + public void onFailure(int errorCode) {
611 +
612 + }
613 +};
614 +
615 +
616 +22. Points History
617 +
618 +We have to be logged in.
619 +If the errorCode == 401 then a logout must follow.
620 +There is a relation between this and the (21 : Transactions History request).
621 +WarplyManager.getPointHistory(new WarplyPointHistoryRequest(), mPointHistoryReceiver);
622 +
623 +
624 +private CallbackReceiver<PointsList> mPointHistoryReceiver = new CallbackReceiver<PointsList>() {
625 + @Override
626 + public void onSuccess(PointsList result) {
627 +
628 + }
629 +
630 + @Override
631 + public void onFailure(int errorCode) {
632 +
633 + }
634 +};
635 +
636 +
637 +23. Add Address
638 +
639 +We have to be logged in.
640 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
641 +If the errorCode == 401 then a logout must follow.
642 +WarplyManager.addAddress(new WarplyAddAddressRequest()
643 + .setFriendlyName("panos")
644 + .setAddressName("moustaka 4")
645 + .setAddressNumber("4")
646 + .setPostalCode("32200")
647 + .setFloorNumber(1)
648 + .setDoorbell("triant")
649 + .setRegion("thiva")
650 + .setNotes("tel"), mAddAddressReceiver);
651 +
652 +
653 +private CallbackReceiver<JSONObject> mAddAddressReceiver = new CallbackReceiver<JSONObject>() {
654 + @Override
655 + public void onSuccess(JSONObject result) {
656 +
657 + }
658 +
659 + @Override
660 + public void onFailure(int errorCode) {
661 +
662 + }
663 +};
664 +
665 +
666 +24. Get Addresses
667 +
668 +We have to be logged in.
669 +If the errorCode == 401 then a logout must follow.
670 +WarplyManager.getAddressList(new WarplyGetAddressRequest(), mGetAddressReceiver);
671 +
672 +
673 +private CallbackReceiver<AddressList> mGetAddressReceiver = new CallbackReceiver<AddressList>() {
674 + @Override
675 + public void onSuccess(AddressList result) {
676 +
677 + }
678 +
679 + @Override
680 + public void onFailure(int errorCode) {
681 +
682 + }
683 +};
684 +
685 +
686 +25. Edit Address
687 +
688 +We have to be logged in.
689 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
690 +If the errorCode == 401 then a logout must follow.
691 +The fields are the same like the (24 : Add Address request).
692 +In addition to the other fields we must fill the uuid of the address we want to edit.
693 +* Note: We only use the fields we want to change.
694 +WarplyManager.editAddress(new WarplyEditAddressRequest()
695 + .setUuid("5f83af68ebc34e94b1ffd9143772bda1")
696 + .setAddressName("moustaka 2"), mEditAddressReceiver);
697 +
698 +
699 +private CallbackReceiver<JSONObject> mEditAddressReceiver = new CallbackReceiver<JSONObject>() {
700 + @Override
701 + public void onSuccess(JSONObject result) {
702 +
703 + }
704 +
705 + @Override
706 + public void onFailure(int errorCode) {
707 +
708 + }
709 +};
710 +
711 +
712 +26. Delete Address
713 +
714 +We have to be logged in.
715 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
716 +If the errorCode == 401 then a logout must follow.
717 +We must fill the uuid of the address we want to delete.
718 +WarplyManager.deleteAddress(new WarplyDeleteAddressRequest()
719 + .setUuid("5f83af68ebc34e94b1ffd9143772bda1"), mDeleteAddressReceiver);
720 +
721 +
722 +private CallbackReceiver<JSONObject> mDeleteAddressReceiver = new CallbackReceiver<JSONObject>() {
723 + @Override
724 + public void onSuccess(JSONObject result) {
725 +
726 + }
727 +
728 + @Override
729 + public void onFailure(int errorCode) {
730 +
731 + }
732 +};
733 +
734 +
735 +27. Redeem Product
736 +
737 +We have to be logged in.
738 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
739 +If the errorCode == 401 then a logout must follow.
740 +WarplyManager.redeemProduct(new WarplyRedeemCouponRequest()
741 + .setSku("")
742 + .setUuid(""),
743 + mRedeemCouponReceiver);
744 +
745 +
746 +private CallbackReceiver<JSONObject> mRedeemCouponReceiver = new CallbackReceiver<JSONObject>() {
747 + @Override
748 + public void onSuccess(JSONObject result) {
749 +
750 + }
751 +
752 + @Override
753 + public void onFailure(int errorCode) {
754 +
755 + }
756 +};
757 +
758 +
759 +28. Forgot Password
760 +
761 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
762 +The setId field must be one of email or msisdn.
763 +* Note: If the setId field is email then we first make the (28 : Forgot Password request) and then the (29 : Reset Password request).
764 +* Note: If the setId field is msisdn then we first make the (30 : Request OTP request) and then the (29 : Reset Password request) without the need of the (28 : Forgot Password request).
765 +WarplyManager.forgotPassword(new WarplyForgotPasswordRequest()
766 + .setId("")
767 + mForgotPasswordReceiver);
768 +
769 +
770 +private CallbackReceiver<JSONObject> mForgotPasswordReceiver = new CallbackReceiver<JSONObject>() {
771 + @Override
772 + public void onSuccess(JSONObject result) {
773 +
774 + }
775 +
776 + @Override
777 + public void onFailure(int errorCode) {
778 +
779 + }
780 +};
781 +
782 +
783 +29. Reset Password
784 +
785 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
786 +* If (28 : setId) is email then we only use the setPassword and setConfToken methods.
787 +* The setConfToken value is included as a parameter to the deeplink that we are redirected from the info email.
788 +* If (28 : setId) is msisdn then we only the setOtp and setOtpUuid methods with values from (30 : Request OTP request).
789 +WarplyManager.resetPassword(new WarplyResetPasswordRequest()
790 + .setPassword("")
791 + .setConfToken("")
792 + .setOtp("")
793 + .setOtpUuid(""),
794 + mResetPasswordReceiver);
795 +
796 +
797 +private CallbackReceiver<JSONObject> mResetPasswordReceiver = new CallbackReceiver<JSONObject>() {
798 + @Override
799 + public void onSuccess(JSONObject result) {
800 +
801 + }
802 +
803 + @Override
804 + public void onFailure(int errorCode) {
805 +
806 + }
807 +};
808 +
809 +
810 +30. Request OTP
811 +
812 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
813 +The setScope must be one of reset, edit or verify.
814 +WarplyManager.requestOTP(new WarplyRequestOTPRequest()
815 + .setMsisdn("")
816 + .setScope(""),
817 + mRequestOTPReceiver);
818 +
819 +
820 +private CallbackReceiver<JSONObject> mRequestOTPReceiver = new CallbackReceiver<JSONObject>() {
821 + @Override
822 + public void onSuccess(JSONObject result) {
823 +
824 + }
825 +
826 + @Override
827 + public void onFailure(int errorCode) {
828 +
829 + }
830 +};
831 +
832 +
833 +31. Merchants Multilingual
834 +
835 +We can request the merchants in multilingual way.
836 +* The setIsMultilingual method must be true.
837 +* The setLanguage method is used to search on the language we provide.
838 +* The setCategories method is used if we want to filter by category/ies. It’s a list of categories uuid.
839 +* The setTags method is used if we want to filter with keywords. It’s a list of tags uuid (7 : Tags request).
840 +* The setMerchantUuid method is used to search for a specific merchant. We need to add the uuid of that merchant.
841 +* The setCenter and setDistance are used to filter by location.
842 +WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
843 + .setIsMultilingual(true)
844 + .setCategories(cat)
845 + .setTags(tag), mMerchantsMultilingualReceiver);
846 +
847 +
848 +private CallbackReceiver<MerchantList> mMerchantsMultilingualReceiver = new CallbackReceiver<MerchantList>() {
849 + @Override
850 + public void onSuccess(MerchantList result) {
851 +
852 + }
853 +
854 + @Override
855 + public void onFailure(int errorCode) {
856 +
857 + }
858 +};
859 +
860 +32. Get User Couponsets
861 +
862 +* The setLanguage method is used to get the user couponsets to the language that are configured on the engage platform.
863 +* The setUuids method is used to get specific couponsets, if we know the coupon_uuid of them. It’s a list of string uuid.
864 +WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest()
865 + .setLanguage("el")
866 + mCouponsetsReceiver);
867 +
868 +
869 +private CallbackReceiver<CouponsetsList> mCouponsetsReceiver = new CallbackReceiver<CouponsetsList>() {
870 + @Override
871 + public void onSuccess(CouponsetsList result) {
872 +
873 + }
874 +
875 + @Override
876 + public void onFailure(int errorCode) {
877 +
878 + }
879 +};
880 +
881 +
882 +
883 +33. Redeem Coupon
884 +
885 +We have to be logged in.
886 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
887 +Additionally the response includes a result key (json) that includes the coupon and it’s expiration date, if any.
888 +If the errorCode == 401 then a logout must follow.
889 +* The setCouponsetUuid method is used to get a coupon from the given couponset.
890 +WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
891 + .setCouponsetUuid("7de77a1731d44a95a74a653f8e823fa4"),
892 + mRedeemCouponReceiver);
893 +
894 +
895 +private CallbackReceiver<JSONObject> mRedeemCouponReceiver = new CallbackReceiver<JSONObject>() {
896 + @Override
897 + public void onSuccess(JSONObject result) {
898 +
899 + }
900 +
901 + @Override
902 + public void onFailure(int errorCode) {
903 +
904 + }
905 +};
906 +
907 +
908 +34. Validate Coupon
909 +
910 +We have to be logged in.
911 +From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
912 +If status == 1, from result key, we have to check which items are satisfied == true. Only then is truly success.
913 +If the above case has no satisfied == true then we check the failed key that includes the different error messages in the msg key.
914 +If status == 4 means that no rule has been satisfied.
915 +If the errorCode == 401 then a logout must follow.
916 +* The setCoupon method is used to check the given coupon code we retrieved from (33 : Redeem Coupon request).
917 +WarplyManager.validateCoupon(new WarplyValidateCouponRequest()
918 + .setCoupon("CBGEJEYC"),
919 + mValidateCouponReceiver);
920 +
921 +
922 +private CallbackReceiver<JSONObject> mValidateCouponReceiver = new CallbackReceiver<JSONObject>() {
923 + @Override
924 + public void onSuccess(JSONObject result) {
925 +
926 + }
927 +
928 + @Override
929 + public void onFailure(int errorCode) {
930 +
931 + }
932 +};
933 +
......