private async Task<Result<GTokenTransactionModel>> ExecuteGTokenTransaction(Result<GTokenTransactionModel> gTokenTransaction, GoEatApi goEatApi) { //execute transaction gTokenTransaction.Data.transaction.status = ConstantValues.S_SUCCESS; gTokenTransaction = await goEatApi.ExecuteGTokenTransaction(gTokenTransaction.Data.transaction); return gTokenTransaction; }
// Call CreateGtoken to Gtoken api in cases we use cash in transaction private async Task<Result<GTokenTransactionModel>> CreateGToken(GoEatApi goEatApi, decimal discountRate, string orderId, decimal originalPrice, decimal cash, string username, string description, decimal orginal_tax, decimal original_service_charge) { var gTokenTransaction = goEatApi.CreateGTokenTransaction(new GTokenTransaction { currency = ConstantValues.S_CURRENCY_SGD, discount_percentage = discountRate, order_id = orderId, original_currency = ConstantValues.S_CURRENCY_SGD, original_price = originalPrice, original_final_amount = cash, username = username, status = ConstantValues.S_PENDING, payment_method = ConstantValues.S_PAYMENT_METHOD, description = description, is_venvici_applicable = true, original_tax = orginal_tax, original_service_charge = original_service_charge }); if (!gTokenTransaction.Succeeded) { return gTokenTransaction; } //execute transaction gTokenTransaction.Data.transaction.status = ConstantValues.S_SUCCESS; gTokenTransaction = await goEatApi.ExecuteGTokenTransaction(gTokenTransaction.Data.transaction); return gTokenTransaction; }