Пример #1
0
        public void TestProperties()
        {
            //this will throw because auth not set and price changed
            CheckoutControl coc = new CheckoutControl {
                ProductID = "prod1", VendorID = "Vend1", AppName = "Appname"
            };

            coc.TransactionCompleteEvent += (o, e) => { };
            coc.TransactionErrorEvent    += (o, e) => { };

            coc.StartPurchase();
        }
Пример #2
0
        public MainWindow()
        {
            InitializeComponent();

            //To show control:
            // Create form instance
            //set required properties
            //load into Control Host

            CheckoutControl checkoutControl = new CheckoutControl();

            //Get credentials from vendor dashboard
            string vendor_id  = "12345";
            string app_name   = "AppName1";
            string product_id = "123456";

            checkoutControl.VendorID  = vendor_id;
            checkoutControl.ProductID = product_id;
            checkoutControl.AppName   = app_name;

            //Required
            checkoutControl.TransactionBeginEvent += CheckoutControl_TransactionBeginEvent;
            //optional
            checkoutControl.TransactionErrorEvent    += CheckoutControl_TranactionErrorEvent;
            checkoutControl.TransactionCompleteEvent += CheckoutControl_TransactionCompleteEvent;
            checkoutControl.CheckoutClosed           += CheckoutControl_CheckoutClosed;

            WBControlHost.Child = checkoutControl;

            // once form set into Control Host call the StartPurchace method

            checkoutControl.StartPurchase();

            // Transaction Information can be retrieved before control disposed
            // The same information is passed in the transaction done event
            ProcessStatus ps          = checkoutControl.ProcessStatus;
            string        userCountry = checkoutControl.UserCountry;
        }