public DetachedRefundResponse CreateDetachedRefund(string accessToken, DetachedRefundRequestBody detachedRefund)
 {
     return(CreateDetachedRefund(accessToken, detachedRefund.LocationId, detachedRefund.PaymentData,
                                 detachedRefund.CreditAmountCents, detachedRefund.Register, detachedRefund.Cashier,
                                 detachedRefund.Identifier, detachedRefund.ManagerConfirmation, detachedRefund.CustomerFacingReason,
                                 detachedRefund.InternalReason));
 }
示例#2
0
        public void CreateFails_WhenQrCodeIsInvalid()
        {
            const string invalidQRCode = "LU02000ROETEST_BAD_QR_DATA_D40200A0LU";

            ClientModuleIntegrationTestingUtilities.RemoveAnyGiftCardCreditOnConsumerUserAccount();

            const int refundAmountCents = 50;

            ClientModuleIntegrationTestingUtilities.PlaceOrderAtTestMerchantWithTestConsumer(refundAmountCents);

            ICreateDetachedRefund refundInterface = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <ICreateDetachedRefund>();
            var refundData = new DetachedRefundRequestBody(LevelUpTestConfiguration.Current.MerchantLocationId,
                                                           invalidQRCode,
                                                           refundAmountCents);

            try
            {
                refundInterface.CreateDetachedRefund(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken, refundData);
                Assert.Fail("Expected LevelUpApiException on refund with bad Qr data but did not catch it!");
            }
            catch (LevelUpApiException) { }

            // Cleanup, refund the order.
            refundData = new DetachedRefundRequestBody(LevelUpTestConfiguration.Current.MerchantLocationId,
                                                       LevelUpTestConfiguration.Current.ConsumerQrData,
                                                       refundAmountCents);
            refundInterface.CreateDetachedRefund(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken, refundData);
        }
        public void SerializeDeserialize_DetachedRefund()
        {
            const int testLocationId = 3141592;

            DetachedRefundRequestBody refund = new DetachedRefundRequestBody(testLocationId,
                                                                             "LU6789-test-payment-token-data-9876LU",
                                                                             creditAmountCents: 1);

            DetachedRefundRequestBody deserialized = TestUtilities.SerializeThenDeserialize(refund);

            Assert.IsNotNull(deserialized);
            Assert.IsTrue(TestUtilities.PublicPropertiesAreEqual(refund, deserialized));
        }
示例#4
0
        public void CreateDetachedRefund()
        {
            ClientModuleIntegrationTestingUtilities.RemoveAnyGiftCardCreditOnConsumerUserAccount();

            const int refundAmountCents = 50;

            ClientModuleIntegrationTestingUtilities.PlaceOrderAtTestMerchantWithTestConsumer(refundAmountCents);

            ICreateDetachedRefund refundInterface = ClientModuleIntegrationTestingUtilities.GetSandboxedLevelUpModule <ICreateDetachedRefund>();
            var refundData = new DetachedRefundRequestBody(LevelUpTestConfiguration.Current.MerchantLocationId,
                                                           LevelUpTestConfiguration.Current.ConsumerQrData,
                                                           refundAmountCents);
            var refund = refundInterface.CreateDetachedRefund(ClientModuleIntegrationTestingUtilities.SandboxedLevelUpMerchantAccessToken, refundData);

            Assert.AreEqual(refund.CreditAmountCents, refundAmountCents);
        }