Laden...

Forenbeiträge von Curious Ingesamt 4 Beiträge

27.09.2021 - 10:12 Uhr

Hi Campy,

erstmal vielen Dank für den link bzw. den Hinweis:
Der link wäre Checkout-NET-SDK/PayPalCheckoutSdk at develop · paypal/Checkout-NET-SDK

Ja, damit habe ich auch "herumprobiert". Mein vorheriger Post bezog sich auf dieses SDK (OrdersGetRequest).

Ansonsten fehlt hier (oder ich sehe es nicht) die Chance einen Kontoauszug für einen Zeitraum zu bekommen.
Etwas wie dieses hier (ist soap, und damit wie von "Abt" richtig bemerkt alte Technik) ...

Es gab eine schöne Beschreibung an dieser Stelle: https://code-bude.net/2018/02/21/paypal-kontostand-und-umsaetze-per-csharp-api-abfragen

Sowas für soap, das wäre Pima! 🙂

23.08.2021 - 16:43 Uhr

so ... war leider etwas aufgehalten worden. Kann sein das ich einiges übersehen habe, sowas passiert im Alter.

Passend dazu, ich bekomme das auch mit den rest-apis nicht auf die Reihe. Auch wenn ich partiell blind bin, die Doku ist übel, dabei bleibts.
Hat jemand Rat bzw. ein funktionierendes Beispiel?

Im Moment sieht das so (falsch) aus.

