Пример #1
0
 public void SetMerchantInfoOnTransactionModel_ArgumentsNull_Expect_Exception_Thrown()
 {
     // Arrange
     var target = new SettlementHelper(mockLogger, mockServiceClient);
     
     //Act
     target.SetMerchantInfoOnTransactionModel(null, null, null, null, null);
 }
Пример #2
0
            public void SetMerchantInfoOnTransactionModel_PaymentGatewayIsNotOgone_Expect_TransactionModelMerchantId_SetTo_EmptyString()
            {
                // Arrange
                var mockLogger = MockRepository.GenerateMock<ILogger>();
                var target = new SettlementHelper(mockLogger, mockServiceClient);
                var transactionModel = new Model.Settlement.TransactionModel() { };
                var booking = new Model.Booking.Booking() {};
                                 
                var business = new Model.Business.Business() {MerchantStatusEnum = MerchantStatusEnum.OwnMerchant};
                var businessChannel = new Model.Business.Business();
                var settlementPayments = new List<SettlementPaymentDto>() { new SettlementPaymentDto() { MerchantPSPID = "1", PaymentGatewayName = PaymentConstants.PAYMENT_GATEWAY_NAME_DATACASH } };

                //Act
                target.SetMerchantInfoOnTransactionModel(transactionModel, booking, business, businessChannel, settlementPayments);

                //Assert
                Assert.AreEqual(transactionModel.MerchantId, string.Empty);
            }
Пример #3
0
            public void GetMerchantIdForNewProviderModel_WithActiveBusinessAccountInOgone_Expect_MerchantId_SetToActivePaymentMerchantPSPID()
            {
                const string BUSINESS_SHORT_NAME = "TestBus3";
                const string PAYMENT_PSPSID_ONE = "1";
                const string PAYMENT_PSPSID_TWO = "2";


                var serviceClientMock = MockRepository.GenerateMock<IPaymentServiceServiceClient>();
                var target = new SettlementHelper(mockLogger, serviceClientMock);
                var business = new Model.Business.Business() { ShortName = BUSINESS_SHORT_NAME, MerchantStatusEnum = MerchantStatusEnum.OwnMerchant };
                var merchantAccounts = new List<MerchantAccount>()
                                           {
                                               new MerchantAccount() { ShortName = BUSINESS_SHORT_NAME, MerchantAccountStatusCode = PaymentConstants.PAYMENT_MERCHANT_ACCOUNT_ACTIVE, PSPID = PAYMENT_PSPSID_ONE},
                                               new MerchantAccount() { ShortName = BUSINESS_SHORT_NAME, MerchantAccountStatusCode = PaymentConstants.PAYMENT_MERCHANT_ACCOUNT_INACTIVE, PSPID = PAYMENT_PSPSID_TWO}
                                           };



                serviceClientMock.Expect(serviceClient => serviceClient.GetMerchantAccounts("TestBus3")).Return(
                    Task.FromResult(merchantAccounts));
                    
                var merchantId =  target.GetMerchantIdForNewProviderModel(business).Result;

                Assert.AreEqual(merchantId, PAYMENT_PSPSID_ONE);

            }