Пример #1
0
        internal PayPalTransactionResponse(PayPalAccount usedAccount, NameValuePairs response)
        {
            RawResponse = response.ToString();
            UsedAccount = usedAccount;
            Note        = string.Empty;

            string refNo;

            response.TryGetValue("responseEnvelope.correlationId", out refNo);
            ReferenceNumber = refNo;

            string success = "";
            bool   isAck   = response.TryGetValue("paymentExecStatus", out success);

            IsSuccess = isAck && String.Equals(success, "COMPLETED", StringComparison.OrdinalIgnoreCase);

            if (!IsSuccess)
            {
                string errorCode, message;

                if (!response.TryGetValue("error.errorId", out errorCode))
                {
                    response.TryGetValue("error(0).errorId", out errorCode);

                    if (!response.TryGetValue("error(0).errorId", out errorCode))
                    {
                        response.TryGetValue("L_ERRORCODE0", out errorCode);
                    }
                }

                if (!response.TryGetValue("error.message", out message))
                {
                    response.TryGetValue("error(0).message", out message);

                    if (!response.TryGetValue("error(0).message", out message))
                    {
                        response.TryGetValue("L_LONGMESSAGE0", out message);
                    }
                }

                Note = errorCode + ": " + message;
            }
            else
            {
                Note = Resources.U4000.MONEYSENT.Replace("%p%", "PayPal");
            }
        }
Пример #2
0
        internal PayPalTransactionResponse(PayPalAccount usedAccount, PayoutBatch response)
        {
            RawResponse     = response.ToString();
            UsedAccount     = usedAccount;
            Note            = string.Empty;
            ReferenceNumber = response.batch_header.payout_batch_id;

            bool IsFail = response.batch_header.batch_status == "DENIED" ||
                          response.batch_header.batch_status == "CANCELED";

            IsSuccess = !IsFail;

            if (IsFail)
            {
                Note = response.batch_header.batch_status;
            }
            else
            {
                Note = Resources.U4000.MONEYSENT.Replace("%p%", "PayPal");
            }
        }
Пример #3
0
        internal PayPalTransactionResponseForMassPay(PayPalAccount usedAccount, NameValuePairs response)
        {
            RawResponse = response.ToString();
            UsedAccount = usedAccount;
            Note        = string.Empty;

            string refNo;

            response.TryGetValue("CORRELATIONID", out refNo);
            ReferenceNumber = refNo;

            string success = "";
            bool   isAck   = response.TryGetValue("ACK", out success);

            IsSuccess = isAck && String.Equals(success, "Success", StringComparison.OrdinalIgnoreCase);

            if (!IsSuccess)
            {
                string severity, errorCode, message;

                if ((!response.TryGetValue("error.severity", out severity)) || !response.TryGetValue("error(0).severity", out severity))
                {
                    response.TryGetValue("L_SHORTMESSAGE0", out severity);
                }
                if ((!response.TryGetValue("error.errorId", out errorCode)) || !response.TryGetValue("error(0).errorId", out errorCode))
                {
                    response.TryGetValue("L_ERRORCODE0", out errorCode);
                }
                if ((!response.TryGetValue("error.message", out message)) || !response.TryGetValue("error(0).message", out message))
                {
                    response.TryGetValue("L_LONGMESSAGE0", out message);
                }

                Note = severity + " " + errorCode + ": " + message;
            }
            else
            {
                Note = Resources.U4000.MONEYSENT.Replace("%p%", "PayPal");
            }
        }