Wenn ich zum Beispiel sowas absetze:



    public static async Task<HttpResponse> GetOrder(string orderId, bool debug = false)
    {
      OrdersGetRequest request = new OrdersGetRequest(orderId);

      var response = await PayPalClient.client().Execute(request);
      var result = response.Result<PayPalCheckoutSdk.Orders.Order>();

 

und der Client (laut Doku) so aussieht:


    public static HttpClient client()
    {
      return new PayPalHttpClient(environment()); // environment enthält client id und secret ...
    }
    public static HttpClient client(string refreshToken)
    {
      return new PayPalHttpClient(environment(), refreshToken);
    }


Kann ich machen was ich will, ich bekomme eine Exeption:

"{&quot;name&quot;:&quot;RESOURCE_NOT_FOUND&quot;,&quot;details&quot;:[{&quot;issue&quot;:&quot;INVALID_RESOURCE_ID&quot;,&quot;description&quot;:&quot;Specified resource ID does not exist. Please check the resource ID and try again.&quot;}],&quot;message&quot;:&quot;The specified resource does not exist.&quot;,&quot;debug_id&quot;:&quot;4ee60654c605d&quot;,&quot;links&quot;:[{&quot;href&quot;:&quot;https://developer.paypal.com/docs/api/orders/v2/#error-INVALID_RESOURCE_ID&quot;,&quot;rel&quot;:&quot;information_link&quot;,&quot;method&quot;:&quot;GET&quot;}]}"

Wobei die ID in meinem Fall die echte (interne) Order ID des Shopssystems ist. OK das könnte falsch sein. Aber auch die Variante der nativen Paypal ID wirft eine exception

Wobei das uralte SDK- funktioniert und Werte zurück gibt.


      foreach (var o in listOfOrdersBasic)
      {
        var payment = Payment.Get(PayPalConfiguration.GetAPIContext(), o.payment_id);


        decimal convertDecimal = 0;
        foreach (var transaction in payment.transactions)
        {
          if (transaction.invoice_number != null)
          {
          }

          if (transaction.item_list != null)
            foreach (var item in transaction.item_list.items)
            {
// enthält valide Werte
            }


          foreach (var relatedResource in transaction.related_resources)
          {
            if (relatedResource.sale != null)
            {
              var feeData = relatedResource.sale.transaction_fee;
              convertDecimal += Decimal.Parse(feeData.value, NumberStyles.AllowDecimalPoint, CultureInfo.InvariantCulture);
            }
          }
        }

04.08.2021 - 17:55 Uhr

Ich wäre an einem funktionierendem Beispiel äußerst interessiert. Ich muss den Kontostand bzw. den Kontoauszug in System holen, damit die App die Bank buchen kann. Eine Meute Buchhalte ist hinter mir her.
Ich habe mich totgesucht. In jedem Fall wäre die Verwendung der letzten Technik besser. Soweit ich das gesehen habe stand auf der Paypal Seite zunächst nicht von "veraltet" (im Gegensatz zu den meisten nuget-Packages zu diesem Thema).

Ansonsten:
Die inner-Exeptions sagt: StackTrace = " at System.Net.HttpWebRequest.GetResponse()\r\n at System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)"

ich habe die app.config mal angepasst. Geht aber auch nicht.


    <bindings>
      <basicHttpBinding>
        <binding name="PayPalAPISoapBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="02:00:00" sendTimeout="02:00:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="Transport" />
        </binding>
        <binding name="PayPalAPIAASoapBinding" closeTimeout="01:00:00" openTimeout="01:00:00" receiveTimeout="02:00:00" sendTimeout="02:00:00" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="Transport" />
        </binding>
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://api.sandbox.paypal.com/2.0/" binding="basicHttpBinding"
                bindingConfiguration="PayPalAPISoapBinding" contract="ServicePaypal.PayPalAPIInterface"
                name="PayPalAPI" />
      <endpoint address="https://api-aa.sandbox.paypal.com/2.0/" binding="basicHttpBinding"
                bindingConfiguration="PayPalAPIAASoapBinding" contract="ServicePaypal.PayPalAPIAAInterface"
                name="PayPalAPIAA" />
    </client>
04.08.2021 - 15:32 Uhr

Hallo *all

ich würde gerne Paypal via soap/wsdl Endpunkt ansteuern. Es gibt aber immer die Meldung "Die zugrunde liegende Verbindung wurde geschlossen: Die Verbindung wurde unerwartet getrennt.." zurück.

Weiß jemand Rat? Das wäre super.

Ich bin mit Win10 und VS2019 unterwegs.
Die Service Referenz ist : https://www.paypal.com/wsdl/PayPalSvc.wsdl

Der Code sieht so aus:



        var paypalService = new ServicePaypal.PayPalAPIInterfaceClient();
        var securityHeader = new ServicePaypal.CustomSecurityHeaderType();
        var credentials = new ServicePaypal.UserIdPasswordType();
        credentials.Username = PayPalConfiguration. User;
        credentials.Password = PayPalConfiguration.Pass;
        credentials.Signature = PayPalConfiguration.Signature;
        securityHeader.Credentials = credentials;

        //Create transaction request
        var payloadReq = new ServicePaypal.TransactionSearchReq()
        {
          TransactionSearchRequest = new ServicePaypal.TransactionSearchRequestType()
        };
         
        payloadReq.TransactionSearchRequest.StartDate = DateTime.Now.AddDays(-15);
        payloadReq.TransactionSearchRequest.Version = "216.0";
        var transactionList = paypalService.TransactionSearch(ref securityHeader, payloadReq);

Die app-config habe ich zunächst unverändert gelassen:


 <bindings>
      <basicHttpBinding>
        <binding name="PayPalAPISoapBinding">
          <security mode="Transport" />
        </binding>
        <binding name="PayPalAPIAASoapBinding">
          <security mode="Transport" />
        </binding>
        <binding name="PayPalAPISoapBinding1" />
        <binding name="PayPalAPIAASoapBinding1" />
      </basicHttpBinding>
    </bindings>
    <client>
      <endpoint address="https://api.sandbox.paypal.com/2.0/" binding="basicHttpBinding"
        bindingConfiguration="PayPalAPISoapBinding" contract="ServicePaypal.PayPalAPIInterface"
        name="PayPalAPI" />
      <endpoint address="https://api-aa.sandbox.paypal.com/2.0/" binding="basicHttpBinding"
        bindingConfiguration="PayPalAPIAASoapBinding" contract="ServicePaypal.PayPalAPIAAInterface"
        name="PayPalAPIAA" />
    </client>