Example #1
0
        public void CanFetchAndDeserializeCorrectly()
        {
            var expected = new PreAuthorizationResponse
            {
                CreatedAt         = DateTimeOffset.Parse("2011-02-18T15:25:58Z"),
                Currency          = "GBP",
                Name              = "Variable Payments For Tennis Court Rental",
                Description       = "You will be charged according to your monthly usage of the tennis courts",
                ExpiresAt         = null,
                Id                = "1234JKH8KLJ",
                IntervalLength    = 1,
                IntervalUnit      = "month",
                MerchantId        = "WOQRUJU9OH2HH1",
                Status            = "active",
                RemainingAmount   = 65.0m,
                NextIntervalStart = DateTimeOffset.Parse("2012-02-20T00:00:00Z"),
                UserId            = "834JUH8KLJ",
                MaxAmount         = 70.0m,
                Uri               = "https://gocardless.com/api/v1/pre_authorizations/1610",
                SubResourceUris   =
                {
                    Bills = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/bills?source_id=1610"
                }
            }
            ;

            DeepAssertHelper.AssertDeepEquality(expected, new ApiClient("asdf").GetPreAuthorization("1234JKH8KLJ"));
        }
Example #2
0
        public void CanFetchAndDeserializeCorrectly()
        {
            var expected = new MerchantResponse
            {
                CreatedAt        = DateTimeOffset.Parse("2011-11-18T17:07:09Z"),
                Description      = null,
                Id               = "WOQRUJU9OH2HH1",
                Name             = "Tom's Delicious Chicken Shop",
                FirstName        = "Tom",
                LastName         = "Blomfield",
                Email            = "*****@*****.**",
                Uri              = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1",
                Balance          = 12.00m,
                PendingBalance   = 0.00m,
                NextPayoutDate   = DateTimeOffset.Parse("2011-11-25T17: 07: 09Z"),
                NextPayoutAmount = 12.00m,
                SubResourceUris  =
                {
                    Users             = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/users",
                    Bills             = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/bills",
                    PreAuthorizations = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/pre_authorizations",
                    Subscriptions     = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/subscriptions",
                }
            };

            DeepAssertHelper.AssertDeepEquality(expected, new ApiClient("asdf").GetMerchant("WOQRUJU9OH2HH1"));
        }
Example #3
0
        public void CanFetchAndDeserializeCorrectly()
        {
            var expected = new SubscriptionResponse
            {
                Amount          = 44.0m,
                IntervalLength  = 1,
                IntervalUnit    = "month",
                CreatedAt       = DateTimeOffset.Parse("2011-09-12T13:51:30Z"),
                Currency        = "GBP",
                Name            = "London Gym Membership",
                Description     = "Entitles you to use all of the gyms around London",
                ExpiresAt       = null,
                Id              = "1580",
                MerchantId      = "WOQRUJU9OH2HH1",
                Status          = "cancelled",
                UserId          = "638",
                Uri             = "https://gocardless.com/api/v1/subscriptions/1580",
                SubResourceUris =
                {
                    Bills = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/bills?source_id=1580"
                }
            };

            DeepAssertHelper.AssertDeepEquality(expected, new ApiClient("asdf").CancelSubscription("1580"));
        }
Example #4
0
        public void CanFetchAndDeserializeCorrectly()
        {
            GoCardless.Environment = GoCardless.Environments.Sandbox;

            var expected = new MerchantResponse
            {
                CreatedAt        = DateTimeOffset.Parse("2011-11-18T17:07:09Z"),
                Description      = null,
                Id               = "WOQRUJU9OH2HH1",
                Name             = "Tom's Delicious Chicken Shop",
                FirstName        = "Tom",
                LastName         = "Blomfield",
                Email            = "*****@*****.**",
                Uri              = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1",
                Balance          = 12.00m,
                PendingBalance   = 0.00m,
                NextPayoutDate   = DateTimeOffset.Parse("2011-11-25T17: 07: 09Z"),
                NextPayoutAmount = 12.00m,
                SubResourceUris  =
                {
                    Users             = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/users",
                    Bills             = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/bills",
                    PreAuthorizations = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/pre_authorizations",
                    Subscriptions     = "https://gocardless.com/api/v1/merchants/WOQRUJU9OH2HH1/subscriptions",
                }
            };
            var client   = new ApiClient("3MMVNZERVE7X8FN8AGYZM3EBANVTD3NZENEVPN62BAVHY3FCEVQJ9JA6RZEDGTEF");
            var response = client.GetMerchant("0NP016PZPT");

            DeepAssertHelper.AssertDeepEquality(expected, response);
        }
