protected boolean isMessageAlreadyProcessed( String messageId, Account account, String storeBucket, Set<String> storeMessageIds) throws MessageStoreException { return messageId != null && (storeMessageIds.contains(messageId) || messageIdStore.hasMessage( account.getId(), storeBucket, messageId, account.getCountry())); }
@Test public void getAccountTest() throws IOException, VscaleException { Result<Account> query = this.api.account(); Account account = query.get(); assertNotNull(account.getActivationDate()); assertNotNull(account.getCountry()); assertNotNull(account.getId()); assertNotNull(account.getEmail()); assertNotNull(account.getFaceId()); assertNotNull(account.getState()); assertNotNull(account.getLocale()); assertNotNull(account.getMobile()); assertNotNull(account.getName()); assertNotNull(account.getSurname()); }
/** * @param currentAccount existing account data * @return merged account data */ @Override public Account mergeWithDelegate(final Account currentAccount) { final DefaultMutableAccountData accountData = new DefaultMutableAccountData(this); if (externalKey != null && currentAccount.getExternalKey() != null && !currentAccount.getExternalKey().equals(externalKey)) { throw new IllegalArgumentException( String.format( "Killbill doesn't support updating the account external key yet: new=%s, current=%s", externalKey, currentAccount.getExternalKey())); } else { // Default to current value accountData.setExternalKey(currentAccount.getExternalKey()); } if (currency != null && currentAccount.getCurrency() != null && !currentAccount.getCurrency().equals(currency)) { throw new IllegalArgumentException( String.format( "Killbill doesn't support updating the account currency yet: new=%s, current=%s", currency, currentAccount.getCurrency())); } else { // Default to current value accountData.setCurrency(currentAccount.getCurrency()); } if (billCycleDayLocal != null && billCycleDayLocal != 0 && currentAccount.getBillCycleDayLocal() != 0 && !billCycleDayLocal.equals(currentAccount.getBillCycleDayLocal())) { throw new IllegalArgumentException( String.format( "Killbill doesn't support updating the account BCD yet: new=%s, current=%s", billCycleDayLocal, currentAccount.getBillCycleDayLocal())); } else if (billCycleDayLocal != null && billCycleDayLocal != 0) { // Junction sets it accountData.setBillCycleDayLocal(billCycleDayLocal); } else { // Default to current value accountData.setBillCycleDayLocal(currentAccount.getBillCycleDayLocal()); } // Set all updatable fields with the new values if non null, otherwise defaults to the current // values accountData.setEmail(Objects.firstNonNull(email, currentAccount.getEmail())); accountData.setName(Objects.firstNonNull(name, currentAccount.getName())); accountData.setFirstNameLength( Objects.firstNonNull(firstNameLength, currentAccount.getFirstNameLength())); accountData.setPaymentMethodId( Optional.<UUID>fromNullable(paymentMethodId) .or(Optional.<UUID>fromNullable(currentAccount.getPaymentMethodId())) .orNull()); accountData.setTimeZone(Objects.firstNonNull(timeZone, currentAccount.getTimeZone())); accountData.setLocale(Objects.firstNonNull(locale, currentAccount.getLocale())); accountData.setAddress1(Objects.firstNonNull(address1, currentAccount.getAddress1())); accountData.setAddress2(Objects.firstNonNull(address2, currentAccount.getAddress2())); accountData.setCompanyName(Objects.firstNonNull(companyName, currentAccount.getCompanyName())); accountData.setCity(Objects.firstNonNull(city, currentAccount.getCity())); accountData.setStateOrProvince( Objects.firstNonNull(stateOrProvince, currentAccount.getStateOrProvince())); accountData.setCountry(Objects.firstNonNull(country, currentAccount.getCountry())); accountData.setPostalCode(Objects.firstNonNull(postalCode, currentAccount.getPostalCode())); accountData.setPhone(Objects.firstNonNull(phone, currentAccount.getPhone())); accountData.setIsMigrated(Objects.firstNonNull(isMigrated, currentAccount.isMigrated())); accountData.setIsNotifiedForInvoices( Objects.firstNonNull(isNotifiedForInvoices, currentAccount.isNotifiedForInvoices())); return new DefaultAccount(currentAccount.getId(), accountData); }