當前位置: 首頁>>代碼示例>>C#>>正文


C# PayPalAPIInterfaceServiceService.TransactionSearch方法代碼示例

本文整理匯總了C#中PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService.TransactionSearch方法的典型用法代碼示例。如果您正苦於以下問題:C# PayPalAPIInterfaceServiceService.TransactionSearch方法的具體用法?C# PayPalAPIInterfaceServiceService.TransactionSearch怎麽用?C# PayPalAPIInterfaceServiceService.TransactionSearch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService的用法示例。


在下文中一共展示了PayPalAPIInterfaceServiceService.TransactionSearch方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: Search_Submit

        protected void Search_Submit(object sender, EventArgs e)
        {
            // Create request object
            TransactionSearchRequestType request = new TransactionSearchRequestType();
            if (transactionID.Value != "")
            {
                request.TransactionID = transactionID.Value;
            }
            if (startDate != null && startDate.Text != null)
            {
                request.StartDate = startDate.Text;
            }
            if (endDate != null && endDate.Text != null)
            {
                request.EndDate = endDate.Text;
            }
            if (payer.Value != "")
            {
                request.Payer = payer.Value;
            }
            if (receiver.Value != "")
            {
                request.Receiver = receiver.Value;
            }
            if (receiptId.Value != "")
            {
                request.ReceiptID = receiptId.Value;
            }
            if (profileId.Value != "")
            {
                request.ProfileID = profileId.Value;
            }
            if (auctionItemNumber.Value != "")
            {
                request.AuctionItemNumber = auctionItemNumber.Value;
            }
            if (invoiceID.Value != "")
            {
                request.InvoiceID = invoiceID.Value;
            }
            if (cardNumber.Value != "")
            {
                request.CardNumber = cardNumber.Value;
            }
            if (transactionClass.SelectedIndex != 0)
            {
                request.TransactionClass = (PaymentTransactionClassCodeType)
                    Enum.Parse(typeof(PaymentTransactionClassCodeType), transactionClass.SelectedValue);
            }
            if (amount.Value != "" && currencyCode.SelectedIndex != 0)
            {
                request.CurrencyCode = (CurrencyCodeType)
                    Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue);
                BasicAmountType searchAmount = new BasicAmountType(request.CurrencyCode, amount.Value);
                request.Amount = searchAmount;

            }
            if (transactionStatus.SelectedIndex != 0)
            {
                request.Status = (PaymentTransactionStatusCodeType)
                    Enum.Parse(typeof(PaymentTransactionStatusCodeType), transactionStatus.SelectedValue);
            }

            // Invoke the API
            TransactionSearchReq wrapper = new TransactionSearchReq();
            wrapper.TransactionSearchRequest = request;
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
            TransactionSearchResponseType transactionDetails = service.TransactionSearch(wrapper);

            // Check for API return status
            processResponse(service, transactionDetails);
        }
開發者ID:robglas,項目名稱:merchant-sdk-dotnet,代碼行數:72,代碼來源:TransactionSearch.aspx.cs

