Пример #1
0
        public void ShouldRejectIfNoInitiatingPartyName()
        {
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(100m);

            transfert.InitiatingPartyName = null;
            transfert.AsXmlString();
        }
Пример #2
0
        public void ShouldRejectIfNoMessageIdentification()
        {
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(100m);

            transfert.MessageIdentification = null;
            transfert.AsXmlString();
        }
Пример #3
0
        public void ShouldRejectIfNoMessageIdentification()
        {
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(100m);

            transfert.MessageIdentification = null;
            Assert.That(() => { transfert.AsXmlString(); }, Throws.TypeOf <SepaRuleException>().With.Property("Message").EqualTo("The message identification is mandatory."));
        }
Пример #4
0
        public void ShouldRejectIfNoInitiatingPartyName()
        {
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(100m);

            transfert.InitiatingPartyName = null;

            Assert.That(() => { transfert.AsXmlString(); }, Throws.TypeOf <SepaRuleException>().With.Property("Message").EqualTo("The initial party name is mandatory."));
        }
Пример #5
0
        public void ShouldAcceptNoInitiatingPartyName()
        {
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(100m);

            transfert.InitiatingPartyName = null;

            Assert.DoesNotThrow(() => { transfert.AsXmlString(); });
        }
Пример #6
0
        public void ShouldUseMessageIdentificationAsPaymentInfoIdIfNotDefined()
        {
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(100m);

            transfert.PaymentInfoId = null;

            string result = transfert.AsXmlString();

            Assert.True(result.Contains("<PmtInfId>" + transfert.MessageIdentification + "</PmtInfId>"));
        }
Пример #7
0
        public void ShouldManageOneTransactionTransfer()
        {
            const decimal      amount    = 23.45m;
            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(amount);

            const decimal total = amount * 100;

            Assert.AreEqual(total, transfert.HeaderControlSumInCents);
            Assert.AreEqual(total, transfert.PaymentControlSumInCents);

            Assert.AreEqual(ONE_ROW_RESULT, transfert.AsXmlString());
        }
Пример #8
0
        public void ShouldRejectIfNoTransaction()
        {
            var transfert = new SepaCreditTransfer
            {
                MessageIdentification = "transferID",
                PaymentInfoId         = "paymentInfo",
                InitiatingPartyName   = "Me",
                Debtor = Debtor
            };

            transfert.AsXmlString();
        }
Пример #9
0
        public void ShouldRejectIfNoTransaction()
        {
            var transfert = new SepaCreditTransfer
            {
                MessageIdentification = "transferID",
                PaymentInfoId         = "paymentInfo",
                InitiatingPartyName   = "Me",
                Debtor = Debtor
            };

            Assert.That(() => { transfert.AsXmlString(); }, Throws.TypeOf <SepaRuleException>().With.Property("Message").EqualTo("At least one transaction is needed in a transfer."));
        }
Пример #10
0
        public void ShouldRejectIfNoDebtor()
        {
            var transfert = new SepaCreditTransfer
            {
                MessageIdentification = "transferID",
                PaymentInfoId         = "paymentInfo",
                InitiatingPartyName   = "Me"
            };

            transfert.AddCreditTransfer(CreateTransaction("Transaction Id 1", 100m, "Transaction description"));
            transfert.AsXmlString();
        }
