Exemplo n.º 1
0
 public void LogOut()
 {
     Payleven.LogoutWithCompletionHandler((errorHandler) =>
     {
         // TODO: check if there is error
     });
 }
Exemplo n.º 2
0
        public void Pay(PLVDevice device, string paymentAmount)
        {
            if (device == null)
            {
                // Payleven: device not found
                StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusDeviceNotFound);
                return;
            }

            if (!LocationCoordinate.IsValid())
            {
                // Payleven: coordinates are not valid
                StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusCoordsIsNotValid);
                return;
            }

            var paymentRequest = new PLVPaymentRequest(PaymentHelper.GetRandomNSString(), PaymentHelper.LocaleAmount(paymentAmount),
                                                       Currency, LocationCoordinate);

            var paymentTask = Payleven.PaymentTaskWithRequest(paymentRequest, device, this);

            if (paymentTask == null)
            {
                // Payleven: error with creating payment
                StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusError);
                return;
            }
            else
            {
                // Payleven: payment has started!
                paymentTask.Start();
            }
        }
Exemplo n.º 3
0
 public void LogInAndPay(NSString userName, NSString userPassword, string amount)
 {
     if (Payleven.LoginState == PLVPaylevenLoginState.PLVPaylevenLoginStateLoggedIn)
     {
         // Payleven: prepare device and make payment
         PrepareDeviceAndPay(amount);
     }
     else
     {
         // Payleven: login user
         Payleven.LoginWithUsername(userName, userPassword, new NSString(ApiKey), (errorHandler) =>
         {
             if (errorHandler == null)
             {
                 // Payleven: login successful
                 PrepareDeviceAndPay(amount);
             }
             else
             {
                 // Payleven: login failed
                 StatusAction.Invoke(PLVPaylevenStatus.PLVPaylevenStatusLoginError);
             }
         });
     }
 }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            // Set payment amount
            YourAmount = "0.0";

            // Begin payment
            var payleven = new Payleven ();
            payleven.Init(PaylevenAction, YourCurrency);
            payleven.LogInAndPay(new NSString (YourLogin), new NSString (YourPassword), YourAmount);
        }
Exemplo n.º 5
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Set payment amount
            YourAmount = "0.0";

            // Begin payment
            var payleven = new Payleven();

            payleven.Init(PaylevenAction, YourCurrency);
            payleven.LogInAndPay(new NSString(YourLogin), new NSString(YourPassword), YourAmount);
        }