@Override public String getSuccessMessage() { return creditCardCharge.getID() == 0 ? getMessages().createSuccessfully(getMessages().creditCardCharge()) : getMessages().updateSuccessfully(getMessages().creditCardCharge()); }
@Override protected String getDetailsMessage() { return creditCardCharge.getID() == 0 ? getMessages().readyToCreate(getMessages().creditCardCharge()) : getMessages().readyToUpdate(getMessages().creditCardCharge()); }
private void setValues() { List<ClientTransactionItem> items = new ArrayList<ClientTransactionItem>(); List<ClientTransactionItem> accounts = new ArrayList<ClientTransactionItem>(); for (ClientTransactionItem clientTransactionItem : creditCardCharge.getTransactionItems()) { if (clientTransactionItem.getType() == ClientTransactionItem.TYPE_ACCOUNT) { accounts.add(clientTransactionItem); } else { items.add(clientTransactionItem); } } get(ACCOUNTS).setValue(accounts); get(ITEMS).setValue(items); get(VENDOR) .setValue( CommandUtils.getServerObjectById( creditCardCharge.getVendor(), AccounterCoreType.VENDOR)); get(CONTACT).setValue(toServerContact(creditCardCharge.getContact())); get(DATE).setValue(creditCardCharge.getDate()); get(NUMBER).setValue(creditCardCharge.getNumber()); get(PAYMENT_METHOD) .setValue( CommandUtils.getPaymentMethod( creditCardCharge.getPaymentMethodForCommands(), getMessages())); get(PHONE).setValue(creditCardCharge.getPhone()); get(PAY_FROM) .setValue( CommandUtils.getServerObjectById( creditCardCharge.getPayFrom(), AccounterCoreType.ACCOUNT)); get(DELIVERY_DATE).setValue(new ClientFinanceDate(creditCardCharge.getDeliveryDate())); get(IS_VAT_INCLUSIVE).setValue(isAmountIncludeTAX(creditCardCharge)); /* get(CURRENCY_FACTOR).setValue(creditCardCharge.getCurrencyFactor()); */ get(MEMO).setValue(creditCardCharge.getMemo()); if (getPreferences().isTrackDiscounts() && !getPreferences().isDiscountPerDetailLine()) { get(DISCOUNT) .setValue(getDiscountFromTransactionItems(creditCardCharge.getTransactionItems())); } }
@Override protected String getWelcomeMessage() { return creditCardCharge.getID() == 0 ? getMessages().creating(getMessages().creditCardCharge()) : "Update credit card charge command is activated"; }
@Override protected Result onCompleteProcess(Context context) { List<ClientTransactionItem> items = get(ITEMS).getValue(); List<ClientTransactionItem> accounts = get(ACCOUNTS).getValue(); if (items.isEmpty() && accounts.isEmpty()) { return new Result(); } Vendor supplier = get(VENDOR).getValue(); creditCardCharge.setVendor(supplier.getID()); Contact contact = get(CONTACT).getValue(); creditCardCharge.setContact(toClientContact(contact)); ClientFinanceDate date = get(DATE).getValue(); creditCardCharge.setDate(date.getDate()); creditCardCharge.setType(ClientTransaction.TYPE_CREDIT_CARD_CHARGE); String number = get(NUMBER).getValue(); creditCardCharge.setNumber(number); String paymentMethod = get(PAYMENT_METHOD).getValue(); creditCardCharge.setPaymentMethod(paymentMethod); String phone = get(PHONE).getValue(); creditCardCharge.setPhone(phone); Account account = get(PAY_FROM).getValue(); creditCardCharge.setPayFrom(account.getID()); ClientFinanceDate deliveryDate = get(DELIVERY_DATE).getValue(); creditCardCharge.setDeliveryDate(deliveryDate); items.addAll(accounts); creditCardCharge.setTransactionItems(items); ClientCompanyPreferences preferences = context.getPreferences(); if (preferences.isTrackTax() && !preferences.isTaxPerDetailLine()) { TAXCode taxCode = get(TAXCODE).getValue(); for (ClientTransactionItem item : items) { item.setTaxCode(taxCode.getID()); } } creditCardCharge.setCurrency(supplier.getCurrency().getID()); creditCardCharge.setCurrencyFactor((Double) get(CURRENCY_FACTOR).getValue()); String memo = get(MEMO).getValue(); creditCardCharge.setMemo(memo); updateTotals(context, creditCardCharge, false); create(creditCardCharge, context); return null; }