Пример #11
0
        public void ShouldRejectIfNoDebtor()
        {
            var transfert = new SepaCreditTransfer
            {
                MessageIdentification = "transferID",
                PaymentInfoId         = "paymentInfo",
                InitiatingPartyName   = "Me"
            };

            transfert.AddCreditTransfer(CreateTransaction("Transaction Id 1", 100m, "Transaction description"));

            Assert.That(() => { transfert.AsXmlString(); }, Throws.TypeOf <SepaRuleException>().With.Property("Message").EqualTo("The debtor is mandatory."));
        }
        public void ShouldManageMultipleTransactionsTransfer()
        {
            var transfert = new SepaCreditTransfer
            {
                CreationDate           = new DateTime(2013, 02, 17, 22, 38, 12),
                RequestedExecutionDate = new DateTime(2013, 02, 18),
                MessageIdentification  = "transferID",
                PaymentInfoId          = "paymentInfo",
                InitiatingParty        = new InitiatingParty()
                {
                    Name = "Me"
                },
                Debtor = Debtor
            };

            const decimal amount = 23.45m;
            var           trans  = CreateTransaction("Transaction Id 1", amount, "Transaction description");

            trans.EndToEndId = "multiple1";
            transfert.AddCreditTransfer(trans);

            const decimal amount2 = 12.56m;

            trans = CreateTransaction("Transaction Id 2", amount2, "Transaction description 2");
            transfert.AddCreditTransfer(trans);

            const decimal amount3 = 27.35m;

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id       = "Transaction Id 3",
                Creditor = new SepaIbanData
                {
                    Bic  = "BANK_BIC",
                    Iban = "ACCOUNT_IBAN_SAMPLE",
                    Name = "NAME"
                },
                Amount = amount3,
                RemittanceInformation = "Transaction description 3"
            });

            const decimal total = (amount + amount2 + amount3) * 100;

            Assert.AreEqual(total, transfert.HeaderControlSumInCents);
            Assert.AreEqual(total, transfert.PaymentControlSumInCents);

            Assert.AreEqual(MULTIPLE_ROW_RESULT, transfert.AsXmlString());
        }
        public void ShouldValidateThePain00100104XmlSchema()
        {
            var transfert = new SepaCreditTransfer
            {
                CreationDate           = new DateTime(2013, 02, 17, 22, 38, 12),
                RequestedExecutionDate = new DateTime(2013, 02, 18),
                MessageIdentification  = "transferID",
                PaymentInfoId          = "paymentInfo",
                InitiatingParty        = new InitiatingParty()
                {
                    Name = "Me"
                },
                Debtor = Debtor,
                Schema = SepaSchema.Pain00100104
            };

            const decimal amount = 23.45m;
            var           trans  = CreateTransaction("Transaction Id 1", amount, "Transaction description");

            trans.EndToEndId = "multiple1";
            transfert.AddCreditTransfer(trans);

            const decimal amount2 = 12.56m;

            trans = CreateTransaction("Transaction Id 2", amount2, "Transaction description 2");
            transfert.AddCreditTransfer(trans);

            const decimal amount3 = 27.35m;

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id       = "Transaction Id 3",
                Creditor = new SepaIbanData
                {
                    Bic  = "BANK_BIC",
                    Iban = "ACCOUNT_IBAN_SAMPLE",
                    Name = "NAME"
                },
                Amount = amount3,
                RemittanceInformation = "Transaction description 3"
            });

            var validator = XmlValidator.GetValidator(transfert.Schema);

            validator.Validate(transfert.AsXmlString());
        }
Пример #14
0
        public void ShouldKeepEndToEndIdIfSet()
        {
            const decimal amount = 23.45m;

            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(amount);

            var trans = CreateTransaction(null, amount, "Transaction description 2");

            trans.EndToEndId = "endToendId1";
            transfert.AddCreditTransfer(trans);

            trans            = CreateTransaction(null, amount, "Transaction description 3");
            trans.EndToEndId = "endToendId2";
            transfert.AddCreditTransfer(trans);

            string result = transfert.AsXmlString();

            Assert.True(result.Contains("<EndToEndId>endToendId1</EndToEndId>"));
            Assert.True(result.Contains("<EndToEndId>endToendId2</EndToEndId>"));
        }
Пример #15
0
        public void ShouldKeepEndToEndIdIfSet()
        {
            const decimal amount = 23.45m;

            SepaCreditTransfer transfert = GetOneTransactionCreditTransfert(amount);

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id         = null,
                EndToEndId = "endToendId1",
                Creditor   = new SepaIbanData
                {
                    Bic  = "AGRIFRPPXXX",
                    Iban = "FR1420041010050500013M02606",
                    Name = "THEIR_NAME"
                },
                Amount = amount,
                RemittanceInformation = "Transaction description 2"
            });

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id         = null,
                EndToEndId = "endToendId2",
                Creditor   = new SepaIbanData
                {
                    Bic  = "AGRIFRPPXXX",
                    Iban = "FR1420041010050500013M02606",
                    Name = "THEIR_NAME"
                },
                Amount   = amount,
                Currency = "EUR",
                RemittanceInformation = "Transaction description 3"
            });

            string result = transfert.AsXmlString();

            Assert.True(result.Contains("<EndToEndId>endToendId1</EndToEndId>"));
            Assert.True(result.Contains("<EndToEndId>endToendId2</EndToEndId>"));
        }
