Interface ICustomerService

  • All Superinterfaces:
    IInterface
    All Known Implementing Classes:
    ICustomerService.Default, ICustomerService.Stub

    public interface ICustomerService
    extends IInterface
    An interface for interacting with the Clover customer service. The customer service is a bound AIDL service. Bind to this service as follows:
     
     Intent serviceIntent = new Intent(CustomerIntent.ACTION_CUSTOMER_SERVICE);
     serviceIntent.putExtra(Intents.EXTRA_ACCOUNT, CloverAccount.getAccount(context));
     serviceIntent.putExtra(Intents.EXTRA_VERSION, 1);
     context.bindService(serviceIntent);
     
     
    For more information about bound services, refer to the Android documentation: Bound Services

    You may also interact with the customer service through the CustomerConnector class, which handles binding and asynchronous invocation of service methods.

    See Also:
    CustomerIntent, CloverAccount, CustomerConnector
    • Method Detail

      • getCustomers

        List<Customer> getCustomers​(String query,
                                    ResultStatus resultStatus)
                             throws RemoteException
        Get a list of customers for the merchant bound to the service.
        Parameters:
        query - A string that we be used to match the first name, last name or phone number against.
        Returns:
        A list of Customer objects, or null if the service call fails.
        Throws:
        RemoteException
      • getCustomer

        Customer getCustomer​(String customerId,
                             ResultStatus resultStatus)
                      throws RemoteException
        Returns a single customer for the merchant bound to the service.

        This call will return immediately with the local version of the customer if one exists on the device, it will then contact the server to check for an updated version. If a new version exists a CustomerIntent.ACTION_CUSTOMER_UPDATE broadcast will be sent.

        If no local version of the customer is available then the service will go directly to the server to fetch the customer.

        Parameters:
        id - The id of the customer being requested.
        Returns:
        A Customer object.
        Throws:
        RemoteException
      • createCustomer

        Customer createCustomer​(String firstName,
                                String lastName,
                                boolean marketingAllowed,
                                ResultStatus resultStatus)
                         throws RemoteException
        Creates a new customer for the merchant bound to the service.

        This call will return immediately with the new customer.

        Parameters:
        firstName - The first name of the customer, can be null.
        lastName - The last name of the customer, can be null.
        marketingAllowed - A boolean value of whether or not the customer has authorized direct marketing. Please set to false unless you have explicitly asked the customer.
        Returns:
        A Customer object.
        Throws:
        RemoteException
      • setName

        void setName​(String customerId,
                     String firstName,
                     String lastName,
                     ResultStatus resultStatus)
              throws RemoteException
        Update the name on the given customer.
        Parameters:
        customerId - The id of the customer.
        firstName - The first name of the customer, can be null.
        lastName - The last name of the customer, can be null.
        Throws:
        RemoteException
      • setMarketingAllowed

        void setMarketingAllowed​(String customerId,
                                 boolean marketingAllowed,
                                 ResultStatus resultStatus)
                          throws RemoteException
        Update the marketing allowed value on a given customer.
        Parameters:
        customerId - The id of the customer.
        marketingAllowed - A boolean value of whether or not the customer has authorized direct marketing. Please set to false unless you have explicitly asked the customer.
        Throws:
        RemoteException
      • addPhoneNumber

        PhoneNumber addPhoneNumber​(String customerId,
                                   String phoneNumber,
                                   ResultStatus resultStatus)
                            throws RemoteException
        Creates a new phone number and adds it to the specified customer

        This call will return immediately with the new phone number object.

        Parameters:
        customerId - The id of the customer.
        phoneNumber - The phone number.
        Returns:
        A PhoneNumber object.
        Throws:
        RemoteException
      • setPhoneNumber

        void setPhoneNumber​(String customerId,
                            String phoneNumberId,
                            String phoneNumber,
                            ResultStatus resultStatus)
                     throws RemoteException
        Updates a given phone number on a customer.
        Parameters:
        customerId - The id of the customer.
        phoneNumberId - The id of the phone number.
        phoneNumber - The new phone number.
        Throws:
        RemoteException
      • deletePhoneNumber

        void deletePhoneNumber​(String customerId,
                               String phoneNumber,
                               ResultStatus resultStatus)
                        throws RemoteException
        Deletes a given phone number from the customer.
        Parameters:
        customerId - The id of the customer.
        phoneNumberId - The id of the phone number.
        Throws:
        RemoteException
      • addEmailAddress

        EmailAddress addEmailAddress​(String customerId,
                                     String emailAddress,
                                     ResultStatus resultStatus)
                              throws RemoteException
        Creates a new email address and adds it to the specified customer

        This call will return immediately with the new email address object..

        Parameters:
        customerId - The id of the customer.
        emailAddress - The email address.
        Returns:
        A EmailAddress object.
        Throws:
        RemoteException
      • setEmailAddress

        void setEmailAddress​(String customerId,
                             String emailAddressId,
                             String emailAddress,
                             ResultStatus resultStatus)
                      throws RemoteException
        Updates a given email address on a customer.
        Parameters:
        customerId - The id of the customer.
        emailAddressId - The id of the email address.
        emailAddress - The new email address.
        Throws:
        RemoteException
      • deleteEmailAddress

        void deleteEmailAddress​(String customerId,
                                String emailAddressId,
                                ResultStatus resultStatus)
                         throws RemoteException
        Deletes a given email address from the customer.
        Parameters:
        customerId - The id of the customer.
        emailAddressId - The id of the email address.
        Throws:
        RemoteException
      • addAddress

        Address addAddress​(String customerId,
                           String address1,
                           String address2,
                           String address3,
                           String city,
                           String state,
                           String zip,
                           ResultStatus resultStatus)
                    throws RemoteException
        Creates an address and adds it to the specified customer

        This call will return immediately with the new address object.

        Parameters:
        customerId - The id of the customer.
        address1 - The first row of an address.
        address2 - The second row of an address.
        address3 - The third row of an address.
        city - The city.
        state - The state.
        zip - The zip (postal code).
        Returns:
        A Address object.
        Throws:
        RemoteException
      • setAddress

        void setAddress​(String customerId,
                        String addressId,
                        String address1,
                        String address2,
                        String address3,
                        String city,
                        String state,
                        String zip,
                        ResultStatus resultStatus)
                 throws RemoteException
        Updates a given address on a customer.
        Parameters:
        customerId - The id of the customer.
        addressId - The id of the email address.
        address1 - The first row of an address.
        address2 - The second row of an address.
        address3 - The third row of an address.
        city - The city.
        state - The state.
        zip - The zip (postal code).
        Throws:
        RemoteException
      • deleteAddress

        void deleteAddress​(String customerId,
                           String addressId,
                           ResultStatus resultStatus)
                    throws RemoteException
        Deletes a given address from the customer.
        Parameters:
        customerId - The id of the customer.
        addressId - The id of the address.
        Throws:
        RemoteException
      • addCard

        Card addCard​(String customerId,
                     Card card,
                     ResultStatus resultStatus)
              throws RemoteException
        Creates a new vaulted credit/debit card record and adds it to the specified customer

        This call will return immediately with the new Card object

        Parameters:
        customerId - The id of the customer.
        card - The card info.
        Returns:
        A Card object.
        Throws:
        RemoteException
      • setCard

        void setCard​(String customerId,
                     String cardId,
                     Card card,
                     ResultStatus resultStatus)
              throws RemoteException
        Updates a given debit/credit card record for a customer.
        Parameters:
        customerId - The id of the customer.
        cardId - The id of the credit/debit card.
        card - The new card info.
        Throws:
        RemoteException
      • deleteCard

        void deleteCard​(String customerId,
                        String cardId,
                        ResultStatus resultStatus)
                 throws RemoteException
        Deletes a given card record from the customer.
        Parameters:
        customerId - The id of the customer.
        cardId - The id of the credit/debit card.
        Throws:
        RemoteException