Ejemplo n.º 1
0
        /// <summary>
        /// Handles the offsite notification send by them via async call.
        /// </summary>
        /// <param name="orderNumber">The order number.</param>
        /// <param name="request">The HTTP request object .</param>
        /// <param name="paymentMethod">The payment method which is used.</param>
        /// <returns></returns>
        public IPaymentResponse HandleOffsiteNotification(int orderNumber, HttpRequest request, PaymentMethod paymentMethod)
        {
            IPaymentResponse response = new PaymentResponse()
            {
                IsOffsitePayment = true
            };

            //Extract the BitPay settings object
            this.bitPaySettings = (BitPaySettings)PaymentProcessorHelper.DeserializePaymentSettings <BitPaySettings>(paymentMethod);

            BitPayServerResponse bitpayServerResponce = GetBitPayServiceResponce(request);

            bool isNotificationValid = CheckIfNotificationIsValid(orderNumber, bitpayServerResponce);

            if (!isNotificationValid)
            {
                response.GatewayFraudResponse = "BitPay Payment response not valid for this order.";
                return(response);
            }

            var paymentStatus = bitpayServerResponce.Status;

            if (!paymentStatus.IsNullOrEmpty())
            {
                //check for successful
                if (paymentStatus == TheBitPayStatusConfirmed || paymentStatus == TheBitPayStatusComplete)
                {
                    response.IsSuccess = true;
                }
            }

            return(response);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Generic Submit Transaction method which will called by the processor. All other transactions that can happen with the provider have to be called from this method.
        /// </summary>
        /// <param name="data">An instance of type <see cref="IPaymentRequest" /></param>
        /// <returns>An instance of type <see cref="IPaymentResponse" /></returns>
        public IPaymentResponse SubmitTransaction(IPaymentRequest data)
        {
            this.bitPaySettings = base.GetDeserializedSettings <BitPaySettings>(data.PaymentProcessorSettings);

            return(Sale(data));
        }