public HttpResponseMessage Getarticles(int id)
        {
            clsArticles objArticle = new clsArticles();

            try
            {
                objArticle = (from a in db.articles
                              where (a.id == id)
                              select new clsArticles()
                {
                    id = a.id,
                    name = a.name,
                    description = a.description,
                    total_in_shelf = a.total_in_shelf,
                    total_in_vault = a.total_in_vault,
                    store_id = a.store_id
                }).FirstOrDefault <clsArticles>();


                if (objArticle == null)
                {
                    objError = objResponse.responseError(HttpStatusCode.NotFound);
                    return(Request.CreateResponse(HttpStatusCode.NotFound, objError, Configuration.Formatters.JsonFormatter));
                }

                objResponseArticles = objResponse.responseArticleSuccess(objArticle, articlesTotal());
                return(Request.CreateResponse(HttpStatusCode.OK, objResponseArticles, Configuration.Formatters.JsonFormatter));
            }
            catch (Exception ex)
            {
                objError = objResponse.responseError(HttpStatusCode.BadRequest);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, objError, Configuration.Formatters.JsonFormatter));
            }
        }
        public HttpResponseMessage Getstores(int id)
        {
            clsStores objStores = new clsStores();

            try
            {
                objStores = (from a in db.stores
                             where (a.id == id)
                             select new clsStores()
                {
                    id = a.id,
                    name = a.name,
                    address = a.address
                }).FirstOrDefault <clsStores>();


                if (objStores == null)
                {
                    objError = objResponse.responseError(HttpStatusCode.NotFound);
                    return(Request.CreateResponse(HttpStatusCode.NotFound, objError, Configuration.Formatters.JsonFormatter));
                }

                objResponseStores = objResponse.responseStoresSuccess(objStores, storesTotal());
                return(Request.CreateResponse(HttpStatusCode.OK, objResponseStores, Configuration.Formatters.JsonFormatter));
            }
            catch (Exception ex)
            {
                objError = objResponse.responseError(HttpStatusCode.BadRequest);
                return(Request.CreateResponse(HttpStatusCode.BadRequest, objError, Configuration.Formatters.JsonFormatter));
            }
        }
    public void bindAll(Game game)
    {
        engine            = MatchvsEngine.getInstance();
        this.game         = game;
        registerUserRes   = new registerUserResponse(registerUserResponseInner);
        initRes           = new initResponse(initResponseInner);
        loginRes          = new loginResponse(loginResponseInner);
        errorRes          = new errorResponse(errorResponseInner);
        joinRoomRes       = new joinRoomResponse(joinRoomResponseInner);
        joinRoomNot       = new joinRoomNotify(joinRoomNotifyInner);
        joinOverRes       = new joinOverResponse(joinOverResponseInner);
        sendFrameEventRes = new sendFrameEventResponse(sendFrameEventResponseInner);
        frameUp           = new frameUpdate(frameUpdateInner);
        setFrameSyncRes   = new setFrameSyncResponse(setFrameSyncResponseInner);
        setFrameSyncNot   = new setFrameSyncNotify(setFrameSyncNotifyInner);



        engine.listen("initResponse", initRes);
        engine.listen("loginResponse", loginRes);
        engine.listen("errorResponse", errorRes);
        engine.listen("joinRoomResponse", joinRoomRes);
        engine.listen("joinRoomNotify", joinRoomNot);
        engine.listen("joinOverResponse", joinOverRes);
        engine.listen("sendFrameEventResponse", sendFrameEventRes);
        engine.listen("frameUpdate", frameUp);
        engine.listen("setFrameSyncResponse", setFrameSyncRes);
        engine.listen("setFrameSyncNotify", setFrameSyncNot);
    }
