コード例 #1
0
ファイル: Order.java プロジェクト: tsw424/PayPal-Java-SDK
  /**
   * Creates (and processes) a new Capture Transaction added as a related resource.
   *
   * @param apiContext {@link APIContext} used for the API call.
   * @param capture Capture
   * @return Capture
   * @throws PayPalRESTException
   */
  public Capture capture(APIContext apiContext, Capture capture) throws PayPalRESTException {

    if (this.getId() == null) {
      throw new IllegalArgumentException("Id cannot be null");
    }
    if (capture == null) {
      throw new IllegalArgumentException("capture cannot be null");
    }
    Object[] parameters = new Object[] {this.getId()};
    String pattern = "v1/payments/orders/{0}/capture";
    String resourcePath = RESTUtil.formatURIPath(pattern, parameters);
    String payLoad = capture.toJSON();
    return configureAndExecute(apiContext, HttpMethod.POST, resourcePath, payLoad, Capture.class);
  }