Пример #16
0
        public void ShouldRejectIfNoDebtor()
        {
            var transfert = new SepaCreditTransfer
            {
                MessageIdentification = "transferID",
                PaymentInfoId         = "paymentInfo",
                InitiatingPartyName   = "Me"
            };

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id       = "Transaction Id 1",
                Creditor =
                    new SepaIbanData
                {
                    Bic  = "AGRIFRPPXXX",
                    Iban = "FR1420041010050500013M02606",
                    Name = "THEIR_NAME"
                },
                Amount = 100m,
                RemittanceInformation = "Transaction description"
            });
            transfert.AsXmlString();
        }
        public void ShouldManageMultipleTransactionsTransfer()
        {
            var transfert = new SepaCreditTransfer
            {
                CreationDate           = new DateTime(2010, 02, 20, 9, 30, 5),
                RequestedExecutionDate = new DateTime(2010, 02, 28),
                MessageIdentification  = "REF/789456/CCT001",
                PaymentInfoId          = "LOT123456",
                InitiatingPartyName    = "TOTO Distribution SA",
                Debtor = new SepaIbanData
                {
                    Bic  = "BANKFRPP",
                    Iban = "FR7621479632145698745632145",
                    Name = "Societe S"
                },
                IsInternational = true,
                ChargeBearer    = SepaChargeBearer.DEBT,
            };

            const decimal amount = 20000m;
            var           trans  = new SepaCreditTransferTransaction
            {
                Id       = "Virement 458A",
                Creditor = new SepaIbanData
                {
                    Bic  = "PNPBUS33",
                    Iban = "US29NWBK60161331926819",
                    Name = "USA Factory"
                },
                Amount                     = amount,
                Currency                   = "USD",
                EndToEndId                 = "SOC/1478/CC/TI001/01",
                RemittanceInformation      = "En reglement des factures numeros : 123456789 987456321 258741369",
                SepaInstructionForCreditor = new SepaInstructionForCreditor()
                {
                    Code = SepaInstructionForCreditor.SepaInstructionForCreditorCode.PHOB
                },
                Purpose = "SCVE",
                RegulatoryReportingCode = "150"
            };

            trans.EndToEndId = "SOC/1478/CC/TI001/01";
            transfert.AddCreditTransfer(trans);

            const decimal amount2 = 1500000m;

            trans = new SepaCreditTransferTransaction
            {
                Id       = "Virement 458B",
                Creditor = new SepaIbanData
                {
                    Bic  = "BANKDEFF",
                    Iban = "DE89370400440532013000",
                    Name = "Japan Society"
                },
                Amount                  = amount2,
                Currency                = "JPY",
                EndToEndId              = "SOC/1478/CC/TI001/02",
                RemittanceInformation   = "En reglement des factures numeros : 321456789A 789456321B  852741370C",
                Purpose                 = "SCVE",
                RegulatoryReportingCode = "150"
            };
            transfert.AddCreditTransfer(trans);

            const decimal total = (amount + amount2) * 100;

            Assert.AreEqual(total, transfert.HeaderControlSumInCents);
            Assert.AreEqual(total, transfert.PaymentControlSumInCents);

            Assert.AreEqual(RESULT, transfert.AsXmlString());
        }
Пример #18
0
        public void ShouldManageMultipleTransactionsTransfer()
        {
            var transfert = new SepaCreditTransfer
            {
                CreationDate = new DateTime(2013, 02, 17, 22, 38, 12),
                RequestedExecutionDate = new DateTime(2013, 02, 18),
                MessageIdentification = "transferID",
                PaymentInfoId = "paymentInfo",
                InitiatingPartyName = "Me",
                Debtor = Debtor
            };

            const decimal amount = 23.45m;
            var trans = CreateTransaction("Transaction Id 1", amount, "Transaction description");
            trans.EndToEndId = "multiple1";
            transfert.AddCreditTransfer(trans);

            const decimal amount2 = 12.56m;
            trans = CreateTransaction("Transaction Id 2", amount2, "Transaction description 2");
            transfert.AddCreditTransfer(trans);

            const decimal amount3 = 27.35m;

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id = "Transaction Id 3",
                Creditor = new SepaIbanData
                {
                    Bic = "BANK_BIC",
                    Iban = "ACCOUNT_IBAN_SAMPLE",
                    Name = "NAME"
                },
                Amount = amount3,
                RemittanceInformation = "Transaction description 3"
            });

            const decimal total = (amount + amount2 + amount3)*100;

            Assert.AreEqual(total, transfert.HeaderControlSumInCents);
            Assert.AreEqual(total, transfert.PaymentControlSumInCents);

            Assert.AreEqual(MULTIPLE_ROW_RESULT, transfert.AsXmlString());
        }
        public void ShouldManageMultipleTransactionsTransfer()
        {
            var transfert = new SepaCreditTransfer
            {
                CreationDate = new DateTime(2010, 02, 20, 9, 30, 5),
                RequestedExecutionDate = new DateTime(2010, 02, 28),
                MessageIdentification = "REF/789456/CCT001",
                PaymentInfoId = "LOT123456",
                InitiatingPartyName = "TOTO Distribution SA",
                Debtor = new SepaIbanData
                {
                    Bic = "BANKFRPP",
                    Iban = "FR7621479632145698745632145",
                    Name = "Societe S"
                },
                IsInternational = true,
                ChargeBearer = SepaChargeBearer.DEBT,
               };

            const decimal amount = 20000m;
            var trans = new SepaCreditTransferTransaction
            {
                Id = "Virement 458A",
                Creditor = new SepaIbanData
                {
                    Bic = "PNPBUS33",
                    Iban = "US29NWBK60161331926819",
                    Name = "USA Factory"
                },
                Amount = amount,
                Currency = "USD",
                EndToEndId = "SOC/1478/CC/TI001/01",
                RemittanceInformation = "En reglement des factures numeros : 123456789 987456321 258741369",
                SepaInstructionForCreditor = new SepaInstructionForCreditor() { Code = SepaInstructionForCreditor.SepaInstructionForCreditorCode.PHOB },
                Purpose = "SCVE",
                RegulatoryReportingCode = "150"
            };
            trans.EndToEndId = "SOC/1478/CC/TI001/01";
            transfert.AddCreditTransfer(trans);

            const decimal amount2 = 1500000m;
            trans = new SepaCreditTransferTransaction
            {
                Id = "Virement 458B",
                Creditor = new SepaIbanData
                {
                    Bic = "BANKDEFF",
                    Iban = "DE89370400440532013000",
                    Name = "Japan Society"
                },
                Amount = amount2,
                Currency = "JPY",
                EndToEndId = "SOC/1478/CC/TI001/02",
                RemittanceInformation = "En reglement des factures numeros : 321456789A 789456321B  852741370C",
                Purpose = "SCVE",
                RegulatoryReportingCode = "150"
            };
            transfert.AddCreditTransfer(trans);

            const decimal total = (amount + amount2)*100;

            Assert.AreEqual(total, transfert.HeaderControlSumInCents);
            Assert.AreEqual(total, transfert.PaymentControlSumInCents);

            Assert.AreEqual(RESULT, transfert.AsXmlString());
        }
