/// <remarks/>
 public System.IAsyncResult BeginDoReferenceTransaction(DoReferenceTransactionReq DoReferenceTransactionReq, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("DoReferenceTransaction", new object[] {
                 DoReferenceTransactionReq}, callback, asyncState);
 }
Beispiel #2
0
    /// <summary>
    /// Run a new transaction off of a previously retrieved transaction Id
    /// </summary>
    /// <param name="b"></param>
    /// <param name="transactionId">Reference transaction id</param>
    /// <param name="TransactionId">Transaction ID of the order that was just processed.</param>
    /// <returns></returns>
    public static bool DoReferenceTransaction(BillUserParams b, string transactionId, out string TransactionId, out string ErrorMessages)
    {
        PayPalServices.UserIdPasswordType user = new PayPalServices.UserIdPasswordType();
        user.Username = APIUsername;
        user.Password = APIPassword;
        user.Signature = APISignature;

        PayPalServices.PayPalAPIAASoapBinding PPInterface = new PayPalServices.PayPalAPIAASoapBinding();
        PPInterface.RequesterCredentials = new PayPalServices.CustomSecurityHeaderType();
        PPInterface.RequesterCredentials.Credentials = user;
        PPInterface.RequestEncoding = System.Text.Encoding.UTF8;
        PPInterface.Url = APIUrl;

        PayPalServices.DoReferenceTransactionReq trans = new PayPalServices.DoReferenceTransactionReq();
        trans.DoReferenceTransactionRequest = new PayPalServices.DoReferenceTransactionRequestType();
        trans.DoReferenceTransactionRequest.Version = APIVersion;
        trans.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails = new PayPalServices.DoReferenceTransactionRequestDetailsType();
        trans.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.ReferenceID = transactionId;
        trans.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentAction = PayPalServices.PaymentActionCodeType.Sale;

        PayPalServices.BasicAmountType subAmount = new PayPalServices.BasicAmountType();
        subAmount.currencyID = b.CurrencyType;
        subAmount.Value = b.RecurringBillingAmount.ToString("0.00");

        PayPalServices.PaymentDetailsType paymentDetails = new PayPalServices.PaymentDetailsType();
        paymentDetails.InvoiceID = b.InvoiceId;
        paymentDetails.ItemTotal = subAmount;
        paymentDetails.OrderDescription = b.SubscriptionDescription;
        paymentDetails.OrderTotal = subAmount;
        trans.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.PaymentDetails = paymentDetails;

        trans.DoReferenceTransactionRequest.DoReferenceTransactionRequestDetails.IPAddress = b.IPAddress;

        PayPalServices.DoReferenceTransactionResponseType response = PPInterface.DoReferenceTransaction(trans);

        if (response.Ack == PayPalServices.AckCodeType.Success)
        {
            TransactionId = response.DoReferenceTransactionResponseDetails.TransactionID;
            ErrorMessages = string.Empty;
            return true;
        }

        string errorsMessages = "Status: " + response.Ack.ToString() + " <br/>";
        foreach (PayPalServices.ErrorType error in response.Errors)
        {
            errorsMessages += error.ErrorCode + " - " + error.LongMessage + " " + error.ShortMessage + "<br/>";
        }
        ErrorMessages = errorsMessages;
        TransactionId = string.Empty;
        return false;
    }