Example #1
0
    public static void Main()
    {
        SwipeCard oSwipe = new SwipeCard();
        Manager   oMgr   = new Manager();

        //Association
        //oMgr.LogOn(oSwipe)
    }
        static void Main(string[] args)
        {
            //Even if these objects objManager and objSwipe depend on each other for methods Logon() and Swipe() they can
            //exist independent as well for methods GetManagerName() and MakeofSwipe()
            //This kind of relationship is called as association as it has 2 characteristics:
            //1.thier is no parent object or owner still they can use still each other
            //2.lifetime of both the objects are different
            Manager objManager = new Manager();

            SwipeCard objSwipe = new SwipeCard();
        }
Example #3
0
        public void runCode()
        {
            Manager   manager = new Manager("Bob");
            SwipeCard card    = new SwipeCard("Oza18");


            //association
            manager.logon(card);
            card.Swipe(manager);

            //composition
            manager.Performance(true);
            Project project = new Project(manager);
        }
Example #4
0
    public SwipeCard SpawnCard(int index)
    {
        if (index >= deck.Count)
        {
            return(null);
        }

        GameObject newCard  = Instantiate(cardPrefab);
        SwipeCard  newSwipe = newCard.GetComponent <SwipeCard>();

        newCard.transform.position = cardSpawnPos.position;
        newSwipe.cardData          = deck[index];
        newSwipe.Initialize();

        return(newSwipe);
    }
Example #5
0
        private BaseTender GetTender(PaymentInfo paymentInfo)
        {
            if (paymentInfo is CreditCardPaymentInfo)
            {
                var cc           = paymentInfo as CreditCardPaymentInfo;
                var ppCreditCard = new CreditCard(cc.Number, cc.ExpirationDate.ToString("MMyy"));
                ppCreditCard.Cvv2 = cc.Code;
                return(new CardTender(ppCreditCard));
            }

            if (paymentInfo is ACHPaymentInfo)
            {
                var ach           = paymentInfo as ACHPaymentInfo;
                var ppBankAccount = new BankAcct(ach.BankAccountNumber, ach.BankRoutingNumber);
                ppBankAccount.AcctType = ach.AccountType == BankAccountType.Checking ? "C" : "S";
                return(new ACHTender(ppBankAccount));
            }

            if (paymentInfo is SwipePaymentInfo)
            {
                var swipe       = paymentInfo as SwipePaymentInfo;
                var ppSwipeCard = new SwipeCard(swipe.SwipeInfo);
                return(new CardTender(ppSwipeCard));
            }

            if (paymentInfo is ReferencePaymentInfo)
            {
                var reference = paymentInfo as ReferencePaymentInfo;
                if (reference.CurrencyTypeValue != null && reference.CurrencyTypeValue.Guid.Equals(new Guid(Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_ACH)))
                {
                    return(new ACHTender(( BankAcct )null));
                }
                else
                {
                    return(new CardTender(( CreditCard )null));
                }
            }

            return(null);
        }
Example #6
0
        private BaseTender GetTender( PaymentInfo paymentInfo )
        {
            if ( paymentInfo is CreditCardPaymentInfo )
            {
                var cc = paymentInfo as CreditCardPaymentInfo;
                var ppCreditCard = new CreditCard( cc.Number, cc.ExpirationDate.ToString( "MMyy" ) );
                ppCreditCard.Cvv2 = cc.Code;
                return new CardTender( ppCreditCard );
            }

            if ( paymentInfo is ACHPaymentInfo )
            {
                var ach = paymentInfo as ACHPaymentInfo;
                var ppBankAccount = new BankAcct( ach.BankAccountNumber, ach.BankRoutingNumber );
                ppBankAccount.AcctType = ach.AccountType == BankAccountType.Checking ? "C" : "S";
                ppBankAccount.Name = ach.BankName;
                return new ACHTender( ppBankAccount );
            }

            if ( paymentInfo is SwipePaymentInfo )
            {
                var swipe = paymentInfo as SwipePaymentInfo;
                var ppSwipeCard = new SwipeCard( swipe.SwipeInfo );
                return new CardTender( ppSwipeCard );
            }

            if ( paymentInfo is ReferencePaymentInfo )
            {
                var reference = paymentInfo as ReferencePaymentInfo;
                if ( reference.CurrencyTypeValue.Guid.Equals( new Guid( Rock.SystemGuid.DefinedValue.CURRENCY_TYPE_ACH ) ) )
                {
                    return new ACHTender( (BankAcct)null );
                }
                else
                {
                    return new CardTender( (CreditCard)null );
                }
            }
            return null;
        }
