/** Fills payment details view with general order information. */ private void displayOrderInfo() { final StringBuilder descriptionTextBuilder = new StringBuilder(); final PaymentRequest paymentRequest = mTransaction.getPaymentRequest(); final RTPType rtpType = paymentRequest.getRtpType(); final TransactionId transactionId = mTransaction.getTransactionId(); final String aptrId = transactionId == null ? getString(R.string.transaction_details_not_available) : transactionId.getAptrId(); descriptionTextBuilder.append(getString(R.string.transaction_order_number, aptrId)); descriptionTextBuilder.append(getString(R.string.transaction_confirmation_email_text)); final String orderDate = DATE_FORMAT.format(new Date()); descriptionTextBuilder.append(getString(R.string.transaction_order_date, orderDate)); switch (rtpType) { case IMMEDIATE: descriptionTextBuilder.append( getString(R.string.transaction_order_total, paymentRequest.getAmount().toString())); break; case DEFERRED: descriptionTextBuilder.append( getString( R.string.transaction_order_total, paymentRequest.getDefrdRTPAgrmtAmount().toString())); final Merchant merchant = paymentRequest.getMerchant(); final CurrencyAmount defrdRTPMaxAgrdAmount = paymentRequest.getDefrdRTPMaxAgrdAmount(); if (defrdRTPMaxAgrdAmount != null) { descriptionTextBuilder.append( getString( R.string.transaction_agreed_max_amount, merchant.getName(), defrdRTPMaxAgrdAmount.toString())); } break; default: descriptionTextBuilder.append( getString( R.string.transaction_order_total, getString(R.string.transaction_details_not_available))); break; } mPaymentDescriptionTextView.setText(Html.fromHtml(descriptionTextBuilder.toString())); }
/** Fills payment address view. */ private void displayShippingAddress() { final StringBuilder descriptionTextBuilder = new StringBuilder(); final PaymentAuth paymentAuth = mTransaction.getPaymentAuth(); final PaymentRequest paymentRequest = mTransaction.getPaymentRequest(); final DeliveryType deliveryType = paymentRequest.getDeliveryType(); final DeliveryAddress deliveryAddress = paymentAuth == null ? null : paymentAuth.getDeliveryAddress(); switch (deliveryType) { case ADDRESS: case COLLECT_IN_STORE: case SERVICE: if (paymentRequest.getRtpType() == RTPType.DEFERRED) { if (deliveryAddress != null) { final User user = deliveryAddress.getAddressee(); if (user != null) { final String[] addressArray = { getCustomerName(user), user.getEmail(), user.getPhone(), deliveryAddress.getLine1(), deliveryAddress.getLine2(), deliveryAddress.getLine3(), deliveryAddress.getLine4(), deliveryAddress.getLine5(), deliveryAddress.getLine6(), deliveryAddress.getPostCode(), deliveryAddress.getCountryCode() }; displayAddresseeInfo(descriptionTextBuilder, addressArray); } } } else { // TODO as PaymentAuth does not contain the SettlementStatus, it cannot be used for // payment authorisation for immediate payments, // TODO retrieve the shipping address from PaymentRequest. final User user = paymentRequest.getUser(); final Address address = paymentRequest.getAddress(); if (user != null) { final String[] addressArray = { getCustomerName(user), user.getEmail(), user.getPhone(), address.getLine1(), address.getLine2(), address.getLine3(), address.getLine4(), address.getLine5(), address.getLine6(), address.getPostCode(), address.getCountryCode() }; displayAddresseeInfo(descriptionTextBuilder, addressArray); } } break; case DIGITAL: final User user = paymentAuth != null ? paymentAuth.getUser() : paymentRequest.getUser(); if (user != null) { final String[] addressArray = {getCustomerName(user), user.getEmail(), user.getPhone()}; displayAddresseeInfo(descriptionTextBuilder, addressArray); } break; default: break; } if (descriptionTextBuilder.length() > 0) { mPaymentAddressTextView.setText(Html.fromHtml(descriptionTextBuilder.toString())); mPaymentAddressTextView.setVisibility(View.VISIBLE); } }