On This Page
Sale with Lodging Details
Use this information to process a sale with lodging details. This transaction
includes the required lodging details in the payment request.
Follow these steps to process a sale with lodging details.
- Create aLodgingDetailsobject and set one or more lodging fields.// Set value of the builder to the duration of stay val lodgingDetails = LodgingDetailsBuilder(3) .checkInDate("030125") .checkOutDate("030425") .guestSmokingPreference("N") .numberOfGuests(2) .numberOfRoomsBooked(1) .guestName("John Doe") .roomLocation("Ocean View") .roomTaxElements("VAT") .roomBedType("KING") .roomRateType("CORPORATE") .specialProgramCode("1") .dailyRoomRate1(BigDecimal("150.00")) .dailyRoomRate2(BigDecimal("160.00")) .dailyRoomRate3(BigDecimal("170.00")) .roomNights1(1) .roomNights2(1) .roomNights3(1) .corporateClientCode("CORP123456") .promotionalCode("PROMO2025") .additionalCoupon("DISCOUNT10") .travelAgencyCode("TA789") .travelAgencyName("Premium Travel Agency") .customerServicePhoneNumber("1-800-555-0199") .tax(BigDecimal("45.00")) .prepaidCost(BigDecimal("200.00")) .foodAndBeverageCost(BigDecimal("125.00")) .roomTax(BigDecimal("30.00")) .adjustmentAmount(BigDecimal("15.00")) .phoneCost(BigDecimal("8.00")) .restaurantCost(BigDecimal("95.00")) .roomServiceCost(BigDecimal("40.00")) .miniBarCost(BigDecimal("25.00")) .laundryCost(BigDecimal("18.00")) .miscellaneousCost(BigDecimal("12.00")) .giftShopCost(BigDecimal("35.00")) .movieCost(BigDecimal("10.00")) .healthClubCost(BigDecimal("20.00")) .valetParkingCost(BigDecimal("30.00")) .cashDisbursementCost(BigDecimal("5.00")) .nonRoomCost(BigDecimal("40.00")) .businessCenterCost(BigDecimal("15.00")) .loungeBarCost(BigDecimal("55.00")) .transportationCost(BigDecimal("75.00")) .gratuityCost(BigDecimal("45.00")) .conferenceRoomCost(BigDecimal("120.00")) .audioVisualCost(BigDecimal("65.00")) .banquetCost(BigDecimal("180.00")) .internetAccessCost(BigDecimal("12.00")) .earlyCheckOutCost(BigDecimal("20.00")) .nonRoomTax(BigDecimal("25.00")) .build()
- Create aTransactionParametersobject and provide the required information for the payment.
- Retrieve thetransactionIntentfrom themposUiobject and use thestartActivitymethod to initiate the transaction flow.val transactionParameters = TransactionParameters.Builder() .charge(BigDecimal("1.00"), Currency.EUR) .customIdentifier("yourReferenceForTheTransaction") .lodgingDetails(lodgingDetails) .build() val transactionIntent = mposUi.createTransactionIntent(transactionParameters) startActivityForResult(transactionIntent, MposUi.REQUEST_CODE_PAYMENT)
- After the transaction is complete and the Summary screen is dismissed, theonActivityResultis 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() } } } }
- You can get the full transaction object by retrieving thelatestTransactionfrom themposUiobject.val transactionObject = mposUi.latestTransaction