Example #7
0
 public void logon(SwipeCard sc)
 {
     sc.Swipe(this);
 }
Example #8
0
        public static void Main(string[] Args)
        {
            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Executing Sample from File: DOSwipe.cs");
            Console.WriteLine("------------------------------------------------------");

            // Create the Data Objects.
            // Create the User data object with the required user details.
            UserInfo User = new UserInfo("<user>", "<vendor>", "<partner>", "<password>");

            // Create the Payflow Connection data object with the required connection details.
            // The PAYFLOW_HOST property is defined in the App config file.
            PayflowConnectionData Connection = new PayflowConnectionData();

            // Create a new Invoice data object with the Amount, Billing Address etc. details.
            Invoice Inv = new Invoice();

            // Set Amount.
            Currency Amt = new Currency(new decimal(25.25));

            Inv.Amt      = Amt;
            Inv.PoNum    = "PO12345";
            Inv.InvNum   = "INV12345";
            Inv.Comment1 = "Swipe Example";

            // Create a new Payment Device - Swipe data object.  The input parameter is Swipe Data.
            // Used to pass the Track 1 or Track 2 data (the card’s magnetic stripe information) for card-present
            // transactions. Include either Track 1 or Track 2 data—not both. If Track 1 is physically damaged,
            // the POS application can send Track 2 data instead.

            // The parameter data for the SwipeCard object is usually obtained with a card reader.
            // NOTE: The SWIPE parameter is not supported on accounts where PayPal is the Processor.
            SwipeCard Swipe = new SwipeCard(";5105105105105100=20121011000012345678?");
            // Create a new Tender - Swipe Tender data object.
            CardTender Card = new CardTender(Swipe);

            // Create a new Sale Transaction using Swipe data.
            SaleTransaction Trans = new SaleTransaction(User, Connection, Inv, Card, PayflowUtility.RequestId);

            // Submit the Transaction
            Response Resp = Trans.SubmitTransaction();

            // Display the transaction response parameters.
            if (Resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse TrxnResponse = Resp.TransactionResponse;

                if (TrxnResponse != null)
                {
                    Console.WriteLine("RESULT = " + TrxnResponse.Result);
                    Console.WriteLine("PNREF = " + TrxnResponse.Pnref);
                    Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg);
                    Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode);
                    // If value is true, then the Request ID has not been changed and the original response
                    // of the original transction is returned.
                    Console.WriteLine("DUPLICATE = " + TrxnResponse.Duplicate);
                }

                // Display the response.
                Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp));

                // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                Context TransCtx = Resp.TransactionContext;
                if (TransCtx != null && TransCtx.getErrorCount() > 0)
                {
                    Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
                }
            }
            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();
        }
