Class ReferralCustomerService

java.lang.Object
com.easypost.service.ReferralCustomerService

public class ReferralCustomerService extends Object
  • Method Details

    • create

      public ReferralCustomer create(Map<String,Object> params) throws EasyPostException
      Create a Referral Customer object from parameter map. This function requires the Partner User's API key.
      Parameters:
      params - Map of the referral user parameters.
      Returns:
      Referral object.
      Throws:
      EasyPostException - when the request fails.
    • updateEmail

      public void updateEmail(String email, String userId) throws EasyPostException
      Update a Referral object email. This function requires the Partner User's API key.
      Parameters:
      email - Email of the referral user to update.
      userId - ID of the referral user to update.
      Throws:
      EasyPostException - when the request fails.
    • all

      List all Referral objects. This function requires the Partner User's API key.
      Parameters:
      params - Map of parameters.
      Returns:
      ReferralCustomerCollection object.
      Throws:
      EasyPostException - when the request fails.
    • getNextPage

      Get the next page of an ReferralCustomerCollection.
      Parameters:
      collection - ReferralCustomerCollection to get next page of.
      Returns:
      ReferralCustomerCollection object.
      Throws:
      EndOfPaginationError - when there are no more pages to retrieve.
    • getNextPage

      public ReferralCustomerCollection getNextPage(ReferralCustomerCollection collection, Integer pageSize) throws EndOfPaginationError
      Get the next page of an ReferralCustomerCollection.
      Parameters:
      collection - ReferralCustomerCollection to get next page of.
      pageSize - The number of results to return on the next page.
      Returns:
      ReferralCustomerCollection object.
      Throws:
      EndOfPaginationError - when there are no more pages to retrieve.
    • addCreditCardToUser

      public PaymentMethodObject addCreditCardToUser(String referralApiKey, String number, int expirationMonth, int expirationYear, String cvc) throws EasyPostException
      Add credit card to a referral user. This function requires the Referral User's API key.
      Parameters:
      referralApiKey - API key of the referral user.
      number - Credit card number.
      expirationMonth - Expiration month of the credit card.
      expirationYear - Expiration year of the credit card.
      cvc - CVC of the credit card.
      Returns:
      PaymentMethodObject object.
      Throws:
      EasyPostException - when the request fails.
    • addCreditCardToUser

      public PaymentMethodObject addCreditCardToUser(String referralApiKey, String number, int expirationMonth, int expirationYear, String cvc, PaymentMethod.Priority priority) throws EasyPostException
      Add credit card to a referral user. This function requires the Referral User's API key.
      Parameters:
      referralApiKey - API key of the referral user.
      number - Credit card number.
      expirationMonth - Expiration month of the credit card.
      expirationYear - Expiration year of the credit card.
      cvc - CVC of the credit card.
      priority - Priority of this credit card.
      Returns:
      PaymentMethodObject object.
      Throws:
      EasyPostException - when the request fails.
    • addCreditCardFromStripe

      public PaymentMethodObject addCreditCardFromStripe(String referralApiKey, String paymentMethodId, PaymentMethod.Priority priority) throws EasyPostException
      Add a credit card to EasyPost for a ReferralCustomer with a payment method ID from Stripe. This function requires the ReferralCustomer User's API key.
      Parameters:
      referralApiKey - API key of the referral user.
      paymentMethodId - Payment method ID from Stripe.
      priority - Priority of the credit card (e.g., "primary" or "secondary").
      Returns:
      PaymentMethodObject object.
      Throws:
      EasyPostException - when the request fails.
    • addBankAccountFromStripe

      public PaymentMethodObject addBankAccountFromStripe(String referralApiKey, String financialConnectionsId, Map<String,Object> mandateData, PaymentMethod.Priority priority) throws EasyPostException
      Add a bank account to EasyPost for a ReferralCustomer. This function requires the ReferralCustomer User's API key.
      Parameters:
      referralApiKey - API key of the referral user.
      financialConnectionsId - Financial connections ID from Stripe.
      mandateData - Mandate data for the bank account.
      priority - Priority of the bank account (e.g., "primary" or "secondary").
      Returns:
      PaymentMethodObject object.
      Throws:
      EasyPostException - when the request fails.