Android – Using the JPAddCardActivity 2017-05-16T13:26:35+00:00

Android – Using the JPAddCardActivity

JPAddCardActivity can be used to collect a full set of customer details. These details include the customer name, customer payment card, and payment card billing address.

The text entry fields displayed by JPAddCardActivity are determined from JPConfiguration. Some fields may not require collecting. By setting JPConfiguration‘s  requiredAddressFields property, specific address fields will be displayed. For example, for AVS registered merchants, you will require all address fields.

JPAddCardActivity displays a number of text entry fields for collecting the above data. These fields can be pre-populated.

JPAddCardActivity can be cancelled or saved, and feedback is provided through the JPAddCardActivityListener interface. When saving data, JPAddCardActivity saves this data to the shared JPPaymentContext.

JPAddCardActivity self-validates. The Save button will not be enabled by JPAddCardActivity unless it recognises all data entry fields are complete and valid.

For collecting payment card details, JPAddCardActivity uses JPPaymentCardHorizontalFragment.

For more details, please see the JetPay Full Android SDK Reference.

This snippet illustrates how to present an instance of JPAddCardActivity:

public void onClickCollectCustomerDetails( View view ) {
   Intent i = new Intent( this, jetpay.co.uk.jetpay.JPAddCardActivity.class );
   i.putExtra( JP_CELL_CONTENT_INSETS_EXTRA_KEY, new JPEdgeInsets( 0, 50, 0, 50 ) );
   startActivityForResult( i, JP_COLLECT_CUSTOMER_DETAILS );
}

@Override
protected void onActivityResult( int requestCode, int resultCode, Intent data ) {
   if (requestCode == JP_COLLECT_CUSTOMER_DETAILS) {
      /* user saved - data has been saved to  */
   } else {
      /* user cancelled activity */
   }
}