Пример #1
0
        void DtPayementControllerStatic()
        {
            var paymentRequest = new DTPaymentRequest()
            {
                AmountInSmallestCurrencyUnit = 100,
                CurrencyCode = @"CHF",
                LocalizedPriceDescription = @"CHF 1.-",
                MerchantId = @"12345",                   // The MerchantId is provided by datatrans
                                                         // 10000011011 from doc will not work
                                                         // 1000011643 from doc will not work neither
                                                         // contact Datatrans to have a working iPhone test account
                Refno = @"testld",
                LocalizedMerchantName = "11643"
            };

            var po = new DTPaymentOptions()
            {
                HideToolbarSecurityInfo     = true,
                ReturnsCreditCard           = DTPaymentReturnsCreditCard.Never,
                ShowBackButtonOnFirstScreen = false,
                Testing = true                  // to be removed
            };

            var payementMethod = new [] {
                (string)DTPaymentOptions.Visa,
                (string)DTPaymentOptions.MasterCard,
                (string)DTPaymentOptions.PostFinanceCard,
                (string)DTPaymentOptions.PostFinanceEFinance
            };


            cpc  = new UserPaymentContoller(nav);
            dtpc = DTPaymentController.PaymentControllerWithDelegate(cpc, paymentRequest, payementMethod);
            dtpc.PaymentOptions = po;
            dtpc.PresentInNavigationController(nav, true);
        }
        void DtPayementControllerStatic()
        {
            var paymentRequest = new DTPaymentRequest() {
                AmountInSmallestCurrencyUnit = 100,
                CurrencyCode = @"CHF",
                LocalizedPriceDescription = @"CHF 1.-",
                MerchantId = @"12345",   // The MerchantId is provided by datatrans
                                         // 10000011011 from doc will not work
                                         // 1000011643 from doc will not work neither
                                         // contact Datatrans to have a working iPhone test account
                Refno = @"testld",
                LocalizedMerchantName = "11643"

            };

            var po = new DTPaymentOptions() {
                HideToolbarSecurityInfo = true,
                ReturnsCreditCard = DTPaymentReturnsCreditCard.Never,
                ShowBackButtonOnFirstScreen = false,
                Testing = true  // to be removed
            };

            var payementMethod = new [] {
                (string) DTPaymentOptions.Visa,
                (string) DTPaymentOptions.MasterCard,
                (string) DTPaymentOptions.PostFinanceCard,
                (string) DTPaymentOptions.PostFinanceEFinance
            };

            cpc = new UserPaymentContoller(nav);
            dtpc = DTPaymentController.PaymentControllerWithDelegate (cpc, paymentRequest, payementMethod);
            dtpc.PaymentOptions = po;
            dtpc.PresentInNavigationController (nav, true);
        }
Пример #3
0
        void DtPayementController()
        {
            var method  = RootAt(rootNode, 0, 0);
            var request = RootAt(rootNode, 0, 1);
            var options = RootAt(rootNode, 0, 2);


            uint amount = 0;

            uint.TryParse(StringAt(request, 0, 0), out amount);
            var currency     = StringAt(request, 0, 1);
            var price        = StringAt(request, 0, 2);
            var merchantid   = StringAt(request, 0, 3);
            var refno        = StringAt(request, 0, 4);
            var merchantname = StringAt(request, 0, 5);


            var hideToolbar = BoolAt(options, 0, 0);
            var rcc         = SelAt(options, 0, 1);
            var showBack    = BoolAt(options, 0, 2);
            var testing     = BoolAt(options, 0, 3);

            DTPaymentReturnsCreditCard dprcc = DTPaymentReturnsCreditCard.Never;

            Enum.TryParse <DTPaymentReturnsCreditCard>(rcc.Caption, out dprcc);

            var paymentRequest = new DTPaymentRequest()
            {
                AmountInSmallestCurrencyUnit = amount,
                CurrencyCode = currency,
                LocalizedPriceDescription = price,
                MerchantId = merchantid,                 // The MerchantId is provided by datatrans
                                                         // 10000011011 from doc will not work
                                                         // 1000011643 from doc will not work neither
                                                         // contact Datatrans to have a working iPhone test account
                Refno = refno,
                LocalizedMerchantName = merchantname
            };

            var po = new DTPaymentOptions()
            {
                HideToolbarSecurityInfo     = hideToolbar,
                ReturnsCreditCard           = dprcc,
                ShowBackButtonOnFirstScreen = showBack,
                Testing = testing
            };

            var payementMethod = new List <string>();

            foreach (CheckboxElement e in method[0].Elements)
            {
                if (e.Value)
                {
                    payementMethod.Add(e.Caption);
                }
            }
            var pma = payementMethod.ToArray();

            Debug(paymentRequest);
            Debug(po);
            Debug(pma);

            cpc  = new UserPaymentContoller(nav);
            dtpc = DTPaymentController.PaymentControllerWithDelegate(cpc, paymentRequest, pma);
            dtpc.PaymentOptions = po;
            dtpc.PresentInNavigationController(nav, true);
        }
        void DtPayementController()
        {
            var method = RootAt(rootNode, 0, 0);
            var request = RootAt(rootNode, 0, 1);
            var options = RootAt(rootNode, 0, 2);

            uint amount = 0;
            uint.TryParse(StringAt(request, 0, 0), out amount);
            var currency = StringAt(request, 0, 1);
            var price = StringAt(request, 0, 2);
            var merchantid = StringAt(request, 0, 3);
            var refno = StringAt(request, 0, 4);
            var merchantname = StringAt(request, 0, 5);

            var hideToolbar = BoolAt(options, 0,0);
            var rcc = SelAt(options, 0,1);
            var showBack = BoolAt(options, 0,2);
            var testing = BoolAt(options, 0,3);

            DTPaymentReturnsCreditCard dprcc= DTPaymentReturnsCreditCard.Never;
            Enum.TryParse<DTPaymentReturnsCreditCard>(rcc.Caption, out dprcc);

            var paymentRequest = new DTPaymentRequest() {
                AmountInSmallestCurrencyUnit = amount,
                CurrencyCode = currency,
                LocalizedPriceDescription = price,
                MerchantId = merchantid, // The MerchantId is provided by datatrans
                                         // 10000011011 from doc will not work
                                         // 1000011643 from doc will not work neither
                                         // contact Datatrans to have a working iPhone test account
                Refno = refno,
                LocalizedMerchantName = merchantname

            };

            var po = new DTPaymentOptions() {
                HideToolbarSecurityInfo = hideToolbar,
                ReturnsCreditCard = dprcc,
                ShowBackButtonOnFirstScreen = showBack,
                Testing = testing
            };

            var payementMethod = new List<string>();
            foreach(CheckboxElement e in method[0].Elements) {
                if (e.Value) {
                    payementMethod.Add(e.Caption);
                }
            }
            var pma = payementMethod.ToArray();

            Debug(paymentRequest);
            Debug(po);
            Debug(pma);

            cpc = new UserPaymentContoller(nav);
            dtpc = DTPaymentController.PaymentControllerWithDelegate (cpc, paymentRequest, pma);
            dtpc.PaymentOptions = po;
            dtpc.PresentInNavigationController (nav, true);
        }