PaymentPresenter extends PresenterWidget<PaymentPresenter.MyView> implements PaymentUiHandlers, PaymentDetailsUpdatedEventHandler, ShoppingCartChangedEventHandler { @Override public void onSubmit(String name, String number, String cvc, int expMonth, int expYear) { getView().disablePaymentSubmit(); final CreditCard creditCard = new CreditCard.Builder() .name(name) .creditCardNumber(number) .cvc(cvc) .expirationMonth(expMonth) .expirationYear(expYear) .build(); stripe.getCreditCardToken(creditCard, (status, creditCardResponse) -> { if (status == SC_PAYMENT_REQUIRED) { getView().showErrorMessage("An error occurred. Please verify your credit card details."); } else if (status != SC_OK) { getView().showErrorMessage("An error occurred."); } else { PaymentInfoDto paymentInfo = new PaymentInfoDto(creditCardResponse.getId()); pay(paymentInfo); } }); } @Inject  PaymentPresenter(
            EventBus eventBus,
            MyView view,
            Config config,
            Stripe stripe,
            ResourceDelegate<PaymentResource> paymentResource,
            CurrentOrder currentOrder); @Override void onShoppingCartChanged(ShoppingCartChangedEvent event); @Override void onSubmit(String name, String number, String cvc, int expMonth, int expYear); @Override void onValidUpdate(); @Override void onInvalidUpdate();  }
@Test public void onSubmit_disablesPaymentSubmitInViewToAvoidSubmittingPaymentMultipleTimes() { presenter.onSubmit(NAME, CARD_NUMBER, CVS, EXP_MONTH, EXP_YEAR); verify(view).disablePaymentSubmit(); }