Class RetroclaimPresenter<T extends RetroclaimView>

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void claimOrder​(OrderFields fields)
      Call to claim order using OrderFields
      protected void claimOrder​(java.lang.String id, java.lang.String placeId, java.lang.String date, java.lang.String register, java.lang.Double subtotal, java.lang.Double chargedAmount, java.lang.Double totalAmount, java.lang.String lastDigits)
      Call to claim order using specific fields
      protected ListenerModel getClaimListener()
      Returns an instance of the ListenerModel for BaseData and Retroclaim Override this method to change default behavior of the listener
      protected OrdersAPI getOrdersAPI()
      Get the current instance of OrdersAPI
      void loadData()
      Load initial view data.
      protected void onClaimFailed​(int errorCode, java.lang.String error)
      Called after a failed request on Retroclaim
      protected void onClaimSuccess​(Retroclaim data)
      Called after a successful request on Retroclaim
      void submitRetroclaim​(java.lang.String transactionId, java.lang.String placeId, java.lang.String date, java.lang.String registerName, java.lang.String lastDigits, java.lang.Double subtotal, java.lang.Double chargedAmout, java.lang.Double total)
      Method to validate the transaction fields and then submit request for retroclaim if all is valid
      protected int validateChargedAmount​(double chargedAmount)
      Validation method for the charged amount
      protected int validateDate​(java.lang.String date)
      Validation method for the transaction date
      protected int validateLastDigit​(java.lang.String lastDigit)
      Validation method for the last 4 digits of the credit card
      protected int validatePlaceId​(java.lang.String placeId)
      Validation method for the place id
      protected int validateRegister​(java.lang.String registerId)
      Validation method for the register id
      protected int validateSubtotal​(double subtotal)
      Validation method for the subtotal
      protected int validateTotalAmount​(double totalAmount)
      Validation method for the total amount
      protected int validateTransactionId​(java.lang.String transactionId)
      Validation method for transaction id
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • RetroclaimPresenter

        public RetroclaimPresenter()
    • Method Detail

      • submitRetroclaim

        public void submitRetroclaim​(@Nullable
                                     java.lang.String transactionId,
                                     @NonNull
                                     java.lang.String placeId,
                                     @NonNull
                                     java.lang.String date,
                                     @Nullable
                                     java.lang.String registerName,
                                     @Nullable
                                     java.lang.String lastDigits,
                                     @Nullable
                                     java.lang.Double subtotal,
                                     @Nullable
                                     java.lang.Double chargedAmout,
                                     @Nullable
                                     java.lang.Double total)
        Method to validate the transaction fields and then submit request for retroclaim if all is valid
        Parameters:
        transactionId - String - transaction id of the claim
        placeId - String - place / store id of the claim
        date - String - date of the claim
        registerName - String - id of the register
        lastDigits - String - last 4 digits of the credit card used
        subtotal - Double - subtotal amount
        chargedAmout - Double - charged amount
        total - Double - total amount
      • validateTransactionId

        protected int validateTransactionId​(java.lang.String transactionId)
        Validation method for transaction id
        Parameters:
        transactionId - transaction id
        Returns:
        String resource id of the error, 0 if no error
      • validatePlaceId

        protected int validatePlaceId​(java.lang.String placeId)
        Validation method for the place id
        Parameters:
        placeId - place id
        Returns:
        String resource id of the error, 0 if no error
      • validateDate

        protected int validateDate​(java.lang.String date)
        Validation method for the transaction date
        Parameters:
        date - date of the transaction
        Returns:
        String resource id of the error, 0 if no error
      • validateRegister

        protected int validateRegister​(java.lang.String registerId)
        Validation method for the register id
        Parameters:
        registerId - register id
        Returns:
        String resource id of the error, 0 if no error
      • validateSubtotal

        protected int validateSubtotal​(double subtotal)
        Validation method for the subtotal
        Parameters:
        subtotal - subtotal amount of the transaction
        Returns:
        String resource id of the error, 0 if no error
      • validateLastDigit

        protected int validateLastDigit​(java.lang.String lastDigit)
        Validation method for the last 4 digits of the credit card
        Parameters:
        lastDigit - last 4 digits of the credit card
        Returns:
        String resource id of the error, 0 if no error
      • validateChargedAmount

        protected int validateChargedAmount​(double chargedAmount)
        Validation method for the charged amount
        Parameters:
        chargedAmount - charged amount
        Returns:
        String resource id of the error, 0 if no error
      • validateTotalAmount

        protected int validateTotalAmount​(double totalAmount)
        Validation method for the total amount
        Parameters:
        totalAmount - total amount
        Returns:
        String resource id of the error, 0 if no error
      • claimOrder

        protected void claimOrder​(@Nullable
                                  java.lang.String id,
                                  @NonNull
                                  java.lang.String placeId,
                                  @NonNull
                                  java.lang.String date,
                                  @Nullable
                                  java.lang.String register,
                                  @Nullable
                                  java.lang.Double subtotal,
                                  @Nullable
                                  java.lang.Double chargedAmount,
                                  @Nullable
                                  java.lang.Double totalAmount,
                                  @Nullable
                                  java.lang.String lastDigits)
        Call to claim order using specific fields
        Parameters:
        id - the id of the transaction
        placeId - the id of the place where transaction was made
        date - the date of the transaction
        register - the register / terminal id where the transaction was made
        subtotal - the subtotal amount of the transaction
        chargedAmount - the charged amount
        totalAmount - the total amount
        lastDigits - the last digitss
      • onClaimSuccess

        protected void onClaimSuccess​(Retroclaim data)
        Called after a successful request on Retroclaim
        Parameters:
        data - Claim information
      • onClaimFailed

        protected void onClaimFailed​(int errorCode,
                                     java.lang.String error)
        Called after a failed request on Retroclaim
        Parameters:
        errorCode - code of the error
        error - error message
      • getClaimListener

        protected ListenerModel getClaimListener()
        Returns an instance of the ListenerModel for BaseData and Retroclaim Override this method to change default behavior of the listener
        Returns:
        listener for Claim response