24 lines
913 B
Java
24 lines
913 B
Java
package com.paypal;
|
|
|
|
import com.paypal.AuthorizeIntentExamples.CreateOrder;
|
|
import com.paypal.http.HttpRequest;
|
|
import com.paypal.http.HttpResponse;
|
|
import com.paypal.http.serializer.Json;
|
|
import com.paypal.orders.Order;
|
|
import com.paypal.orders.OrdersGetRequest;
|
|
import java.io.IOException;
|
|
import org.json.JSONObject;
|
|
|
|
public class GetOrder extends PayPalClient {
|
|
public void getOrder(String orderId) throws IOException {
|
|
OrdersGetRequest request = new OrdersGetRequest(orderId);
|
|
HttpResponse<Order> response = client().execute((HttpRequest)request);
|
|
System.out.println("Full response body:");
|
|
System.out.println(new JSONObject(new Json().serialize(response.result())).toString(4));
|
|
}
|
|
|
|
public static void main(String[] args) throws IOException {
|
|
HttpResponse<Order> response = new CreateOrder().createOrder(false);
|
|
new GetOrder().getOrder(((Order)response.result()).id());
|
|
}
|
|
}
|