2.6.0

Breaking changes:

  • Se cambio el repositorio de instalación de maven a jitpack.io. Mas información en la guía de instalación.
  • Se eliminó el callback onCanceled a favor del callback onClosed.
  • Los callbacks onCardBinDetected y onInstallmentSelected solo tienen como payload la metadata de la tarjeta.
  • El callback onSuccess en su payload ahora contiene únicamente los datos de la orden.
  • Se eliminó la función closePaymentWidget en favor de la función close.

Antes:

        deunaSDK.initPaymentWidget(
            context = context,
            orderToken = orderToken.value.trim(),
            callbacks = PaymentWidgetCallbacks().apply {
                onSuccess = { data ->
                    deunaSDK.closePaymentWidget()  // BREAKING CHANGE - DELETED
                     val orderId =  (data["order"] as Json)["order_id"] // BREAKING CHANGE
                    // YOUR CODE HERE
                }
                onCanceled = { // BREAKING CHANGE
                    // YOUR CODE HERE
                }
                onError = { error ->

                }
                onClosed = {

                }
                onCardBinDetected = { cardBinMetadata, refetchOrder -> // BREAKING CHANGE
                    // YOUR CODE HERE
                }
                onInstallmentSelected = { cardBinMetadata, refetchOrder -> // BREAKING CHANGE
                    // YOUR CODE HERE
                }
            },
        )

Ahora:

    deunaSDK.initPaymentWidget(
        context = context,
        orderToken = orderToken.value.trim(),
        callbacks = PaymentWidgetCallbacks().apply {
            onSuccess = { order ->
                deunaSDK.close() // NOW
                 val orderId = order["order_id"] // NOW
            }
            onError = { error ->
                when (error.type) {
                    // The widget could not be loaded
                    PaymentsError.Type.INITIALIZATION_FAILED -> {
                        deunaSDK.close()// NOW
                    }

                    // The payment was failed
                    PaymentsError.Type.PAYMENT_ERROR -> {
                        // YOUR CODE HERE
                        Log.i(DEBUG_TAG, error.type.name)
                    }

                    else -> {}
                }
            }
            onClosed = { action -> // NOW
                if (action == CloseAction.userAction) { // payment process was canceled
                    
                }

            }
            onCardBinDetected = { cardBinMetadata -> // NOW
                deunaSDK.refetchOrder { order ->
                    if (order != null) {
                        Log.d(DEBUG_TAG, "refetchOrder $order")
                    } else {
                        Log.d(DEBUG_TAG, "refetchOrder has failed")
                    }

                }
            }
        },

    )