Example #9
0
        public static void Main(string[] Args)
        {
            Console.WriteLine("------------------------------------------------------");
            Console.WriteLine("Executing Sample from File: DOEncryptedSwipe.cs");
            Console.WriteLine("------------------------------------------------------");

            // Create the Data Objects.
            // Create the User data object with the required user details.
            UserInfo User = new UserInfo("<user>", "<vendor>", "<partner>", "<password>");

            // Create the Payflow Connection data object with the required connection details.
            // The PAYFLOW_HOST property is defined in the App config file.
            PayflowConnectionData Connection = new PayflowConnectionData();

            // Create a new Invoice data object with the Amount, Billing Address etc. details.
            Invoice Inv = new Invoice();

            // Set Amount.
            Currency Amt = new Currency(new decimal(1.00));

            Inv.Amt      = Amt;
            Inv.PoNum    = "PO12345";
            Inv.InvNum   = "INV12345";
            Inv.Comment1 = "Magtek Encrypted Swipe Example";

            // Create a new Payment Device - Swipe data object.  The input parameter is Swipe Data.
            // The data passed in this example will be extracted from a Magtek Encrypted Card reader.  Please refer
            // to the Magtek SDK and documentation on how to obtain the data from the reader.
            // The parameter data for the SwipeCard object is usually obtained with a card reader and this shows
            // how to send data obtained from a Magtek Encrypted reader.
            // NOTE: The SWIPE parameter is not supported on accounts where PayPal is the Processor.

            // Create a new Magtek data object with the device serial number, track data, etc.
            MagtekInfo MT = new MagtekInfo();

            // The data below CANNOT be used for Testing. It is only here to show what the data fields look like once you
            // obtain them from the reader itself.  Refer to the Payflow Pro Developers Guide and the Appendix related to processing
            // with Magtek card readers for more information.
            // The Payflow Gateway Developer Guide and Reference found at https://developer.paypal.com/docs/classic/payflow/integration-guide/
            MT.DeviceSN            = "B32XXXXXXXXXXAA";
            MT.EncMP               = "34F29380E6AFED395472A63063B6XXXXXXXXXXXXXXXXXXXXXXXXXC987D2A1F7A50554DFC4A0D215A8AA0591D82B6DB13516F220C4CB93899";
            MT.EncryptionBlockType = "1";
            MT.EncTrack1           = "80BC13515EF76421FCXXXXXXXXXXXXXXXXXXXXXXXXX02E53C0ECCC83B1787DE05BB5D8C7FA679D0C40CC989F7FAF307FE7FD0B588261DDA0";
            MT.EncTrack2           = "4CDD6BC521B397CD2DB1324199XXXXXXXXXXXXXXXXXXXXXXXXX83A9044B397C1D14AFEE2C0BA1002";
            MT.EncTrack3           = "";
            MT.KSN            = "901188XXXXXXXXXX00F4";
            MT.MagtekCardType = "1";
            MT.MPStatus       = "61403000";
            MT.RegisteredBy   = "PayPal";
            MT.SwipedECRHost  = "MAGT";

            // When using Encrypted Card Readers you do not populate the SwipeCard object as the data from the Magtek object
            // will be used instead.
            SwipeCard Swipe = new SwipeCard("");

            Swipe.MagtekInfo = MT;

            // Create a new Tender - Swipe Tender data object.
            CardTender Card = new CardTender(Swipe);

            // Create a new Sale Transaction using Swipe data.
            SaleTransaction Trans = new SaleTransaction(User, Connection, Inv, Card, PayflowUtility.RequestId);

            // Submit the Transaction
            Response Resp = Trans.SubmitTransaction();

            // Display the transaction response parameters.
            if (Resp != null)
            {
                // Get the Transaction Response parameters.
                TransactionResponse TrxnResponse = Resp.TransactionResponse;

                if (TrxnResponse != null)
                {
                    Console.WriteLine("RESULT = " + TrxnResponse.Result);
                    Console.WriteLine("PNREF = " + TrxnResponse.Pnref);
                    Console.WriteLine("RESPMSG = " + TrxnResponse.RespMsg);
                    Console.WriteLine("AUTHCODE = " + TrxnResponse.AuthCode);
                    // Magtek Response will only be available if a failure or error in the request.
                    Console.WriteLine("MAGTRESPONSE = " + TrxnResponse.MagTResponse);
                    // If value is true, then the Request ID has not been changed and the original response
                    // of the original transaction is returned.
                    Console.WriteLine("DUPLICATE = " + TrxnResponse.Duplicate);
                }

                // Display the response.
                Console.WriteLine(Environment.NewLine + PayflowUtility.GetStatus(Resp));

                // Get the Transaction Context and check for any contained SDK specific errors (optional code).
                Context TransCtx = Resp.TransactionContext;
                if (TransCtx != null && TransCtx.getErrorCount() > 0)
                {
                    Console.WriteLine(Environment.NewLine + "Transaction Errors = " + TransCtx.ToString());
                }
            }
            Console.WriteLine("Press Enter to Exit ...");
            Console.ReadLine();
        }
Example #10
0
 public void LogOn(SwipeCard o)
 {
     o.Swipe(this);
 }
 public void SetActiveCard(SwipeCard newCard)
 {
     activeCard = newCard;
 }