Example #5
0
        public void CanFetchAndDeserializeCorrectly()
        {
            var expected = new[]
            {
                new BillResponse
                {
                    Amount         = 44.0m,
                    GocardlessFees = 0.44m,
                    PartnerFees    = 0m,
                    Currency       = "GBP",
                    CreatedAt      = DateTimeOffset.Parse("2011-11-04T21: 41: 25Z"),
                    Description    = "Month 2 payment",
                    Id             = "VZUG2SC3PRT5EM",
                    Name           = "Bill 2 for Subscription description",
                    PaidAt         = DateTimeOffset.Parse("2011-11-07T15: 00: 00Z"),
                    Status         = "paid",
                    MerchantId     = "WOQRUJU9OH2HH1",
                    UserId         = "FIVWCCVEST6S4D",
                    SourceType     = "subscription",
                    SourceId       = "YH1VEVQHYVB1UT",
                    Uri            = "https://gocardless.com/api/v1/bills/VZUG2SC3PRT5EM"
                },
                new BillResponse
                {
                    Amount         = 44.0m,
                    GocardlessFees = 0.44m,
                    PartnerFees    = 0m,
                    Currency       = "GBP",
                    CreatedAt      = DateTimeOffset.Parse("2011-11-04T21: 41: 25Z"),
                    Description    = "Month 2 payment",
                    Id             = "VZUG2SC3PRT5EN",
                    Name           = "Bill 2 for Subscription description",
                    PaidAt         = DateTimeOffset.Parse("2011-11-07T15: 00: 00Z"),
                    Status         = "paid",
                    MerchantId     = "WOQRUJU9OH2HH1",
                    UserId         = "FIVWCCVEST6S4D",
                    SourceType     = "subscription",
                    SourceId       = "YH1VEVQHYVB1UT",
                    Uri            = "https://gocardless.com/api/v1/bills/VZUG2SC3PRT5EM"
                }
            };

            DeepAssertHelper.AssertIEnumerableDeepEquality(expected, new ApiClient("asdf").GetMerchantBills("WOQRUJU9OH2HH1"));
        }
        public void CanFetchAndDeserializeCorrectly()
        {
            var expected = new BillResponse
            {
                Amount         = 10.00m,
                GocardlessFees = 0.10m,
                PartnerFees    = 0m,
                Currency       = "GBP",
                CreatedAt      = DateTime.Parse("2011-11-22T11: 59: 12Z"),
                Description    = null,
                Id             = "PWSDXRYSCOKA7Z",
                Name           = null,
                Status         = "pending",
                MerchantId     = "6UFY9IJWGYBTAP",
                UserId         = "BWJ2GP659OXPAU",
                PaidAt         = null,
                SourceType     = "pre_authorization",
                SourceId       = "FAZ6FGSMTCOZUG",
                Uri            = "https://gocardless.com/api/v1/bills/PWSDXRYSCOKA7Z"
            };

            DeepAssertHelper.AssertDeepEquality(expected, new ApiClient("asdf").PostBill(44, "AJKH638A99"));
        }
        public void CanFetchAndDeserializeCorrectly()
        {
            var expected = new[]
            {
                new UserResponse
                {
                    CreatedAt = DateTimeOffset.Parse("2011-11-18T17:06:15Z"),
                    Email     = "*****@*****.**",
                    Id        = "JKH8HGKL9H",
                    FirstName = "Frank",
                    LastName  = "Smith"
                },
                new UserResponse
                {
                    CreatedAt = DateTimeOffset.Parse("2011-11-19T14:16:15Z"),
                    Email     = "*****@*****.**",
                    Id        = "JKH8HGKL9I",
                    FirstName = "James",
                    LastName  = "Dean"
                }
            };

            DeepAssertHelper.AssertIEnumerableDeepEquality(expected, new ApiClient("asdf").GetMerchantUsers("WOQRUJU9OH2HH1"));
        }
Example #8
0
 public void CanFetchAndDeserializeCorrectly()
 {
     DeepAssertHelper.AssertDeepEquality(SamplePayout, new ApiClient("asdf").GetPayout("0BKR1AZNJF"));
 }