public Response Confirm(PaymentConfirmationContext context, int totalPrice) { var ctx = (RefahConfirmationContext)context; if (ctx.State != "OK") { return(Response.Failed()); } var amountIfSuccessErrorCodeIfError = CheckWithBank(ctx); return(totalPrice == amountIfSuccessErrorCodeIfError ? Response.Success(JsonConvert.SerializeObject(ctx)) : Response.Failed()); }
public Response Confirm(PaymentConfirmationContext context, Order order) { var ctx = (RefahConfirmationContext)context; SaveRefNumAndTraceNo(ctx, order); if (ctx.State != "OK") { return(Response.Failed()); } var amountIfSuccessErrorCodeIfError = CheckWithBank(ctx); return(order.OrderItems.Sum(x => x.Price) == amountIfSuccessErrorCodeIfError ? Response.Success() : Response.Failed()); }