2014-12-02 11 views
0

프런트 엔드 클라이언트로부터 지불을 생성하려고 시도하는 백엔드 웹 서비스 (웹 페이지 아님)가 있습니다. 어디서 잘못되었는지 설명하는 sandpit에서 적절한 오류 메시지가 나오는 세부 정보와 트랜잭션 목록간에 데이터가 일치하지 않는 곳이 몇 번 있었는데 결국 예외를 throw하지 않고 실행할 수있는 payment.create 메서드가 생겼습니다. 불행히도, 테스트 웹 서비스와 페이팔 사이에 SSL 트래픽의 존재를 볼 수는 있지만, 루틴이 돌아 오면 링크가없고 생성 된 상태가 없습니다. 나는 API의 메카니즘을 완전히 오해했을지도 모르지만, 호출로부터 어떤 에러 나 예외가 없으면, 나는 약간 혼란 스럽다. 나는 주시면 감사하겠습니다 실종 무엇인지에REST API payment.create not payment making

var config = ConfigManager.Instance.GetProperties(); 
    var clientid = config[BaseConstants.ClientId]; 
    var clientSecret = config[BaseConstants.ClientSecret]; 
    var accessToken = new OAuthTokenCredential(clientid, clientSecret, config).GetAccessToken(); 
    var apiContext = new APIContext(accessToken); 
    var itemList = new ItemList() { items = new List<Item>() }; 
    using (var context = new PETTEntities3()) 
    { 
     SubscriptionType subType = context.SubscriptionTypes.FirstOrDefault(s => s.SubscriptionTypeID == Subscription.SubscriptionTypeID); 
     itemList.items.Add(new Item() 
     { 
     name = subType.SubscriptionName, 
     currency = "NZD", 
     price = (Subscription.Amount/(decimal)1.15).ToString("0.00"), 
     quantity = "1", 
     sku = subType.SubscriptionTypeID.ToString() 
     }); 
     var payer = new Payer() { payment_method = "paypal" }; 
     var redirectUrls = new RedirectUrls() 
     { 
     cancel_url = ConfigurationManager.AppSettings["PaymentConfirmationURL"] + Subscription.PaymentApprovalID, 
      return_url = ConfigurationManager.AppSettings["PaymentCancellationURL"] + Subscription.PaymentApprovalID 
     }; 
     var details = new Details() 
     { 
     tax = (Subscription.Amount - decimal.Parse((Subscription.Amount/(decimal)1.15).ToString("0.00"))).ToString("0.00"), 
     subtotal = (Subscription.Amount/(decimal)1.15).ToString("0.00"), 
     shipping="0" 
     }; 
     var amount = new Amount() 
     { 
      currency = "NZD", 
      total = Subscription.Amount.ToString("0.00"), 
      details = details    
     }; 
     var transactionList = new List<Transaction>(); 
     transactionList.Add(new Transaction() 
     { 
      description = "PETT Subscription.", 
      invoice_number = "PETT1420" + Subscription.SubscriptionID.ToString(), 
      amount = amount, 
      item_list = itemList 
     }); 
     Payment payment = new Payment() 
     { 
      intent = "sale", 
      payer = payer, 
      transactions = transactionList, 
      redirect_urls = redirectUrls 
     }; 
     payment.Create(apiContext); 
.... At this point the payment state is still null and no links are present even though I appear to have a successful call with no exceptions. 

모든 단서 또는 통찰력 : 여기

내가 사용하고있는 코드입니다.

답변

0

도박은 분명합니다. 함수 서명 payment.create에주의를 기울이지 않고 새로운 지불을 반환합니다. 예 :

지불 paymentToUse = payment.Create (apiContext);

결제에는 모든 상품이 있습니다.