示例2: TransactionSearchAPIOperation

    // # TransactionSearch API Operation
    // The TransactionSearch API searches transaction history for transactions that meet the specified criteria
    public TransactionSearchResponseType TransactionSearchAPIOperation()
    {
        // Create the TransactionSearchResponseType object
        TransactionSearchResponseType responseTransactionSearchResponseType = new TransactionSearchResponseType();

        try
        {
            // # Create the TransactionSearchReq object
            TransactionSearchReq requestTransactionSearch = new TransactionSearchReq();

            // `TransactionSearchRequestType` which takes mandatory argument:
            // 
            // * `Start Date` - The earliest transaction date at which to start the
            // search.
            TransactionSearchRequestType transactionSearchRequest = new TransactionSearchRequestType("2012-12-25T00:00:00+0530");
            requestTransactionSearch.TransactionSearchRequest = transactionSearchRequest;

            // Create the service wrapper object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();

            // # API call
            // Invoke the TransactionSearch method in service wrapper object
            responseTransactionSearchResponseType = service.TransactionSearch(requestTransactionSearch);

            if (responseTransactionSearchResponseType != null)
            {
                // Response envelope acknowledgement
                string acknowledgement = "TransactionSearch API Operation - ";
                acknowledgement += responseTransactionSearchResponseType.Ack.ToString();
                logger.Info(acknowledgement + "\n");
                Console.WriteLine(acknowledgement + "\n");

                // # Success values
                if (responseTransactionSearchResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
                {
                    // Search Results
                    IEnumerator<PaymentTransactionSearchResultType> iterator = responseTransactionSearchResponseType.PaymentTransactions.GetEnumerator();

                    while (iterator.MoveNext())
                    {
                        PaymentTransactionSearchResultType searchResult = iterator.Current;

                        // Merchant's transaction ID.
                        logger.Info("Transaction ID : " + searchResult.TransactionID + "\n");
                        Console.WriteLine("Transaction ID : " + searchResult.TransactionID + "\n");
                    }
                }
                // # Error Values
                else
                {
                    List<ErrorType> errorMessages = responseTransactionSearchResponseType.Errors;
                    foreach (ErrorType error in errorMessages)
                    {
                        logger.Debug("API Error Message : " + error.LongMessage);
                        Console.WriteLine("API Error Message : " + error.LongMessage + "\n");
                    }
                }
            }
        }
        // # Exception log    
        catch (System.Exception ex)
        {
            // Log the exception message       
            logger.Debug("Error Message : " + ex.Message);
            Console.WriteLine("Error Message : " + ex.Message);
        }
        return responseTransactionSearchResponseType;
    }
開發者ID:hitesh97,項目名稱:codesamples-dotnet,代碼行數:70,代碼來源:TransactionSearchSample.cs

示例3: TransSearch

 private void TransSearch(HttpContext context)
 {
     TransactionSearchReq req = new TransactionSearchReq();
     TransactionSearchRequestType reqType = new TransactionSearchRequestType();
     reqType.Version = "78.0";
     reqType.StartDate = context.Request.Params["startDate"] + "T00:00:00.000Z";
     reqType.TransactionID = context.Request.Params["transID"];;
     req.TransactionSearchRequest = reqType;
     try
     {
         PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();
         TransactionSearchResponseType resp = service.TransactionSearch(req);
         context.Response.Write("<html><body><textarea rows=30 cols=80>");
         ObjectDumper.Write(resp, 5, context.Response.Output);
         context.Response.Write("</textarea></body></html>");
     }
     catch (System.Exception e)
     {
         context.Response.Write(e.Message);
     }
 }
開發者ID:bpossolo,項目名稱:SDKs,代碼行數:21,代碼來源:merchanthandler.ashx.cs

示例4: Search_Submit

        protected void Search_Submit(object sender, EventArgs e)
        {
            // Create request object
            TransactionSearchRequestType request = new TransactionSearchRequestType();
            if (transactionID.Value != string.Empty)
            {
                request.TransactionID = transactionID.Value;
            }
            // (Required) The earliest transaction date at which to start the search.
            if (startDate != null && startDate.Text != null)
            {
                request.StartDate = startDate.Text;
            }
            // (Optional) The latest transaction date to be included in the search.
            if (endDate != null && endDate.Text != null)
            {
                request.EndDate = endDate.Text;
            }
            // (Optional) Search by the buyer's email address.
            if (payer.Value != string.Empty)
            {
                request.Payer = payer.Value;
            }
            // (Optional) Search by the receiver's email address. If the merchant account has only one email address, this is the primary email. It can also be a non-primary email address.
            if (receiver.Value != string.Empty)
            {
                request.Receiver = receiver.Value;
            }
            // (Optional) Search by the PayPal Account Optional receipt ID. This field is not applicable to point-of-sale transactions.
            if (receiptId.Value != string.Empty)
            {
                request.ReceiptID = receiptId.Value;
            }
            // (Optional) An alphanumeric string (generated by PayPal) that uniquely identifies a recurring profile. You can specify the Profile ID in the TransactionSearch API operation to obtain all payments associated with the identified profile.
            if (profileId.Value != string.Empty)
            {
                request.ProfileID = profileId.Value;
            }
            // (Optional) Search by auction item number of the purchased goods. This field is not applicable to point-of-sale.
            if (auctionItemNumber.Value != string.Empty)
            {
                request.AuctionItemNumber = auctionItemNumber.Value;
            }
            // (Optional) Search by invoice identification key, as set by you for the original transaction. This field searches the records for items the merchant sells.
            if (invoiceID.Value != string.Empty)
            {
                request.InvoiceID = invoiceID.Value;
            }
            // (Optional) Search by credit card number, as set by you for the original transaction. This field searches the records for items the merchant sells. The field is not applicable to point-of-sale.
            // Note: No wildcards are allowed.
            if (cardNumber.Value != string.Empty)
            {
                request.CardNumber = cardNumber.Value;
            }
            // (Optional) Search by classification of transaction. Some kinds of possible classes of transactions are not searchable with this field. You cannot search for bank transfer withdrawals, for example. It is one of the following values:
            // * All – All transaction classifications
            // * Sent – Only payments sent
            // * Received – Only payments received
            // * MassPay – Only mass payments
            // * MoneyRequest – Only money requests
            // * FundsAdded – Only funds added to balance
            // * FundsWithdrawn – Only funds withdrawn from balance
            // * Referral – Only transactions involving referrals
            // * Fee – Only transactions involving fees
            // * Subscription – Only transactions involving subscriptions
            // * Dividend – Only transactions involving dividends
            // * Billpay – Only transactions involving BillPay Transactions
            // * Refund – Only transactions involving funds
            // * CurrencyConversions – Only transactions involving currency conversions
            // * BalanceTransfer – Only transactions involving balance transfers
            // * Reversal – Only transactions involving BillPay reversals
            // * Shipping – Only transactions involving UPS shipping fees
            // * BalanceAffecting – Only transactions that affect the account balance
            // * ECheck – Only transactions involving eCheck
            if (transactionClass.SelectedIndex != 0)
            {
                request.TransactionClass = (PaymentTransactionClassCodeType)
                    Enum.Parse(typeof(PaymentTransactionClassCodeType), transactionClass.SelectedValue);
            }
            // (Optional) Search by transaction amount.
            // Note: You must set the currencyID attribute to one of the 3-character currency codes for any of the supported PayPal currencies.
            if (amount.Value != string.Empty && currencyCode.SelectedIndex != 0)
            {
                request.CurrencyCode = (CurrencyCodeType)
                    Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue);
                BasicAmountType searchAmount = new BasicAmountType(request.CurrencyCode, amount.Value);
                request.Amount = searchAmount;

            }
            // (Optional) Search by transaction status. It is one of the following values:
            // * Pending – The payment is pending. The specific reason the payment is pending is returned by the GetTransactionDetails API PendingReason field.
            // * Processing – The payment is being processed.
            // * Success – The payment has been completed and the funds have been added successfully to your account balance.
            // * Denied – You denied the payment. This happens only if the payment was previously pending.
            // * Reversed – A payment was reversed due to a chargeback or other type of reversal. The funds have been removed from your account balance and returned to the buyer.
            if (transactionStatus.SelectedIndex != 0)
            {
                request.Status = (PaymentTransactionStatusCodeType)
                    Enum.Parse(typeof(PaymentTransactionStatusCodeType), transactionStatus.SelectedValue);
            }
//.........這裏部分代碼省略.........
開發者ID:RKPal1982,項目名稱:merchant-sdk-dotnet,代碼行數:101,代碼來源:TransactionSearch.aspx.cs


注:本文中的PayPal.PayPalAPIInterfaceService.PayPalAPIInterfaceServiceService.TransactionSearch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。