/// <summary> /// Inserts the g2s request. /// </summary> /// <param name="g2SRequestModel">The invoice model.</param> /// <returns>returns int of the inserted row</returns> public long InsertG2SRequest(G2SRequestModel g2SRequestModel) { try { G2SRequest g2SRequest = this.mapperFactory.GetMapper<G2SRequestModel, G2SRequest>().Map(g2SRequestModel); g2SRequest.CreatedOn = DateTime.UtcNow; this.g2SRequestRepository.Insert(g2SRequest); this.g2SRequestRepository.Commit(); return g2SRequest.Id; } catch (Exception ex) { return 0; } }
/// <summary> /// Fills the g2s response. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="g2SModel">The G2S Model.</param> /// <returns>G2S Request Model.</returns> private G2SRequestModel FillG2SRequest(Dictionary<string, string> parameters, G2SModel g2SModel) { G2SRequestModel request = new G2SRequestModel(); request.Currency = parameters["currency"]; request.ItemName = parameters["item_name_1"]; request.ItemAmount = parameters["item_amount_1"]; request.NumberOfItems = parameters["numberofitems"]; request.TotalAmount = parameters["total_amount"]; request.ItemNumber = parameters["item_number_1"]; request.ItemQuantity = parameters["item_quantity_1"]; request.Encoding = parameters["encoding"]; request.TimeStamp = parameters["time_stamp"]; request.Version = parameters["version"]; request.InvoiceId = parameters["invoice_id"]; request.SuccessUrl = parameters["success_url"]; request.ErrorUrl = parameters["error_url"]; request.PendingUrl = parameters["pending_url"]; request.NotifyUrl = parameters["notify_url"]; request.ClientId = g2SModel.ClientId; request.ClientInterest = g2SModel.ClientInterest; request.CompanyId = g2SModel.CompanyId; request.Address = string.Empty; request.City = string.Empty; request.Country = string.Empty; request.Email = string.Empty; request.Phone = string.Empty; request.Zip = string.Empty; return request; }