public void RevokeUserFromMerhant_Success() { App createdApp = _appService.CreateApp(new CreateAppRequest()).Content; IPaylikeMerchantService merchantService = new PaylikeMerchantService(createdApp.Key); Merchant createdMerchant = merchantService.CreateMerchant(_createMerchantRequest).Content; merchantService.InviteUserToMerchant(new InviteUserToMerchantRequest() { MerchantId = createdMerchant.Id, Email = "*****@*****.**" }); var merchantUsers = merchantService.GetMerchantUsers(new GetMerchantUsersRequest() { MerchantId = createdMerchant.Id, Limit = 5 }); var revokeResponse = merchantService.RevokeUserFromMerchant(new RevokeUserFromMerchantRequest() { MerchantId = createdMerchant.Id, UserId = merchantUsers.Content[0].Id }); Assert.IsNull(revokeResponse.Content); Assert.IsFalse(revokeResponse.IsError); Assert.AreEqual(204, revokeResponse.ResponseCode); }
public void GetMerchantUsers_Success() { App createdApp = _appService.CreateApp(new CreateAppRequest()).Content; IPaylikeMerchantService merchantService = new PaylikeMerchantService(createdApp.Key); var createdMerchant = merchantService.CreateMerchant(_createMerchantRequest).Content; for (int i = 0; i < 5; i++) { merchantService.InviteUserToMerchant(new InviteUserToMerchantRequest() { MerchantId = createdMerchant.Id, Email = "test" + i.ToString() + "@example.com" }); } ApiResponse <List <User> > usersResponse = merchantService.GetMerchantUsers(new GetMerchantUsersRequest() { MerchantId = createdMerchant.Id, Limit = 3 }); Assert.AreEqual(3, usersResponse.Content.Count); var beforeUsers = merchantService.GetMerchantUsers(new GetMerchantUsersRequest() { MerchantId = createdMerchant.Id, Before = usersResponse.Content[2].Id, Limit = 2 }); Assert.AreEqual(2, beforeUsers.Content.Count); var afterMerchants = merchantService.GetMerchantUsers(new GetMerchantUsersRequest() { MerchantId = createdMerchant.Id, After = usersResponse.Content[2].Id, Limit = 2 }); Assert.AreEqual(2, beforeUsers.Content.Count); var firtUsersIds = usersResponse.Content.Select(m => m.Id); var beforeUsersIds = beforeUsers.Content.Select(m => m.Id); var afterUsersIds = afterMerchants.Content.Select(m => m.Id); var beforeIntersection = firtUsersIds.Intersect(beforeUsersIds); var afterIntersection = firtUsersIds.Intersect(afterUsersIds); Assert.AreEqual(0, beforeIntersection.Count()); Assert.AreEqual(2, afterIntersection.Count()); }
public void InviteUserToMerhant_Success() { App createdApp = _appService.CreateApp(new CreateAppRequest()).Content; IPaylikeMerchantService merchantService = new PaylikeMerchantService(createdApp.Key); Merchant createdMerchant = merchantService.CreateMerchant(_createMerchantRequest).Content; var inviteResult = merchantService.InviteUserToMerchant(new InviteUserToMerchantRequest() { MerchantId = createdMerchant.Id, Email = "*****@*****.**" }); Assert.IsNotNull(inviteResult.Content); Assert.IsFalse(inviteResult.IsError); Assert.AreEqual(201, inviteResult.ResponseCode); }