FILTER BY TAG

Sale with Auto Rental Details

Use this information to process a sale with auto rental details. This transaction includes required auto rental details in the payment request.
Follow these steps to process a sale with auto rental details.
  1. Create an
    AdditionalDetails
    object and set one or more of the auto rental fields.
    val autoRentalDetails = AdditionalDetailsBuilder() .autoRentalDetails( // Set value of the builder to the number of rental days AutoRentalDetailsBuilder("5") .pickUpState("CA") .pickUpTime(SimpleDateFormat("HHmmss", Locale.US).parse("093000")) .programCode("01") .ratePerMile(BigDecimal("0.25")) .regularMileageCost(BigDecimal("50.00")) .rentalAddress("1 Market St") .rentalLocationID("LOC001") .renterName("Bob Smith") .returnCity("Los Angeles") .returnCountry("USA") .returnDate(SimpleDateFormat("MMddyyyy", Locale.US).parse("01202024")) .returnLocation("LAX Terminal 1") .returnLocationID("LOC002") .returnState("CA") .specialProgramCode(SpecialProgramCode.NONE) .taxAmount(BigDecimal("18.50")) .taxIndicator(true) .taxRate(BigDecimal("0.08")) .taxStatusIndicator("Y") .taxSummary("18.50") .taxType("VAT") .timePeriod(TimePeriod.DAILY) .towingCharge(BigDecimal("0.00")) .vehicleIdentificationNumber("1FTSW21P34EB12345") .vehicleInsuranceIndicator(true) .vehicleMake("Ford") .vehicleModel("Focus") .weeklyRentalRate(BigDecimal("280.00")) .promotion( PromotionDetailsBuilder() .code("PROMO2024") .additionalCode("WKND10") ) .build() ) .build()
  2. Create a
    TransactionParameters
    object and provide the required information for the payment.
  3. Retrieve the
    transactionIntent
    variable from the
    mposUi
    object and use the
    startActivity
    method to initiate the transaction flow.
    val transactionParameters = TransactionParameters.Builder() .charge(BigDecimal("1.00"), Currency.EUR) .customIdentifier("yourReferenceForTheTransaction") .additionalDetails(autoRentalDetails) .build() val transactionIntent = mposUi.createTransactionIntent(transactionParameters) startActivityForResult(transactionIntent, MposUi.REQUEST_CODE_PAYMENT)
  4. After the transaction is complete and the Summary screen is dismissed, the
    onActivityResult
    method is triggered. This action returns information about the last transaction.
    override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { super.onActivityResult(requestCode, resultCode, data) if (requestCode == MposUi.REQUEST_CODE_PAYMENT) { when (resultCode) { // Result code from a successful transaction MposUi.RESULT_CODE_APPROVED -> { val transactionIdentifier = data?.getStringExtra(MposUi.RESULT_EXTRA_TRANSACTION_IDENTIFIER) Toast.makeText(findViewById(android.R.id.content),"Transaction approved!\nIdentifier: $transactionIdentifier", Toast.LENGTH_LONG).show() } // Result code from a declined, aborted or failed transaction MposUi.RESULT_CODE_FAILED -> { Toast.makeText(findViewById(android.R.id.content), "Transaction was declined, aborted, or failed", Toast.LENGTH_LONG).show() } } } }
  5. Get the full transaction object by retrieving the
    latestTransaction
    property from the
    mposUi
    object.
    val transactionObject = mposUi.latestTransaction