Ejemplo n.º 1
0
 public PaymentRequest AddCurrency(string value)
 {
     if (Amount == null)
     {
         Amount = new RxpAmount().AddCurrency(value);
     }
     else
     {
         Amount.AddCurrency(value);
     }
     return(this);
 }
Ejemplo n.º 2
0
 public PaymentRequest AddAmount(long value)
 {
     if (Amount == null)
     {
         Amount = new RxpAmount().AddAmount(value);
     }
     else
     {
         Amount.AddAmount(value);
     }
     return(this);
 }
Ejemplo n.º 3
0
        public void ThreeDSecureSigRequestXmlWithSettersTest()
        {
            Card card = new Card();

            card.ExpiryDate     = sx.CARD_EXPIRY_DATE;
            card.Number         = sx.CARD_NUMBER;
            card.Type           = CardType.VISA;
            card.CardHolderName = sx.CARD_HOLDER_NAME;
            card.IssueNumber    = sx.CARD_ISSUE_NUMBER;

            Cvn cvn = new Cvn();

            cvn.Number            = sx.CARD_CVN_NUMBER;
            cvn.PresenceIndicator = sx.CARD_CVN_PRESENCE;
            card.Cvn = cvn;

            ThreeDSecureRequest request = new ThreeDSecureRequest();

            request.Account    = sx.ACCOUNT;
            request.MerchantId = sx.MERCHANT_ID;

            RxpAmount amount = new RxpAmount();

            amount.Amount   = sx.AMOUNT;
            amount.Currency = sx.CURRENCY;
            request.Amount  = amount;

            request.Card      = card;
            request.Timestamp = sx.TIMESTAMP;
            request.OrderId   = sx.ORDER_ID;
            request.Pares     = sx.THREE_D_SECURE_PARES;
            request.Hash      = sx.THREE_D_SECURE_VERIFY_SIG_REQUEST_HASH;
            request.Type      = ThreeDSecureType.VERIFY_SIG;

            //convert to XML
            string xml = request.ToXml();

            //Convert from XML back to PaymentRequest
            ThreeDSecureRequest fromXmlRequest = new ThreeDSecureRequest().FromXml(xml);

            sx.checkUnmarshalledVerifySigRequest(fromXmlRequest);
        }
Ejemplo n.º 4
0
        public void PaymentRequestXmlSettersTest()
        {
            Card card = new Card();

            card.ExpiryDate     = sx.CARD_EXPIRY_DATE;
            card.Number         = sx.CARD_NUMBER;
            card.Type           = CardType.VISA;
            card.CardHolderName = sx.CARD_HOLDER_NAME;
            card.IssueNumber    = sx.CARD_ISSUE_NUMBER;

            Cvn cvn = new Cvn();

            cvn.Number            = sx.CARD_CVN_NUMBER;
            cvn.PresenceIndicator = sx.CARD_CVN_PRESENCE;
            card.Cvn = cvn;

            PaymentRequest request = new PaymentRequest();

            request.Account    = sx.ACCOUNT;
            request.MerchantId = sx.MERCHANT_ID;
            request.Type       = PaymentType.AUTH;

            RxpAmount amount = new RxpAmount();

            amount.Amount   = sx.AMOUNT;
            amount.Currency = sx.CURRENCY;
            request.Amount  = amount;

            AutoSettle autoSettle = new AutoSettle();

            autoSettle.Flag = sx.AUTO_SETTLE_FLAG;

            request.AutoSettle = autoSettle;
            request.Card       = card;
            request.Timestamp  = sx.TIMESTAMP;
            request.Channel    = sx.CHANNEL;
            request.OrderId    = sx.ORDER_ID;
            request.Hash       = sx.REQUEST_HASH;

            List <RxpComment> comments = new List <RxpComment>();
            RxpComment        comment  = new RxpComment();

            comment.Id      = 1;
            comment.Comment = sx.COMMENT1;
            comments.Add(comment);
            comment         = new RxpComment();
            comment.Id      = 2;
            comment.Comment = sx.COMMENT2;
            comments.Add(comment);
            request.Comments = comments;

            request.PaymentsReference = sx.PASREF;
            request.AuthCode          = sx.AUTH_CODE;
            request.RefundHash        = sx.REFUND_HASH;
            request.FraudFilter       = sx.FRAUD_FILTER;

            Recurring recurring = new Recurring();

            recurring.Flag     = sx.RECURRING_FLAG;
            recurring.Sequence = sx.RECURRING_SEQUENCE;
            recurring.Type     = sx.RECURRING_TYPE;
            request.Recurring  = recurring;

            TssInfo tssInfo = new TssInfo();

            tssInfo.CustomerNumber    = sx.CUSTOMER_NUMBER;
            tssInfo.ProductId         = sx.PRODUCT_ID;
            tssInfo.VariableReference = sx.VARIABLE_REFERENCE;
            tssInfo.CustomerIpAddress = sx.CUSTOMER_IP;

            List <Address> addresses = new List <Address>();
            Address        address   = new Address();

            address.Type    = sx.ADDRESS_TYPE_BUSINESS;
            address.Code    = sx.ADDRESS_CODE_BUSINESS;
            address.Country = sx.ADDRESS_COUNTRY_BUSINESS;
            addresses.Add(address);

            address         = new Address();
            address.Type    = sx.ADDRESS_TYPE_SHIPPING;
            address.Code    = sx.ADDRESS_CODE_SHIPPING;
            address.Country = sx.ADDRESS_COUNTRY_SHIPPING;
            addresses.Add(address);

            tssInfo.Addresses = addresses;
            request.TssInfo   = tssInfo;

            Mpi mpi = new Mpi();

            mpi.Cavv    = sx.THREE_D_SECURE_CAVV;
            mpi.Xid     = sx.THREE_D_SECURE_XID;
            mpi.Eci     = sx.THREE_D_SECURE_ECI;
            request.Mpi = mpi;

            //convert to XML
            string xml = request.ToXml();

            //Convert from XML back to PaymentRequest
            PaymentRequest fromXmlRequest = new PaymentRequest().FromXml(xml);

            sx.checkUnmarshalledPaymentRequest(fromXmlRequest);
        }