@Override public PaymentMethodModelDao getPaymentMethodByExternalKey( final String paymentMethodExternalKey, final InternalTenantContext context) { synchronized (this) { for (final PaymentMethodModelDao cur : paymentMethods) { if (cur.getExternalKey().equals(paymentMethodExternalKey)) { return cur; } } return null; } }
@Override public PaymentMethodModelDao getPaymentMethod( final UUID paymentMethodId, final InternalTenantContext context) { synchronized (this) { for (final PaymentMethodModelDao cur : paymentMethods) { if (cur.getId().equals(paymentMethodId)) { return cur; } } return null; } }
@Override public void deletedPaymentMethod(final UUID paymentMethodId, final InternalCallContext context) { synchronized (this) { final Iterator<PaymentMethodModelDao> it = paymentMethods.iterator(); while (it.hasNext()) { final PaymentMethodModelDao cur = it.next(); if (cur.getId().equals(paymentMethodId)) { it.remove(); break; } } } }
@Override public List<PaymentMethodModelDao> getPaymentMethods( final UUID accountId, final InternalTenantContext context) { synchronized (this) { final List<PaymentMethodModelDao> result = new ArrayList<PaymentMethodModelDao>(); for (final PaymentMethodModelDao cur : paymentMethods) { if (cur.getAccountId().equals(accountId)) { result.add(cur); } } return result; } }