server/src/Entity/payment.js
/**
    * Method to create or update the payment status.
    * @param customerId: The customer id for the payment.
    * @returns {Promise<unknown>}
    */
Method to create or update the payment status.
@param customerId: The customer id for the payment.
@returns {Promise}
Method to create or update the payment status . @param customerId : The customer id for the payment . @returns { Promise }
createPayment(customerId) {
      return new Promise((resolve, reject) => {
         database.runSp(constants.SP_PAYMENT_CREATE, [this._bookingID, this._transactionID,
            constants.STATUS_AUTHORIZED, customerId, this._amount])
            .then(async _resultSet => {
               const result = _resultSet[0][0];
               if (validators.validateUndefined(result)) {
                  this._paymentID = result.id;
                  await this._capturePayment(customerId);
                  resolve(result);
               } else {
                  reject(false);
               }
            }).catch(err => {
            printer.printError(err);
            reject(err);
         });
      });
   }
createPayment ( customerId ) { return new Promise ( ( resolve , reject ) => { database . runSp ( constants . SP_PAYMENT_CREATE , [ this . _bookingID , this . _transactionID , constants . STATUS_AUTHORIZED , customerId , this . _amount ] ) . then ( async _resultSet => { const result = _resultSet [ 0 ] [ 0 ] ; if ( validators . validateUndefined ( result ) ) { this . _paymentID = result . id ; await this . _capturePayment ( customerId ) ; resolve ( result ) ; } else { reject ( false ) ; } } ) . catch ( err => { printer . printError ( err ) ; reject ( err ) ; } ) ; } ) ; }
Method to create or update the payment status.
Method to create or update the payment status .