Blame view

README.md 26.5 KB
1 2 3 4 5 6 7
@guide
https://proandroiddev.com/publishing-android-libraries-to-mavencentral-in-2021-8ac9975c3e52

@Create Release
gradlew warply-android-sdk:publishReleasePublicationToSonatypeRepository

@Close and Release Repository
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933
gradlew closeAndReleaseSonatypeStagingRepository









Prerequisites
•	Android 6 or greater
•	Android Studio 3.6 or greater
•	JDK 8 or greater

Installation
1.	Top level build.gradle
In repositories section of the buildscript and the allProjects block add
mavenCentral()

2.	Module level build.gradle
dependencies {
            implementation 'ly.warp:warply-android-sdk:4.5.0'
}

Configuration - SDK
We need to add to the assets folder the below file
warply.properties

Uuid	The app uuid the warply sdk need to connect to the engage server
Business section will provide it for you
Debug	If we need to see logs in Logcat
BaseURL	Production or Development environment of the engage server
Production:  https://engage.warp.ly
Development: https://engage-stage.warp.ly
ProgressColor	Replace the color with one you want the progress bar to have depending on you app theme coloring
If not defined the colorPrimary will be used
ProgressDrawable	Replace the drawable with one you want (this will show when webview loading)
If not defined the launcher icon will be used
PushColor	If not defined the colorPrimary will be used
PushIcon	If not defined the launcher icon will used (better use the clipart icons for support black/white icons on 24+)
PushSound	If not defined the default will be used
SendPackages	If the device packages need to be send to the engage server
Language	The app language
MerchantId	The merchant id for some requests
LoginType	The login type must be one of the below:
email, msisdn, username
DL_URL_SCHEME	Only for react native app
The deeplink url scheme for react native campaigns

Configuration - Push Notifications (FCM/HMS)
1.	Top level build.gradle
In repositories section of the buildscript and the allProjects block add
maven { url 'https://developer.huawei.com/repo/' }
This is only for HMS

2.	Top level build.gradle
In dependencies section add
classpath 'com.google.gms:google-services:4.3.10'
classpath 'com.huawei.agconnect:agcp:1.6.2.300' 

3.	Module level build.gradle, at the top of it add
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'

4.	Inside the app folder we need to add each or both json file(s)
 google-services
agconnect-services

Initialization
1.	In the starting activity of the application (i.e SplashActivity), we have to add the lines below

1a. 
private WarplyInitializer mWarplyInitializer;
1b. 
      @Override
      protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        mWarplyInitializer = Warply.getInitializer(this, new WarplyReadyCallback() {
            @Override
            public void onWarplyReady() {
                //Maybe go to next Activity or whatever
            }

            @Override
            public void onWarplyInitTimeOut() {
                
            }

            @Override
            public void onWarplyPermissionsDenied() {
                
            }
        });
}




1c.
@Override
    protected void onResume() {
        super.onResume();
        mWarplyInitializer.initWithPermissions(this);
    }
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.

@Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
                   WarplySessionManager.onCreateActivity(this);
                }

   @Override
    protected void onStart() {
        super.onStart();
        WarplySessionManager.onStartActivity(this);
                   }

   @Override
    protected void onStop() {
        super.onStop();
        WarplySessionManager.onStopActivity(this);
                   }








Requests

1. Campaigns

Warply.getInbox(new WarplyInboxRequest().setUseCache(false), mInboxReceiver);


private CallbackReceiver<CampaignList> mInboxReceiver =
        new CallbackReceiver<CampaignList>() {
            @Override
            public void onSuccess(CampaignList result) {
                
            }

            @Override
            public void onFailure(int errorCode) {

            }
        };


2. Products

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.
* The setLanguage method is used to search on the language we provide.
WarplyManager.getProducts(new WarplyProductsRequest().setProductFilter("gift"), mProductsReceiver);


