public override void DidSucceed(DtPaymentController controller, DtPaymentRequest request)
 {
     Console.WriteLine("DidSucceed:");
     RootNavigation.PopToRootViewController(true);
 }
Exemplo n.º 2
0
        void DtPayementController()
        {
            var method = RootAt(rootNode, 0, 0);
            var request = RootAt(rootNode, 0, 1);
            var options = RootAt(rootNode, 0, 2);

            int amount = 0;
            int.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.FromDelegate(cpc, paymentRequest, pma);
            dtpc.PaymentOptions = po;
            dtpc.PresentIn(nav, true);
        }
Exemplo n.º 3
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 [] {
                DtPaymentMethod.Visa,
                DtPaymentMethod.MasterCard,
                DtPaymentMethod.PostFinanceCard,
                DtPaymentMethod.PostFinanceEFinance };

            cpc = new UserPaymentContoller(nav);
            dtpc = DtPaymentController.FromDelegate(cpc, paymentRequest, payementMethod);
            dtpc.PaymentOptions = po;
            dtpc.PresentIn(nav, true);
        }
Exemplo n.º 4
0
 void Debug(DtPaymentRequest pr)
 {
     Console.WriteLine();
     Console.WriteLine("DtPaymentRequest");
     Console.WriteLine("   AmountInSmallestCurrencyUnit: {0}", pr.AmountInSmallestCurrencyUnit);
     Console.WriteLine("   CurrencyCode: {0}", pr.CurrencyCode);
     Console.WriteLine("   LocalizedPriceDescription: {0}", pr.LocalizedPriceDescription);
     Console.WriteLine("   Refno: {0}", pr.Refno);
     Console.WriteLine("   LocalizedMerchantName: {0}", pr.LocalizedMerchantName);
     Console.WriteLine("   MerchantId: {0}", pr.MerchantId);
     Console.WriteLine();
 }