Ejemplo n.º 4
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse401()
 {
     legalEntityId = "201401";
     request       = new legalEntityAgreementCreateRequest
     {
         legalEntityAgreement = new legalEntityAgreement
         {
             legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT,
             agreementVersion         = "Version1",
             userFullName             = "FullName",
             userSystemName           = "systemUserName",
             userIPAddress            = "127.0.0.1",
             manuallyEntered          = true,
             acceptanceDateTime       = DateTime.Now
         }
     };
     try
     {
         response = request.PostLegalEntityAgreementCreateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("You are not authorized to access this resource. Please check your credentials.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 5
0
 public void TestPostLegalEntityCreateRequestErrorResponse400()
 {
     legalEntityId = "201400";
     request       = new legalEntityAgreementCreateRequest
     {
         legalEntityAgreement = new legalEntityAgreement
         {
             legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT,
             agreementVersion         = "Version1",
             userFullName             = "FullName",
             userSystemName           = "systemUserName",
             userIPAddress            = "127.0.0.1",
             manuallyEntered          = true,
             acceptanceDateTime       = DateTime.Now
         }
     };
     try
     {
         response = request.PostLegalEntityAgreementCreateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Could not find requested object.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 6
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse500()
 {
     legalEntityId = "201500";
     request       = new legalEntityAgreementCreateRequest
     {
         legalEntityAgreement = new legalEntityAgreement
         {
             legalEntityAgreementType = legalEntityAgreementType.MERCHANT_AGREEMENT,
             agreementVersion         = "Version1",
             userFullName             = "FullName",
             userSystemName           = "systemUserName",
             userIPAddress            = "127.0.0.1",
             manuallyEntered          = true,
             acceptanceDateTime       = DateTime.Now
         }
     };
     try
     {
         response = request.PostLegalEntityAgreementCreateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Internal Error. This error has already been escalated to Vantiv for resolution. Please contact support with questions.", errorResponse.errors[0]);
     }
 }
 public PayFacWebException(string errorMessage, int httpStatusCode, string rawResponse, errorResponse errorResponse)
     : base(errorMessage + ExtractErrorMessages(errorResponse))
 {
     ErrorMessage       = errorMessage;
     HttpStatusCode     = httpStatusCode;
     RawResponse        = rawResponse;
     this.errorResponse = errorResponse;
 }
Ejemplo n.º 8
0
        public void TestPutSubMerchantUpdateRequestErrorResponse400()
        {
            legalEntityId = "201400";
            subMerchantId = "9";

            request = new subMerchantUpdateRequest
            {
                amexMid             = "1234567890",
                discoverConveyedMid = "123456789012345",
                url = "http://merchantUrl",
                customerServiceNumber      = "8407809000",
                hardCodedBillingDescriptor = "Descriptor",
                maxTransactionAmount       = 8400,
                bankRoutingNumber          = "840123124",
                bankAccountNumber          = "84012312415",
                pspMerchantId    = "785412365",
                purchaseCurrency = "USD",
                address          = new addressUpdatable
                {
                    streetAddress1 = "Street Address 1",
                    streetAddress2 = "Street Address 2",
                    city           = "City",
                    stateProvince  = "MA",
                    postalCode     = "01970"
                },
                primaryContact = new subMerchantPrimaryContactUpdatable
                {
                    firstName = "John",
                    lastName  = "Doe",
                    phone     = "9785552222"
                },
                fraud = new subMerchantFraudFeature()
                {
                    enabled = true
                },
                amexAcquired = new subMerchantAmexAcquiredFeature
                {
                    enabled = true
                },
                eCheck = new subMerchantECheckFeature
                {
                    enabled = true,
                    eCheckBillingDescriptor = "9785552222",
                }
            };
            try
            {
                response = request.PutSubMerchantUpdateRequest(legalEntityId, subMerchantId);
                Assert.Fail("PayfacWebException expected, None thrown");
            }
            catch (PayFacWebException ex)
            {
                errorResponse errorResponse = ex.errorResponse;
                Assert.NotNull(errorResponse.transactionId);
                Assert.AreEqual("Could not find requested object.", errorResponse.errors[0]);
            }
        }
        public static string ExtractErrorMessages(errorResponse errorResponse)
        {
            var           errorMessages = errorResponse.errors;
            StringBuilder errorBuilder  = new StringBuilder();

            foreach (var err in errorMessages)
            {
                errorBuilder.Append(err);
            }
            return(errorBuilder.ToString());
        }
Ejemplo n.º 10
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse503()
 {
     legalEntitytId = "201503";
     try
     {
         legalEntityRetrievalResponse response = new LegalEntityRetrievalRequest().GetLegalEntityRequest(legalEntitytId);
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Service was unavailable.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 11
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse401()
 {
     legalEntitytId = "201401";
     try
     {
         legalEntityRetrievalResponse response = new LegalEntityRetrievalRequest().GetLegalEntityRequest(legalEntitytId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("You are not authorized to access this resource. Please check your credentials.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 12
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse500()
 {
     legalEntitytId = "201500";
     try
     {
         legalEntityRetrievalResponse response = new LegalEntityRetrievalRequest().GetLegalEntityRequest(legalEntitytId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Internal Error. This error has already been escalated to Vantiv for resolution. Please contact support with questions.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 13
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse400()
 {
     legalEntitytId = "201400";
     try
     {
         legalEntityRetrievalResponse response = new LegalEntityRetrievalRequest().GetLegalEntityRequest(legalEntitytId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Could not find requested object.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 14
0
 public void TestGetSubMerchantRequestErrorResponse503()
 {
     legalEntitytId = "201503";
     submerchantId  = "1234567";
     try
     {
         subMerchantRetrievalResponse response = new SubMerchantRetrievalRequest().GetSubMerchantRequest(legalEntitytId, submerchantId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Service was unavailable.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 15
0
 public void TestPrincipalDeleteRequestInvalidPrincipalId()
 {
     legalEntitytId = "201003";
     principalId    = "12";
     try
     {
         principalDeleteResponse response = new principalDeleteRequest().PrincipalDeleteRequest(legalEntitytId, principalId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("The Legal Entity Principal does not exist.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 16
0
 public void TestGetLegalEntityRetrievalRequestErrorResponse503()
 {
     legalEntitytId = "201503";
     principalId    = "9";
     try
     {
         principalDeleteResponse response = new principalDeleteRequest().PrincipalDeleteRequest(legalEntitytId, principalId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Service was unavailable.", errorResponse.errors[0]);
     }
 }
 public void TestGetLegalEntityRetrievalRequestErrorResponse401()
 {
     legalEntityId = "201401";
     request       = new legalEntityPrincipalCreateRequest
     {
         principal = new legalEntityPrincipal
         {
             title        = "Mr.",
             firstName    = "Jon",
             lastName     = "Snow",
             emailAddress = "*****@*****.**",
             dateOfBirth  = new DateTime(1980, 10, 12),
             address      = new principalAddress
             {
                 streetAddress1 = "p2 street address 1",
                 streetAddress2 = "p2 street address 2",
                 city           = "Boston",
                 stateProvince  = "MA",
                 postalCode     = "01892",
                 countryCode    = "USA"
             },
             stakePercent = 31,
         }
     };
     try
     {
         response = request.PostLegalEntityPrincipalCreateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("You are not authorized to access this resource. Please check your credentials.", errorResponse.errors[0]);
     }
 }
 public void TestGetLegalEntityRetrievalRequestErrorResponse500()
 {
     legalEntityId = "201500";
     request       = new legalEntityPrincipalCreateRequest
     {
         principal = new legalEntityPrincipal
         {
             title        = "Mr.",
             firstName    = "Jon",
             lastName     = "Snow",
             emailAddress = "*****@*****.**",
             dateOfBirth  = new DateTime(1980, 10, 12),
             address      = new principalAddress
             {
                 streetAddress1 = "p2 street address 1",
                 streetAddress2 = "p2 street address 2",
                 city           = "Boston",
                 stateProvince  = "MA",
                 postalCode     = "01892",
                 countryCode    = "USA"
             },
             stakePercent = 31,
         }
     };
     try
     {
         response = request.PostLegalEntityPrincipalCreateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Internal Error. This error has already been escalated to Vantiv for resolution. Please contact support with questions.", errorResponse.errors[0]);
     }
 }
 public void TestPostLegalEntityPrincipalCreateRequestErrorResponse400()
 {
     legalEntityId = "201400";
     request       = new legalEntityPrincipalCreateRequest
     {
         principal = new legalEntityPrincipal
         {
             title        = "Mr.",
             firstName    = "Jon",
             lastName     = "Snow",
             emailAddress = "*****@*****.**",
             dateOfBirth  = new DateTime(1980, 10, 12),
             address      = new principalAddress
             {
                 streetAddress1 = "p2 street address 1",
                 streetAddress2 = "p2 street address 2",
                 city           = "Boston",
                 stateProvince  = "MA",
                 postalCode     = "01892",
                 countryCode    = "USA"
             },
             stakePercent = 31,
         }
     };
     try
     {
         response = request.PostLegalEntityPrincipalCreateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Could not find requested object.", errorResponse.errors[0]);
     }
 }
Ejemplo n.º 20
0
 public void TestPutLegalEntityUpdateRequestErrorResponse400()
 {
     legalEntityId = "201400";
     request       = new legalEntityUpdateRequest
     {
         address = new addressUpdatable
         {
             streetAddress1 = "LE Street Address 1",
             streetAddress2 = "LE Street Address 2",
             city           = "LE City",
             stateProvince  = "MA",
             postalCode     = "01730",
             countryCode    = "USA",
         },
         contactPhone                = "9785550101",
         doingBusinessAs             = "Other Name Co.",
         annualCreditCardSalesVolume = 10000000,
         hasAcceptedCreditCards      = true,
         principal = new legalEntityPrincipalUpdatable
         {
             principalId  = 9,
             title        = "CEO",
             emailAddress = "*****@*****.**",
             contactPhone = "9785551234",
             address      = new principalAddress
             {
                 streetAddress1 = "p street address 1",
                 streetAddress2 = "p street address 2",
                 city           = "Boston",
                 stateProvince  = "MA",
                 postalCode     = "01890",
                 countryCode    = "USA",
             },
             backgroundCheckFields = new principalBackgroundCheckFields
             {
                 firstName           = "p first",
                 lastName            = "p last",
                 ssn                 = "123459876",
                 dateOfBirth         = new DateTime(1980, 10, 12),
                 driversLicense      = "892327409832",
                 driversLicenseState = "MA"
             },
         },
         backgroundCheckFields = new legalEntityBackgroundCheckFields
         {
             legalEntityName = "Company Name",
             legalEntityType = legalEntityType.INDIVIDUAL_SOLE_PROPRIETORSHIP,
             taxId           = "123456789"
         },
         legalEntityOwnershipType = legalEntityOwnershipType.PUBLIC,
         yearsInBusiness          = "10"
     };
     try
     {
         response = request.PutLegalEntityUpdateRequest(legalEntityId);
         Assert.Fail("PayfacWebException expected, None thrown");
     }
     catch (PayFacWebException ex)
     {
         errorResponse errorResponse = ex.errorResponse;
         Assert.NotNull(errorResponse.transactionId);
         Assert.AreEqual("Could not find requested object.", errorResponse.errors[0]);
     }
 }
        public void TestPostSubMerchantCreateRequestErrorResponse503()
        {
            legalEntityId = "2010503";

            request = new subMerchantCreateRequest
            {
                merchantName        = "duplicate not matching",
                amexMid             = "1234567890",
                discoverConveyedMid = "123456789012345",
                url = "http://merchantUrl",
                customerServiceNumber      = "8407809000",
                hardCodedBillingDescriptor = "billing Descriptor",
                maxTransactionAmount       = 8400,
                purchaseCurrency           = "USD",
                merchantCategoryCode       = "5964",
                bankRoutingNumber          = "840123124",
                bankAccountNumber          = "84012312415",
                pspMerchantId = "123456",
                fraud         = new subMerchantFraudFeature
                {
                    enabled = true
                },
                amexAcquired = new subMerchantAmexAcquiredFeature
                {
                    enabled = false
                },
                address = new address
                {
                    streetAddress1 = "Street Address 1",
                    streetAddress2 = "Street Address 2",
                    city           = "City",
                    stateProvince  = "MA",
                    postalCode     = "01970",
                    countryCode    = "USA"
                },
                primaryContact = new subMerchantPrimaryContact
                {
                    firstName    = "Josh",
                    lastName     = "Doe",
                    emailAddress = "*****@*****.**",
                    phone        = "9785552222"
                },
                createCredentials = true,
                eCheck            = new subMerchantECheckFeature
                {
                    enabled                 = true,
                    eCheckCompanyName       = "Company Name",
                    eCheckBillingDescriptor = "9785552222"
                },
                subMerchantFunding = new subMerchantFunding
                {
                    enabled = false
                },
                settlementCurrency = "USD"
            };

            try
            {
                response = request.PostSubMerchantCreateRequest(legalEntityId);
                Assert.Fail("PayfacWebException expected, None thrown");
            }
            catch (PayFacWebException ex)
            {
                errorResponse errorResponse = ex.errorResponse;
                Assert.NotNull(errorResponse.transactionId);
                Assert.AreEqual("Service was unavailable.", errorResponse.errors[0]);
            }
        }