private CallbackReceiver<ProductList> mProductsReceiver = new CallbackReceiver<ProductList>() {
    @Override
    public void onSuccess(ProductList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


3. Merchants

Better use (30 : Merchants Multilingual request)
WarplyManager.getMerchants(new WarplyMerchantsRequest(), mShopsReceiver);


private CallbackReceiver<MerchantList> mShopsReceiver = new CallbackReceiver<MerchantList>() {
    @Override
    public void onSuccess(MerchantList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


4. Content

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.
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).
* The .setTags method takes an list with keyword names as string.
* The setLanguage method is used to search on the language we provide.
WarplyManager.getContent(new WarplyContentRequest().setContentCategory("Article").setTags(ArrayList<String>), mContentReceiver);


private CallbackReceiver<ContentList> mContentReceiver = new CallbackReceiver<ContentList>() {
    @Override
    public void onSuccess(ContentList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


5. Merchant Categories

Returns the merchant categories the merchants belong to.
* The setLanguage method is used to search on the language we provide.
WarplyManager.getMerchantCategories(new WarplyMerchantCategoriesRequest(), mShopCategoriesReceiver);


private CallbackReceiver<MerchantCategoriesList> mShopCategoriesReceiver = new CallbackReceiver<MerchantCategoriesList>() {
    @Override
    public void onSuccess(MerchantCategoriesList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


6. Tags Categories

Returns the categories of the tags that has been created on the engage platform.
* The setLanguage method is used to search on the language we provide.
WarplyManager.getTagsCategories(new WarplyTagsCategoriesRequest(), mTagsCategoriesReceiver);


private CallbackReceiver<TagsCategoriesList> mTagsCategoriesReceiver = new CallbackReceiver<TagsCategoriesList>() {
    @Override
    public void onSuccess(TagsCategoriesList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


7. Tags

Returns the tags that has been created on the engage platform.
Each tag item includes a category kay so in combination with the (6) to know in which category it belongs to.
Each tag item has a name and a uuid key. The name can be used in (4 : setTags) and the uuid in (31 : setTags).
* The setLanguage method is used to search on the language we provide.
WarplyManager.getTags(new WarplyTagsRequest(), mTagsReceiver);


private CallbackReceiver<TagsList> mTagsReceiver = new CallbackReceiver<TagsList>() {
    @Override
    public void onSuccess(TagsList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};




8. Contact

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
WarplyManager.sendContact(new WarplyContactRequest()
        .setContactSubject("Other")
        .setContactName("Testaros")
        .setContactEmail("test@test.com")
        .setContactNumber("")
        .setContactMessage("Test comments"),
        mContactReceiver);


private CallbackReceiver<JSONObject> mContactReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


9. Login

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
The .setId method must be one of email, msisdn or username and refers to the LoginType in warply.properties file.
WarplyManager.login(new WarplyLoginRequest()
                .setId("email/msisdn/username")
                .setPassword(""),
        mLoginReceiver);


private CallbackReceiver<JSONObject> mLoginReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


10. Register

The .setId and .setPassword methods are mandatory. 
The .setAutologin method is used if we want to autologin after the successful register flow. 
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
WarplyManager.register(new WarplyRegisterRequest()
                .setAutologin(true)
                .setId("panost+6@warp.ly")
                .setPassword("123456")
                .setFirstName("Test")
                .setLastName("Test")
                .setEmail("test@test.com")
                .setMsisdn("1234567890")
                .setSalutation("Mr")
                .setNickname("Testaros")
                .setGender("male")
                .setBirthDate("01/01/1970")
                .setNewsletter(false)
                .setSms(false)
                .setPersonalizedNewsletter(true)
                .setPersonalizedSms(true),
        mRegisterReceiver);


private CallbackReceiver<JSONObject> mRegisterReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


11. User Profile

We have to be logged in.
If the errorCode == 401 then a logout must follow.
WarplyManager.getConsumer(new WarplyConsumerRequest(), mConsumerReceiver);


private CallbackReceiver<Consumer> mConsumerReceiver = new CallbackReceiver<Consumer>() {
    @Override
    public void onSuccess(Consumer result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


12. Logout

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
WarplyManager.logout(mLogoutReceiver);


private CallbackReceiver<JSONObject> mLogoutReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


13. Change Password

WarplyManager.changePassword(new WarplyChangePasswordRequest()
        .setOldPassword("123456")
        .setNewPassword("1234567"),
	 mChangePasswordReceiver);


private CallbackReceiver<JSONObject> mChangePasswordReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


14. Edit User Profile

We have to be logged in.
If the errorCode == 401 then a logout must follow.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
Fields that can be changed:
* setFirstName, setLastName, setEmail, setSalutation, setMsisdn, setNickname, setGender, setBirthDate, setNameday, setTaxId
* 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):
setNewsletter, setSms, setPersonalizedNewsletter, setPersonalizedSms
* setHasProfileMetadata -> If we want to save custom info on consumer. If true then we set also the below field as a json object: setProfileMetadata
* Note: We only use the fields we want to change.
WarplyManager.editConsumer(new WarplyEditConsumerRequest()
        .setFirstName("test")
        .setLastName("test"), mEditConsumerReceiver);


private CallbackReceiver<JSONObject> mEditConsumerReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


15. Change User Photo
	
We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
The setUserId method must be the consumer.uuid, we can find it in Consumer object from (11 : User Profile request).
The setImageBase64 method must be the base64 string of the image we want to upload.
WarplyManager.uploadConsumerPhoto(new WarplyUploadConsumerPhotoRequest()
        .setUserId("")
        .setImageBase64(""), mUploadConsumerPhotoReceiver);


private CallbackReceiver<JSONObject> mUploadConsumerPhotoReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


16. Add Card

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
If the errorCode == 4 then the card is already added.
WarplyManager.addCard(new WarplyAddCardRequest()
        .setCardIssuer("Visa")
        .setCardNumber("1234567812345678")
        .setCardHolder("test test")
        .setCardExpMonth("01")
        .setCardExpYear("2026"), mAddCardReceiver);


private CallbackReceiver<Card> mAddCardReceiver = new CallbackReceiver<Card>() {
    @Override
    public void onSuccess(Card result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


17. Get Cards

We have to be logged in.
If the errorCode == 401 then a logout must follow.
WarplyManager.getCards(new WarplyGetCardsRequest(), mGetCardsReceiver);


private CallbackReceiver<CardList> mGetCardsReceiver = new CallbackReceiver<CardList>() {
    @Override
    public void onSuccess(CardList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


18. Delete Card

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
If the errorCode == 401 then a logout must follow.
WarplyManager.deleteCard(new WarplyDeleteCardRequest()
        .setCardToken("af993aead7d24abfbac716c276d8c6f5"), mDeleteCardReceiver);


private CallbackReceiver<JSONObject> mDeleteCardReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


19. Verify Ticket

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
WarplyManager.verifyTicket(new WarplyVerifyTicketRequest()
                .setGuid("")
                .setTicket(""),
        mVerifyTicketReceiver);


private CallbackReceiver<JSONObject> mVerifyTicketReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


20. User Coupons

We have to be logged in.
If the errorCode == 401 then a logout must follow.
WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);


private CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
    @Override
    public void onSuccess(CouponList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


21. Transactions History

We have to be logged in.
If the errorCode == 401 then a logout must follow.
WarplyManager.getTransactionHistory(new WarplyTransactionHistoryRequest(), mTransactionHistoryReceiver);


private CallbackReceiver<TransactionsList> mTransactionHistoryReceiver = new CallbackReceiver<TransactionsList>() {
    @Override
    public void onSuccess(TransactionsList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


22. Points History

We have to be logged in.
If the errorCode == 401 then a logout must follow.
There is a relation between this and the (21 : Transactions History request).
WarplyManager.getPointHistory(new WarplyPointHistoryRequest(), mPointHistoryReceiver);


private CallbackReceiver<PointsList> mPointHistoryReceiver = new CallbackReceiver<PointsList>() {
    @Override
    public void onSuccess(PointsList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


23. Add Address

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
If the errorCode == 401 then a logout must follow.
WarplyManager.addAddress(new WarplyAddAddressRequest()
        .setFriendlyName("panos")
        .setAddressName("moustaka 4")
        .setAddressNumber("4")
        .setPostalCode("32200")
        .setFloorNumber(1)
        .setDoorbell("triant")
        .setRegion("thiva")
        .setNotes("tel"), mAddAddressReceiver);


private CallbackReceiver<JSONObject> mAddAddressReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


24. Get Addresses

We have to be logged in.
If the errorCode == 401 then a logout must follow.
WarplyManager.getAddressList(new WarplyGetAddressRequest(), mGetAddressReceiver);


private CallbackReceiver<AddressList> mGetAddressReceiver = new CallbackReceiver<AddressList>() {
    @Override
    public void onSuccess(AddressList result) {
       
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


25. Edit Address

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
If the errorCode == 401 then a logout must follow.
The fields are the same like the (24 : Add Address request).
In addition to the other fields we must fill the uuid of the address we want to edit.
* Note: We only use the fields we want to change.
WarplyManager.editAddress(new WarplyEditAddressRequest()
        .setUuid("5f83af68ebc34e94b1ffd9143772bda1")
        .setAddressName("moustaka 2"), mEditAddressReceiver);


private CallbackReceiver<JSONObject> mEditAddressReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


26. Delete Address

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
If the errorCode == 401 then a logout must follow.
We must fill the uuid of the address we want to delete.
WarplyManager.deleteAddress(new WarplyDeleteAddressRequest()
        .setUuid("5f83af68ebc34e94b1ffd9143772bda1"), mDeleteAddressReceiver);


private CallbackReceiver<JSONObject> mDeleteAddressReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


27. Redeem Product

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
If the errorCode == 401 then a logout must follow.
WarplyManager.redeemProduct(new WarplyRedeemCouponRequest()
                .setSku("")
                .setUuid(""),
        mRedeemCouponReceiver);


private CallbackReceiver<JSONObject> mRedeemCouponReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


28. Forgot Password

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
The setId field must be one of email or msisdn.
* Note: If the setId field is email then we first make the (28 : Forgot Password request) and then the (29 : Reset Password request).
* 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).
WarplyManager.forgotPassword(new WarplyForgotPasswordRequest()
        .setId("")
        mForgotPasswordReceiver);


private CallbackReceiver<JSONObject> mForgotPasswordReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


29. Reset Password

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
* If (28 : setId) is email then we only use the setPassword and setConfToken methods.
* The setConfToken value is included as a parameter to the deeplink that we are redirected from the info email.
* If  (28 : setId) is msisdn then we only the setOtp and setOtpUuid methods with values from (30 : Request OTP request).
WarplyManager.resetPassword(new WarplyResetPasswordRequest()
                .setPassword("")
                .setConfToken("")
                .setOtp("")
                .setOtpUuid(""),
        mResetPasswordReceiver);


private CallbackReceiver<JSONObject> mResetPasswordReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


30. Request OTP

From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
The setScope must be one of reset, edit or verify.
WarplyManager.requestOTP(new WarplyRequestOTPRequest()
                .setMsisdn("")
                .setScope(""),
        mRequestOTPReceiver);


private CallbackReceiver<JSONObject> mRequestOTPReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


31. Merchants Multilingual

We can request the merchants in multilingual way.
* The setIsMultilingual method must be true.
* The setLanguage method is used to search on the language we provide.
* The setCategories method is used if we want to filter by category/ies. It’s a list of categories uuid. 
* The setTags method is used if we want to filter with keywords. It’s a list of tags uuid (7 : Tags request).
* The setMerchantUuid method is used to search for a specific merchant. We need to add the uuid of that merchant.
* The setCenter and setDistance are used to filter by location.
WarplyManager.getMerchantsMultilingual(new WarplyMerchantsRequest()
        .setIsMultilingual(true)
        .setCategories(cat)
        .setTags(tag), mMerchantsMultilingualReceiver);


private CallbackReceiver<MerchantList> mMerchantsMultilingualReceiver = new CallbackReceiver<MerchantList>() {
    @Override
    public void onSuccess(MerchantList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};

32. Get User Couponsets

* The setLanguage method is used to get the user couponsets to the language that are configured on the engage platform.
* The setUuids method is used to get specific couponsets, if we know the coupon_uuid of them. It’s a list of string uuid.
WarplyManager.getCouponsets(new WarplyGetCouponsetsRequest()
                                   .setLanguage("el")
                     mCouponsetsReceiver);


private CallbackReceiver<CouponsetsList> mCouponsetsReceiver = new CallbackReceiver<CouponsetsList>() {
    @Override
    public void onSuccess(CouponsetsList result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};



33. Redeem Coupon

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also).
Additionally the response includes a result key (json) that includes the coupon and it’s expiration date, if any.
If the errorCode == 401 then a logout must follow.
* The setCouponsetUuid method is used to get a coupon from the given couponset.
WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest()
                .setCouponsetUuid("7de77a1731d44a95a74a653f8e823fa4"),
        mRedeemCouponReceiver);


private CallbackReceiver<JSONObject> mRedeemCouponReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};


34. Validate Coupon

We have to be logged in.
From the response json we check if status == 1 that means success, everything else means an error (like in onFailure also). 
If status == 1, from result key, we have to check which items are satisfied == true. Only then is truly success.
If the above case has no satisfied == true then we check the failed key that includes the different error messages in the msg key.
If status == 4 means that no rule has been satisfied.
If the errorCode == 401 then a logout must follow.
* The setCoupon method is used to check the given coupon code we retrieved from (33 : Redeem Coupon request).
WarplyManager.validateCoupon(new WarplyValidateCouponRequest()
                .setCoupon("CBGEJEYC"),
        mValidateCouponReceiver);


private CallbackReceiver<JSONObject> mValidateCouponReceiver = new CallbackReceiver<JSONObject>() {
    @Override
    public void onSuccess(JSONObject result) {
        
    }

    @Override
    public void onFailure(int errorCode) {
        
    }
};