Пример #20
0
        public void ShouldValidateThePain00100104XmlSchema()
        {
            var transfert = new SepaCreditTransfer
            {
                CreationDate = new DateTime(2013, 02, 17, 22, 38, 12),
                RequestedExecutionDate = new DateTime(2013, 02, 18),
                MessageIdentification = "transferID",
                PaymentInfoId = "paymentInfo",
                InitiatingPartyName = "Me",
                Debtor = Debtor,
                Schema = SepaSchema.Pain00100104
            };

            const decimal amount = 23.45m;
            var trans = CreateTransaction("Transaction Id 1", amount, "Transaction description");
            trans.EndToEndId = "multiple1";
            transfert.AddCreditTransfer(trans);

            const decimal amount2 = 12.56m;
            trans = CreateTransaction("Transaction Id 2", amount2, "Transaction description 2");
            transfert.AddCreditTransfer(trans);

            const decimal amount3 = 27.35m;

            transfert.AddCreditTransfer(new SepaCreditTransferTransaction
            {
                Id = "Transaction Id 3",
                Creditor = new SepaIbanData
                {
                    Bic = "BANK_BIC",
                    Iban = "ACCOUNT_IBAN_SAMPLE",
                    Name = "NAME"
                },
                Amount = amount3,
                RemittanceInformation = "Transaction description 3"
            });

            var validator = XmlValidator.GetValidator(transfert.Schema);
            validator.Validate(transfert.AsXmlString());
        }
Пример #21
0
        public void ShouldRejectIfNoTransaction()
        {
            var transfert = new SepaCreditTransfer
                {
                    MessageIdentification = "transferID",
                    PaymentInfoId = "paymentInfo",
                    InitiatingPartyName = "Me",
                    Debtor = Debtor
                };

            Assert.That(() => { transfert.AsXmlString(); }, Throws.TypeOf<SepaRuleException>().With.Property("Message").EqualTo("At least one transaction is needed in a transfer."));
        }
Пример #22
0
        public void ShouldRejectIfNoDebtor()
        {
            var transfert = new SepaCreditTransfer
            {
                MessageIdentification = "transferID",
                PaymentInfoId = "paymentInfo",
                InitiatingPartyName = "Me"
            };
            transfert.AddCreditTransfer(CreateTransaction("Transaction Id 1", 100m, "Transaction description"));

            Assert.That(() => { transfert.AsXmlString(); }, Throws.TypeOf<SepaRuleException>().With.Property("Message").EqualTo("The debtor is mandatory."));
        }
 public void ShouldRejectIfNoDebtor()
 {
     var transfert = new SepaCreditTransfer
         {
             MessageIdentification = "transferID",
             PaymentInfoId = "paymentInfo",
             InitiatingPartyName = "Me"
         };
     transfert.AddCreditTransfer(CreateTransaction("Transaction Id 1", 100m, "Transaction description"));
     transfert.AsXmlString();
 }
        public void ShouldRejectIfNoTransaction()
        {
            var transfert = new SepaCreditTransfer
                {
                    MessageIdentification = "transferID",
                    PaymentInfoId = "paymentInfo",
                    InitiatingPartyName = "Me",
                    Debtor = Debtor
                };

            transfert.AsXmlString();
        }