On This Page
Sale with Airline Details
Use this information to process a sale with airline details. This transaction
includes required airline details and related service details in the payment
request.
Follow these steps to process a sale with airline details.
- Create anAdditionalDetailsobject and set one or more airline (airlineDetails) fields and related service (ancillaryDetails) fields.val airlineDetails = AdditionalDetailsBuilder() .airlineDetails( AirlineDetailsBuilder() .agentCode("AGT12345") .agentName("Visa Travel") .arrivalDate(SimpleDateFormat("MMddyyyy", Locale.US).parse("01202024")) .carrierName("Visa Airways") .clearingCount(1) .clearingSequence("1") .creditReasonIndicator(CreditReasonIndicator.OTHER) .customerCode("CORP12345") .documentType(DocumentType.AIRLINE) .electronicTicket(true) .exchangeTicketAmount(BigDecimal("0.00")) .exchangeTicketFee(BigDecimal("0.00")) .firstName("John") .lastName("Doe") .numberOfPassengers("1") .passengerName("John Doe") .planNumber("01") .purchaseType(PurchaseType.TICKET) .reservationSystem("00001") .restrictedTicketIndicator(RestrictedTicketIndicator.NONREFUNDABLE) .ticketIssueDate(SimpleDateFormat("yyyyMMdd", Locale.US).parse("20240115")) .ticketIssuerAddress("1 Market St") .ticketIssuerCity("San Francisco") .ticketIssuerCode("UA") .ticketNumber("0141234567890") .ticketRestrictionText("00000") .ticketUpdateIndicator(TicketUpdateIndicator.NEW) .totalClearingAmount("450.00") .totalFee(BigDecimal("25.00")) .addLegDetails( listOf( LegDetailsBuilder() .arrivalTime("1230") .arrivalTimeSegment(TimeSegment.PM) .carrierCode("UA") .legClass("Y") .conjunctionTicket("0141234567891") .couponNumber("1") .departureDate(SimpleDateFormat("yyyyMMdd", Locale.US).parse("20240115")) .departureTime("0930") .departureTimeSegment(TimeSegment.AM) .destination("JFK") .endorsementsRestrictions("NONREF") .exchangeTicket("0141234567892") .fare(BigDecimal("450.00")) .fareBasis("Y26") .fee(BigDecimal("25.00")) .flightNumber("1234") .originatingAirportCode("SFO") .stopoverCode(StopoverCode.NO_STOPOVER) .tax(BigDecimal("38.00")) ) ) .build() ) .ancillaryDetails( AncillaryDetailsBuilder() .connectedTicketNumber("0149876543210") .creditReasonIndicator(CreditReasonIndicator.OTHER) .feeDescription("Checked baggage") .passengerName("Jane Doe") .ticketNumber("0141234567890") .addServiceDetails( listOf( ServiceDetailsBuilder() .categoryCode("BAGO") .subcategoryCode("CHKD") .feeAmount(BigDecimal("35.00")) .feeCode("0DB") ) ) .build() ) .build()
- Create aTransactionParametersobject and provide the required information for the payment.
- Retrieve thetransactionIntentvariable from themposUiobject and use thestartActivitymethod to initiate the transaction flow.val transactionParameters = TransactionParameters.Builder() .charge(BigDecimal("1.00"), Currency.EUR) .customIdentifier("yourReferenceForTheTransaction") .additionalDetails(airlineDetails) .build() val transactionIntent = mposUi.createTransactionIntent(transactionParameters) startActivityForResult(transactionIntent, MposUi.REQUEST_CODE_PAYMENT)
- After the transaction is complete and the Summary screen is dismissed, theonActivityResultmethod 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() } } } }
- Get the full transaction object by retrieving thelatestTransactionproperty from themposUiobject.val transactionObject = mposUi.latestTransaction