示例#1
0
        public string GetTransactionRequest(AmendmentRequest amendmentRequest, string containedData)
        {
            VerifyExpirationPeriod(amendmentRequest.ExpirationPeriod);

            var containedDocument = new XmlDocument();

            containedDocument.LoadXml(containedData);

            var acquirerTrxReq = new AcquirerTrxReq
            {
                createDateTimestamp = Now(),
                productID           = this.LocalInstrumentCode == Instrumentation.Core ? ProductId_CORE : ProductId_B2B,
                version             = "1.0.0",

                Merchant = new AcquirerTrxReqMerchant
                {
                    merchantID        = Configuration.Contract.Id,
                    subID             = Configuration.Contract.SubId.ToString(CultureInfo.InvariantCulture),
                    merchantReturnURL = Configuration.Merchant.ReturnUrl
                },

                Issuer = new AcquirerTrxReqIssuer
                {
                    issuerID = amendmentRequest.DebtorBankId
                },

                Transaction = new AcquirerTrxReqTransaction
                {
                    entranceCode = amendmentRequest.EntranceCode,

                    expirationPeriod = amendmentRequest.ExpirationPeriod.HasValue ? XmlConvert.ToString(amendmentRequest.ExpirationPeriod.Value) : null,
                    language         = amendmentRequest.Language.ToString(),
                    container        = new Transactioncontainer
                    {
                        Any = new[] { containedDocument.DocumentElement }
                    }
                }
            };

            return(ProcessDateTimes(acquirerTrxReq.Serialize()));
        }
        public string GetAmend(AmendmentRequest amendmentRequest)
        {
            var eMandate = new p10.Document
            {
                MndtAmdmntReq = new p10.MandateAmendmentRequestV04
                {
                    GrpHdr = new p10.GroupHeader47
                    {
                        MsgId   = amendmentRequest.MessageId,
                        CreDtTm = Now(),
                    },
                    UndrlygAmdmntDtls = new []
                    {
                        new p10.MandateAmendment4
                        {
                            AmdmntRsn = new p10.MandateAmendmentReason1
                            {
                                Rsn = new p10.MandateReason1Choice
                                {
                                    ItemElementName = p10.ItemChoiceType4.Cd,
                                    Item            = "MD16"
                                }
                            },
                            OrgnlMndt = new p10.OriginalMandate3Choice
                            {
                                Item = new p10.Mandate5
                                {
                                    MndtId = amendmentRequest.EMandateId,
                                    //MndtReqId = "NOTPROVIDED",
                                    Cdtr     = new p10.PartyIdentification43(),
                                    Dbtr     = new p10.PartyIdentification43(),
                                    DbtrAcct = new p10.CashAccount24
                                    {
                                        Id = new p10.AccountIdentification4Choice
                                        {
                                            Item = amendmentRequest.OriginalIban
                                        }
                                    },
                                    DbtrAgt = new p10.BranchAndFinancialInstitutionIdentification5
                                    {
                                        FinInstnId = new p10.FinancialInstitutionIdentification8
                                        {
                                            BICFI = amendmentRequest.OriginalDebtorBankId
                                        }
                                    }
                                }
                            },
                            Mndt = new p10.Mandate6
                            {
                                MndtId    = amendmentRequest.EMandateId,
                                MndtReqId = "NOTPROVIDED",
                                Tp        = new p10.MandateTypeInformation1
                                {
                                    SvcLvl = new p10.ServiceLevel8Choice
                                    {
                                        ItemElementName = p10.ItemChoiceType5.Cd,
                                        Item            = "SEPA"
                                    },
                                    LclInstrm = new p10.LocalInstrument2Choice
                                    {
                                        ItemElementName = p10.ItemChoiceType6.Cd,
                                        Item            = Enum.GetName(typeof(Instrumentation), this.LocalInstrumentCode).ToUpper()
                                    },
                                },
                                Ocrncs = new p10.MandateOccurrences3
                                {
                                    SeqTp = (p10.SequenceType2Code)amendmentRequest.SequenceType
                                            // TODO: not allowed
                                            //Frqcy = new p10.Frequency21Choice
                                            //{
                                            //    Item = new p10.FrequencyPeriod1
                                            //    {
                                            //        Tp = p10.Frequency6Code.YEAR
                                            //        CntPerPrd = 1.0m
                                            //    }
                                            //}
                                },
                                Rsn = amendmentRequest.EMandateReason != null? new p10.MandateSetupReason1Choice
                                {
                                    ItemElementName = p10.ItemChoiceType7.Prtry,
                                    Item            = amendmentRequest.EMandateReason ?? string.Empty
                                } : null,
                                Cdtr = new p10.PartyIdentification43
                                {
                                },
                                Dbtr = new p10.PartyIdentification43
                                {
                                    Id = amendmentRequest.DebtorReference != null? new p10.Party11Choice
                                    {
                                        Item = new p10.PersonIdentification5
                                        {
                                            Othr = new []
                                            {
                                                new p10.GenericPersonIdentification1
                                                {
                                                    Id = amendmentRequest.DebtorReference
                                                }
                                            }
                                        }
                                    } : null,
                                },
                                DbtrAgt = new p10.BranchAndFinancialInstitutionIdentification5
                                {
                                    FinInstnId = new p10.FinancialInstitutionIdentification8
                                    {
                                        BICFI = amendmentRequest.DebtorBankId
                                    }
                                },
                                RfrdDoc = amendmentRequest.PurchaseId != null? new []
                                {
                                    new p10.ReferredDocumentInformation6
                                    {
                                        Tp = new p10.ReferredDocumentType4
                                        {
                                            CdOrPrtry = new p10.ReferredDocumentType3Choice
                                            {
                                                Item = amendmentRequest.PurchaseId
                                            }
                                        }
                                    }
                                } : null
                            }
                        }
                    }
                }
            };

            return(ProcessDateTimes(eMandate.Serialize()));
        }