Click here to Skip to main content
15,867,771 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I am working on an  payment system using mvc 5, And i almost finished a large part of the work such as the transfer of funds and the proportion of fees, etc.

But I'm having a problem now - the payment page for purchases from e-commerce sites,

And how a system api receives information from the customer, such as the price and account, and the name of merchant , That is, when the customer moves from the shopping cart to the payment page directly and the purchase information is converted to the payment confirmation page,
I tried to convert url information to the payment confirmation page but I did not succeed, and I hope to find help or code source  mvc5 with it and how to secure that page the transfer of this information.


What I have tried:

C#
public class Transaction  
    {  
        [Key]  
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]  
        public int Id { get; set; }  
  
        //foreign key of eBankingUser  
        //hear userName will be assigned because GUID may not unique   
        [Required]  
        [Display(Name="User")]  
        public string UserId { get; set; }  
  
        //foreign key of transection table  
       // [Required]  
        public string OperationNumber { get; set; }  
  
                  
        [NotMapped]  
        public string CountryName { get; set; }  
  
        [NotMapped]  
        public string CurrencyISO { get; set; }  
  
        //[Required]  
        public int? PinId { get; set; }  
   //     public int? PinCode { get; set; }  
  
        //Local amount that is inserted to transfer or recharge or top up  
        public decimal? InsertedAmount { get; set; }  
  
        //USD  
        public decimal? AmountIN { get; set; }  
  
        //USD  
        public decimal? AmountOut { get; set; }  
  
          
        public int? RatePlanId { get; set; }  
  
        public int? Status { get; set; }  
  
        public DateTime? TransactionDate { get; set; }  
  
  
        [Display(Name = "Recepient User")]  
        public string ToUser { get; set; }  
  
        public string FromUser { get; set; }  
  
        public DateTime? UpdateDate { get; set; }  
  
        public string Remarks { get; set; }  
  
        [NotMapped]  
        public string ServiceName { get; set; }  
  
  
        [Display(Name="Reference")]  
        public string ReferenceId { get; set; }  
  
        [NotMapped]  
        public bool IsCheck { get; set; }  
        public DateTime? TimeOut { get; set; }  
        public bool IsTimeOut { get; set; }  
        public int ClientId { get; set; }  
        public int VendorId { get; set; }  
        public decimal? UserBalance { get; set; }  
         
    }  
  
//Repository  
 public bool CreditTransferDbEntry(Transaction tIn, Transaction tOut, string fromUser, string toUser)  
        {  
            ITransactionRepository transaction_repo = new TransactionRepository(db);  
            using(var contextTransaction = db.Database.BeginTransaction())  
            {  
                try  
                {  
                    var fee = tren_rep.GetById(1).MRP; /*ConstMessage.ConstFee_ID;*/  
                    tOut.UserBalance = transaction_repo.UserBalanceUpdate(fromUser, -(decimal)tOut.AmountOut);  
                    transaction_repo.Add(tOut);  
                    tIn.UserBalance = transaction_repo.UserBalanceUpdate(toUser, (decimal)tOut.AmountOut - ((decimal)tOut.AmountOut * ((decimal)fee /100)));  
                    transaction_repo.Add(tIn);  
                    //UserUpdate(fromUser);  
                    //UserUpdate(toUser);  
  
                    contextTransaction.Commit();  
                    return true;  
                }  
                catch (Exception)   
                {  
                    contextTransaction.Rollback();  
                }  
            }  
              
            return false;  
        }
Posted
Updated 24-Feb-19 18:35pm

Never accept code from unknown website for anything to do with real money: you don't know the source, you don't know what the code does, and you would be held personally responsible for any losses incurred by using such code negligently - and using random code would most certainly be seen as negligent, if not fraudulent.

Only get such code from your payment gateway company: most are helpful and have technical support to assist you to get up and running - if only because they don't get paid until you are online...
 
Share this answer
 
Comments
Mohamed HM Hadj Mokhtar 24-Feb-19 17:54pm    
Thank you OriginalGriff for your response, but I don't know if you understand my question. What I mean is that I'm building a payment system or E-Banking My problem is the payment gateway or as payment provider service that I'm trying to build but I have'nt been successful, so I'm trying to ask for help.
Thank you again for your answer.
OriginalGriff 25-Feb-19 2:17am    
Talk to you gateway company. If you get code from anywhere else, you open yourself up to legal action...
Your question is kind of all over the place in explaining what type of entity this project is for.

Typically the only portion of eComm transactions that would utilize AspNet and MVC wold be the eCommerce website itself. Their View would collect the form information and send into a Controller action to validate the Model and then communicate with a Payment Gateway.

The job of the Payment Gateway is to act as a mediator between the eCommerce site and the actual Payment Processor. This is due to Security Protocols which basically forbid an eComm site to send/receive transaction details directly to the Payment Processor.

The Payment Processor does the major grunt work of collecting the transaction information, contacting the payers bank, and settling payment into the Merchant Account.

So which part are you?
 
Share this answer
 
Comments
Mohamed HM Hadj Mokhtar 25-Feb-19 5:03am    
As I understanded, payment systems such as PayPal or neteller an perfectmoney need a third broker to conduct transactions purchase between the merchant and the customer and the payment system ??
MadMyche 25-Feb-19 6:41am    
Yes. You really need to understand the whole system before you start flinging out the code.
Mohamed HM Hadj Mokhtar 25-Feb-19 10:18am    
A payment provider (or payment service provider) is the company that operates the payment gateway or payment processor services. In some cases, the payment gateway and payment processor are combined into a single service known by either name,
And that is what I meant,
my friend MadMyche,The site has been built in terms of money transfers between accounts and withdraw and recharge using pin code but just I have the problem of direct payment programming from completely commercial sites such as paypal or skrill or ect..
I hope to find suggestion from you in solving this problem
MadMyche 25-Feb-19 11:29am    
While similar to an MVC [aradigm, you should be looking at creating a web service or API first.
Mohamed HM Hadj Mokhtar 25-Feb-19 12:47pm    
Exactly what I was looking for, so I want to know how the information is transferred from the purchase page in e-commerce sites to the payment system page and showing that information to confirm peossece the purchase, using json or xml,
thank you for your responses MadMyche

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900