third_party/subscriptions-project/swg.js
/**
   * Request payment data when payment method is UPI
   *
   * @param {!PaymentDataRequest} paymentDataRequest Provides necessary
   *     information to support a payment.
   * @param {!Object} upiPaymentMethod UPI paymentmethod in
   *     allowedPaymentMethods array.
   * @param {!Function} onResultCallback Function to call when everything is
   *     done.
   */
Request payment data when payment method is UPI
@param {!PaymentDataRequest} paymentDataRequest Provides necessary
information to support a payment.
@param {!Object} upiPaymentMethod UPI paymentmethod in
allowedPaymentMethods array.
@param {!Function} onResultCallback Function to call when everything is
done.
Request payment data when payment method is UPI @param { !PaymentDataRequest } paymentDataRequest Provides necessary information to support a payment . @param { !Object } upiPaymentMethod UPI paymentmethod in allowedPaymentMethods array . @param { !Function } onResultCallback Function to call when everything is done .
loadPaymentData(paymentDataRequest, upiPaymentMethod, onResultCallback) {
    const parameters = upiPaymentMethod['parameters'];
    const transactionInfo = paymentDataRequest['transactionInfo'];
    const supportedInstruments = [{
          'supportedMethods': ['https://tez.google.com/pay'],
          'data': {
            'pa': parameters['payeeVpa'],
            'pn': parameters['payeeName'],
            'tr': parameters['transactionReferenceId'],
            'url': parameters['referenceUrl'],
            'mc': parameters['mcc'],
            'tn': transactionInfo['transactionNote'],
          },
        }];
    if (parameters['transactionId']) {
      supportedInstruments[0]['data']['tid'] = parameters['transactionId'];
    }
    const details = {
      'total': {
        'label': 'Total',
        'amount': {
          'currency': transactionInfo['currencyCode'],
          'value': transactionInfo['totalPrice'],
        },
      },
      'displayItems': [{
        'label': 'Original Amount',
        'amount': {
          'currency': transactionInfo['currencyCode'],
          'value': transactionInfo['totalPrice'],
        },
      }],
    };
    let request = new PaymentRequest(supportedInstruments, details);
    onResultCallback(
        this.checkCanMakePayment_(request)
            .then(result => {
              if (result) {
                return this.showUi_(request);
              } else {
                return this.redirectToGooglePlay_();
              }
            })
            .then(paymentData => {
              return this.processData_(
                  paymentData, paymentDataRequest, upiPaymentMethod);
            })
            .catch(error => {
              error['statusCode'] = Constants.ResponseStatus.CANCELED;
              return Promise.reject(error);
            }));
  }
loadPaymentData ( paymentDataRequest , upiPaymentMethod , onResultCallback ) { const parameters = upiPaymentMethod [ 'parameters' ] ; const transactionInfo = paymentDataRequest [ 'transactionInfo' ] ; const supportedInstruments = [ { 'supportedMethods' : [ 'https://tez.google.com/pay' ] , 'data' : { 'pa' : parameters [ 'payeeVpa' ] , 'pn' : parameters [ 'payeeName' ] , 'tr' : parameters [ 'transactionReferenceId' ] , 'url' : parameters [ 'referenceUrl' ] , 'mc' : parameters [ 'mcc' ] , 'tn' : transactionInfo [ 'transactionNote' ] , } , } ] ; if ( parameters [ 'transactionId' ] ) { supportedInstruments [ 0 ] [ 'data' ] [ 'tid' ] = parameters [ 'transactionId' ] ; } const details = { 'total' : { 'label' : 'Total' , 'amount' : { 'currency' : transactionInfo [ 'currencyCode' ] , 'value' : transactionInfo [ 'totalPrice' ] , } , } , 'displayItems' : [ { 'label' : 'Original Amount' , 'amount' : { 'currency' : transactionInfo [ 'currencyCode' ] , 'value' : transactionInfo [ 'totalPrice' ] , } , } ] , } ; let request = new PaymentRequest ( supportedInstruments , details ) ; onResultCallback ( this . checkCanMakePayment_ ( request ) . then ( result => { if ( result ) { return this . showUi_ ( request ) ; } else { return this . redirectToGooglePlay_ ( ) ; } } ) . then ( paymentData => { return this . processData_ ( paymentData , paymentDataRequest , upiPaymentMethod ) ; } ) . catch ( error => { error [ 'statusCode' ] = Constants . ResponseStatus . CANCELED ; return Promise . reject ( error ) ; } ) ) ; }
Request payment data when payment method is UPI
 @param {!PaymentDataRequest} paymentDataRequest Provides necessary
     information to support a payment.
Request payment data when payment method is UPI @param { !PaymentDataRequest } paymentDataRequest Provides necessary information to support a payment .