public async Task <FeeResponse> CalculateFeeAsync(string accessToken, CardFeeRequest cardFeeRequest, CancellationToken cancellationToken = default) { var requestBody = JsonSerializer.Serialize(cardFeeRequest, SerializerSettings); return(await SendFeeRequest(accessToken, requestBody, "fees/card", cancellationToken) .ConfigureAwait(false)); }
protected virtual void GetFee() { outputTrigger = ERRORACTION; // Reset respective TransactionContext context fields. try { if (Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"])) { Thread.Sleep(1000); this.TransactionContext.AppliedFee = 2.35; outputTrigger = "submit"; } else { CardFeeRequest request = new CardFeeRequest { KioskTxnrefnum = this.TransactionContext.Id, ServiceKey = this.TransactionContext.DispatcherAction }; CardFeeResponse response = new CardFeeResponse{ Success = false }; using (CardServiceClient client = new CardServiceClient()) { response = client.GetCardFee(request); } if (response.Success) { outputTrigger = SUBMITACTION; this.TransactionContext.AppliedFee = response.FeePercentage; } else outputTrigger = ERRORACTION; } } catch (Exception ex) { if (log.IsErrorEnabled) log.Error("DU,caught exception GetAppliedFee try block for TransactionContextid:" + this.TransactionContext.Id + "." + ex.Message); } finally { ViewGrid.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DGetFeeProcessed(ChangeState), outputTrigger); } }
protected override void GetFee() { string outputTrigger = ERRORACTION; try { if (Boolean.Parse(ConfigurationManager.AppSettings["StandAloneMode"])) { Thread.Sleep(1000); this.TransactionContext.AppliedFee = 2.35; switch (this.Transaction.ServiceType) { case MawaqifServiceType.AccountTopUp: outputTrigger = "topupsubmit"; break; case MawaqifServiceType.PermitRenewal: outputTrigger = "rpsubmit"; break; case MawaqifServiceType.ViolationPayment: outputTrigger = "pvtsubmit"; break; } } else { CardFeeRequest request = new CardFeeRequest { KioskTxnrefnum = this.TransactionContext.Id, ServiceKey = this.TransactionContext.DispatcherAction }; CardFeeResponse response = new CardFeeResponse { Success = false }; using (CardServiceClient client = new CardServiceClient()) { response = client.GetCardFee(request); } if (response.Success) { switch (this.Transaction.ServiceType) { case MawaqifServiceType.AccountTopUp: outputTrigger = "topupsubmit"; break; case MawaqifServiceType.PermitRenewal: outputTrigger = "rpsubmit"; break; case MawaqifServiceType.ViolationPayment: outputTrigger = "pvtsubmit"; break; } this.TransactionContext.AppliedFee = response.FeePercentage; } else outputTrigger = ERRORACTION; } } catch (Exception ex) { if (log.IsErrorEnabled) log.Error("Mawaqif,caught exception GetAppliedFee try block for TransactionContextid:" + this.TransactionContext.Id + "." + ex.Message); } finally { ViewGrid.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new DGetFeeProcessed(ChangeState), outputTrigger); } }