Ejemplo n.º 1
0
        public void Serialize()
        {
            const int    spendAmount     = 4567;
            const int    taxAmount       = 25;
            const int    exemptionAmount = 213;
            const string register        = "Register X";
            const string cashier         = "Ca$hier";
            const string identifier      = "!dent!f!er";

            string expected = CreateExpectedSerializedString(LOCATION_ID,
                                                             spendAmount,
                                                             taxAmount,
                                                             exemptionAmount,
                                                             cashier,
                                                             register,
                                                             identifier,
                                                             true,
                                                             ITEMS_STRING);

            RemoteCheckDataRequestBody request = new RemoteCheckDataRequestBody(LOCATION_ID,
                                                                                spendAmount,
                                                                                taxAmount,
                                                                                exemptionAmount,
                                                                                identifier,
                                                                                register,
                                                                                cashier,
                                                                                true,
                                                                                ITEMS);

            string serialized = JsonConvert.SerializeObject(request);

            serialized.Should().NotBeNullOrEmpty();
            TestUtilities.VerifyJsonIsEquivalent <RemoteCheckDataRequestBody>(serialized, expected);
        }
Ejemplo n.º 2
0
        public void Serialize_Defaults()
        {
            const int spendAmount     = 2132;
            const int taxAmount       = 59;
            const int exemptionAmount = 3;

            string expected = CreateExpectedSerializedString(LOCATION_ID, spendAmount, taxAmount, exemptionAmount);

            RemoteCheckDataRequestBody request = new RemoteCheckDataRequestBody(LOCATION_ID,
                                                                                spendAmount,
                                                                                taxAmount,
                                                                                exemptionAmount);

            string serialized = JsonConvert.SerializeObject(request);

            serialized.Should().NotBeNullOrEmpty();
            TestUtilities.VerifyJsonIsEquivalent <RemoteCheckDataRequestBody>(serialized, expected);
        }
        public UpdateRemoteCheckDataResponse UpdateRemoteCheckData(string accessToken, string checkUuid, RemoteCheckDataRequestBody checkDataRequest)
        {
            UpdateRemoteCheckDataRequest request = new UpdateRemoteCheckDataRequest(accessToken, checkUuid, checkDataRequest.LocationId,
                                                                                    checkDataRequest.SpendAmountCents, checkDataRequest.TaxAmountCents, checkDataRequest.ExemptionAmountCents,
                                                                                    checkDataRequest.IdentifierFromMerchant, checkDataRequest.Register, checkDataRequest.Cashier,
                                                                                    checkDataRequest.PartialAuthorizationAllowed, checkDataRequest.Items);

            return(request.Accept(_engine) as UpdateRemoteCheckDataResponse);
        }
Ejemplo n.º 4
0
        public UpdateRemoteCheckDataResponse UpdateRemoteCheckData(string accessToken, string checkUuid, RemoteCheckDataRequestBody checkDataRequest)
        {
            UpdateRemoteCheckDataRequest request = new UpdateRemoteCheckDataRequest(accessToken, checkUuid, checkDataRequest.LocationId,
                                                                                    checkDataRequest.SpendAmountCents, checkDataRequest.TaxAmountCents, checkDataRequest.ExemptionAmountCents,
                                                                                    checkDataRequest.IdentifierFromMerchant, checkDataRequest.Register, checkDataRequest.Cashier,
                                                                                    checkDataRequest.PartialAuthorizationAllowed, checkDataRequest.Items);

            var uri = BuildUri(request.ApiVersion,
                               $"checks{(!string.IsNullOrEmpty(request.CheckUuid) ? "/" + request.CheckUuid : string.Empty)}");

            return(_restWrapper.Put <RemoteCheckDataRequestBody, UpdateRemoteCheckDataResponse>(
                       request.Body,
                       uri: uri,
                       accessTokenHeader: FormatAccessTokenString(unspecifiedUserAccessToken: request.AccessToken),
                       actions: null));
        }
Ejemplo n.º 5
0
        public UpdateRemoteCheckDataResponse CreateRemoteCheckData(string accessToken, RemoteCheckDataRequestBody createRequest)
        {
            CreateRemoteCheckDataRequest request = new CreateRemoteCheckDataRequest(accessToken, createRequest.LocationId,
                                                                                    createRequest.SpendAmountCents, createRequest.TaxAmountCents, createRequest.ExemptionAmountCents,
                                                                                    createRequest.IdentifierFromMerchant, createRequest.Register, createRequest.Cashier,
                                                                                    createRequest.PartialAuthorizationAllowed, createRequest.Items);


            return(_restWrapper.Put <RemoteCheckDataRequestBody, UpdateRemoteCheckDataResponse>(
                       request.Body,
                       uri: BuildUri(request.ApiVersion, "checks"),
                       accessTokenHeader: FormatAccessTokenString(unspecifiedUserAccessToken: request.AccessToken),
                       actions: null));
        }