Transaction API - Going to Fallback Intent

google-assistant

#1

Good afternoon. I have a problem in finalizing the purchase of physical product (out of google pay).

The user normally orders a pizza and a dessert. At the end of the pizza order, you are redirected to the Google Pay data verification:

if (this.isGoogleAction ()) {
        return this.removeState('ConfirmacaoPedidoState').toIntent('CheckRequirementsGooglePay');

After everything is verified, the order is generated. I check and confirm the order (by clicking on the suggestion button or saying yes), but the confirmation goes to the Default Fallback Intent. and does not show the message inside TRANSACTION_DECISION:

TRANSACTION_DECISION () {

    if (this.$ googleAction.$ transaction.isOrderAccepted ()) {
      const order = this.$ googleAction.$ transaction.getOrder ();

      order.purchase.status = 'CONFIRMED';
      order.purchase.userVisibleStatusLabel = 'Order confirmed';

      order.lastUpdateTime = new Date (). toISOString ();

      this.$ googleAction.$ transaction.updateOrder (order, 'Reason string');

      return this.tell ('I just confirmed your order. Thank you!')
    } else if (this.$ googleAction.$ transaction.isOrderRejected ()) {
      this.tell ('Purchase rejected.')
    } else {
      this.tell ('Error');
    }

  },

The request shows that the request was accepted: https://gist.github.com/guilhermelirio/4f49117925baa946297227de44a9af36

Would anyone know how to solve this problem? And why are you going to fallback Intent?


#2

Hey @hewitt1708!
Is the ON_TRANSACTION: {} part missing here or did you remove it, to make things clearer?

TRANSACTION_DECISION needs to be in ON_TRANSACTION

ON_TRANSACTION: {
   TRANSACTION_DECISION() {

   }
} 

#3

Thank you very much, that was it. Inattention of mine!