コード例 #1
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();
            }
        }
コード例 #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();
        }