protected String getInstanceUrl() { if (this.getCustomer() != null) { return String.format("%s/%s/sources/%s", classUrl(Customer.class), this.getCustomer(), this.getId()); } else if (this.getAccount() != null) { return String.format("%s/%s/external_accounts/%s", classUrl(Account.class), this.getAccount(), this.getId()); } else { return null; } } }
/** * Verifies a bank account. * * @param params request parameters * @param options request options * @return the verified bank account */ public ExternalAccount verify(Map<String, Object> params, RequestOptions options) throws StripeException { if (this.getCustomer() != null) { return request(RequestMethod.POST, String.format("%s/verify", this.getInstanceUrl()), params, ExternalAccount.class, options); } else { throw new InvalidRequestException( "Only customer bank accounts can be verified in this manner.", null, null, null, 0, null); } } // </editor-fold>