content: /*
   * 支付宝开放平台API
   * 支付宝开放平台v3协议文档
   *
   * The version of the OpenAPI document: 2025-08-26
   * 
   *
   * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
   * https://openapi-generator.tech
   * Do not edit the class manually.
   */
  
  
  package com.alipay.v3.api;
  
  import com.alipay.v3.ApiCallback;
  import com.alipay.v3.ApiClient;
  import com.alipay.v3.ApiException;
  import com.alipay.v3.ApiResponse;
  import com.alipay.v3.Configuration;
  import com.alipay.v3.Pair;
  import com.alipay.v3.ProgressRequestBody;
  import com.alipay.v3.ProgressResponseBody;
  import com.alipay.v3.util.AlipayLogger;
  import com.alipay.v3.util.model.CustomizedParams;
  
  import com.google.common.base.Strings;
  import com.google.gson.reflect.TypeToken;
  
  import java.io.IOException;
  
  
  import com.alipay.v3.model.AlipayUserAgreementMigrateDefaultResponse;
  import com.alipay.v3.model.AlipayUserAgreementMigrateModel;
  import com.alipay.v3.model.AlipayUserAgreementQueryDefaultResponse;
  import com.alipay.v3.model.AlipayUserAgreementQueryResponseModel;
  import com.alipay.v3.model.AlipayUserAgreementTransferDefaultResponse;
  import com.alipay.v3.model.AlipayUserAgreementTransferModel;
  import com.alipay.v3.model.AlipayUserAgreementTransferResponseModel;
  import com.alipay.v3.model.AlipayUserAgreementUnsignDefaultResponse;
  import com.alipay.v3.model.AlipayUserAgreementUnsignModel;
  
  import java.lang.reflect.Type;
  import java.util.ArrayList;
  import java.util.HashMap;
  import java.util.List;
  import java.util.Map;
  import javax.ws.rs.core.GenericType;
  
  public class AlipayUserAgreementApi {
      private ApiClient localVarApiClient;
      private int localHostIndex;
      private String localCustomBaseUrl;
  
      public AlipayUserAgreementApi() {
          this(Configuration.getDefaultApiClient());
      }
  
      public AlipayUserAgreementApi(ApiClient apiClient) {
          this.localVarApiClient = apiClient;
      }
  
      public ApiClient getApiClient() {
          return localVarApiClient;
      }
  
      public void setApiClient(ApiClient apiClient) {
          this.localVarApiClient = apiClient;
      }
  
      public int getHostIndex() {
          return localHostIndex;
      }
  
      public void setHostIndex(int hostIndex) {
          this.localHostIndex = hostIndex;
      }
  
      public String getCustomBaseUrl() {
          return localCustomBaseUrl;
      }
  
      public void setCustomBaseUrl(String customBaseUrl) {
          this.localCustomBaseUrl = customBaseUrl;
      }
  
      /**
       * Build call for migrate
       * @param alipayUserAgreementMigrateModel  (optional)
       * @param _callback Callback for upload/download progress
       * @param customizedParams
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public okhttp3.Call migrateCall(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          String basePath = null;
          // Operation Servers
          String[] localBasePaths = new String[] {  };
  
          // Determine Base Path to Use
          if (localCustomBaseUrl != null){
              basePath = localCustomBaseUrl;
          } else if ( localBasePaths.length > 0 ) {
              basePath = localBasePaths[localHostIndex];
          } else {
              basePath = null;
          }
  
          Object localVarPostBody = (customizedParams != null && !Strings.isNullOrEmpty(customizedParams.getBodyContent()))
                  ? customizedParams.getBodyContent() : alipayUserAgreementMigrateModel;
  
          // create path and map variables
          String localVarPath = "/v3/alipay/user/agreement/migrate";
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
          Map<String, String> localVarCookieParams = new HashMap<String, String>();
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) {
              localVarHeaderParams.put("Accept", localVarAccept);
          }
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
          if (localVarContentType != null) {
              localVarHeaderParams.put("Content-Type", localVarContentType);
          }
  
          if (customizedParams != null) {
              //额外query参数
              if (customizedParams.getQueryParams() != null && customizedParams.getQueryParams().size() > 0) {
                  for (Map.Entry<String, String> entry : customizedParams.getQueryParams().entrySet()) {
                      localVarQueryParams.addAll(localVarApiClient.parameterToPair(entry.getKey(), entry.getValue()));
                  }
              }
  
              if (!Strings.isNullOrEmpty(customizedParams.getAppAuthToken())) {
                  localVarHeaderParams.put("alipay-app-auth-token", customizedParams.getAppAuthToken());
              }
  
              //额外非全局header参数
              if (customizedParams.getHeaderParams() != null && customizedParams.getHeaderParams().size() > 0) {
                  localVarHeaderParams.putAll(customizedParams.getHeaderParams());
              }
          }
  
          String[] localVarAuthNames = new String[] {  };
          return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
      }
  
      @SuppressWarnings("rawtypes")
      private okhttp3.Call migrateValidateBeforeCall(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          
  
          okhttp3.Call localVarCall = migrateCall(alipayUserAgreementMigrateModel, _callback, customizedParams);
          return localVarCall;
  
      }
  
      /**
       * 代扣协议迁移
       * 由商户调用，将商户与用户签署的代扣协议内容进行迁移，包括协议主体迁移等
       * @param alipayUserAgreementMigrateModel  (optional)
       * @return Object
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public Object migrate(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel) throws ApiException {
          ApiResponse<Object> localVarResp = migrateWithHttpInfo(alipayUserAgreementMigrateModel, null);
          return localVarResp.getData();
      }
  
      public Object migrate(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel, CustomizedParams customizedParams) throws ApiException {
          ApiResponse<Object> localVarResp = migrateWithHttpInfo(alipayUserAgreementMigrateModel, customizedParams);
          return localVarResp.getData();
      }
  
      /**
       * 代扣协议迁移
       * 由商户调用，将商户与用户签署的代扣协议内容进行迁移，包括协议主体迁移等
       * @param alipayUserAgreementMigrateModel  (optional)
       * @return ApiResponse&lt;Object&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public ApiResponse<Object> migrateWithHttpInfo(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel, CustomizedParams customizedParams) throws ApiException {
          okhttp3.Call localVarCall = migrateValidateBeforeCall(alipayUserAgreementMigrateModel, null, customizedParams);
          try {
              Type localVarReturnType = new TypeToken<Object>(){}.getType();
              return localVarApiClient.execute(localVarCall, localVarReturnType);
          } catch (ApiException e) {
              try {
                  e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<AlipayUserAgreementMigrateDefaultResponse>(){}.getType()));
              } catch (Exception ex) {
                  AlipayLogger.logBizWarn(ex);
              }
              throw e;
          }
      }
  
      /**
       * 代扣协议迁移 (asynchronously)
       * 由商户调用，将商户与用户签署的代扣协议内容进行迁移，包括协议主体迁移等
       * @param alipayUserAgreementMigrateModel  (optional)
       * @param _callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       * @deprecated
       */
      @Deprecated
      public okhttp3.Call migrateAsync(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel, final ApiCallback<Object> _callback) throws ApiException {
  
          okhttp3.Call localVarCall = migrateValidateBeforeCall(alipayUserAgreementMigrateModel, _callback, null);
          Type localVarReturnType = new TypeToken<Object>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
  
      @Deprecated
      public okhttp3.Call migrateAsync(AlipayUserAgreementMigrateModel alipayUserAgreementMigrateModel, final ApiCallback<Object> _callback, CustomizedParams customizedParams) throws ApiException {
  
          okhttp3.Call localVarCall = migrateValidateBeforeCall(alipayUserAgreementMigrateModel, _callback, customizedParams);
          Type localVarReturnType = new TypeToken<Object>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
      /**
       * Build call for query
       * @param personalProductCode 协议产品码，商户和支付宝签约时确定，商户可咨询技术支持。 (optional)
       * @param alipayUserId 用户的支付宝账号对应 的支付宝唯一用户号，以 2088 开头的 16 位纯数字 组成。 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayOpenId 用户的支付宝账号对应 的支付宝唯一用户号， 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayLogonId 用户的支付宝登录账号，支持邮箱或手机号码格式。本参数与alipay_open_id 或 alipay_user_id 同时填写，优先按照 alipay_open_id 或 alipay_user_id 处理。 (optional)
       * @param signScene 签约场景码，该值需要与系统/页面签约接口调用时传入的值保持一 致。如：周期扣款场景与调用 alipay.user.agreement.page.sign(支付宝个人协议页面签约接口) 签约时的 sign_scene 相同。  注意：当传入商户签约号 external_agreement_no 时，该值不能为空或默认值 DEFAULT|DEFAULT。  (optional)
       * @param externalAgreementNo 代扣协议中标示用户的唯一签约号(确保在商户系统中 唯一)。 格式规则:支持大写小写字母和数字，最长 32 位。 (optional)
       * @param thirdPartyType 签约第三方主体类型。对于三方协议，表示当前用户和哪一类的第三方主体进行签约。 默认为PARTNER。 (optional)
       * @param agreementNo 支付宝系统中用以唯一标识用户签约记录的编号（用户签约成功后的协议号 ） ，如果传了该参数，其他参数会被忽略 (optional)
       * @param _callback Callback for upload/download progress
       * @param customizedParams
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public okhttp3.Call queryCall(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          String basePath = null;
          // Operation Servers
          String[] localBasePaths = new String[] {  };
  
          // Determine Base Path to Use
          if (localCustomBaseUrl != null){
              basePath = localCustomBaseUrl;
          } else if ( localBasePaths.length > 0 ) {
              basePath = localBasePaths[localHostIndex];
          } else {
              basePath = null;
          }
  
          Object localVarPostBody = null;
  
          // create path and map variables
          String localVarPath = "/v3/alipay/user/agreement/query";
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
          Map<String, String> localVarCookieParams = new HashMap<String, String>();
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          if (personalProductCode != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("personal_product_code", personalProductCode));
          }
  
          if (alipayUserId != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("alipay_user_id", alipayUserId));
          }
  
          if (alipayOpenId != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("alipay_open_id", alipayOpenId));
          }
  
          if (alipayLogonId != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("alipay_logon_id", alipayLogonId));
          }
  
          if (signScene != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("sign_scene", signScene));
          }
  
          if (externalAgreementNo != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("external_agreement_no", externalAgreementNo));
          }
  
          if (thirdPartyType != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("third_party_type", thirdPartyType));
          }
  
          if (agreementNo != null) {
              localVarQueryParams.addAll(localVarApiClient.parameterToPair("agreement_no", agreementNo));
          }
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) {
              localVarHeaderParams.put("Accept", localVarAccept);
          }
  
          final String[] localVarContentTypes = {
              
          };
          final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
          if (localVarContentType != null) {
              localVarHeaderParams.put("Content-Type", localVarContentType);
          }
  
          if (customizedParams != null) {
              //额外query参数
              if (customizedParams.getQueryParams() != null && customizedParams.getQueryParams().size() > 0) {
                  for (Map.Entry<String, String> entry : customizedParams.getQueryParams().entrySet()) {
                      localVarQueryParams.addAll(localVarApiClient.parameterToPair(entry.getKey(), entry.getValue()));
                  }
              }
  
              if (!Strings.isNullOrEmpty(customizedParams.getAppAuthToken())) {
                  localVarHeaderParams.put("alipay-app-auth-token", customizedParams.getAppAuthToken());
              }
  
              //额外非全局header参数
              if (customizedParams.getHeaderParams() != null && customizedParams.getHeaderParams().size() > 0) {
                  localVarHeaderParams.putAll(customizedParams.getHeaderParams());
              }
          }
  
          String[] localVarAuthNames = new String[] {  };
          return localVarApiClient.buildCall(basePath, localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
      }
  
      @SuppressWarnings("rawtypes")
      private okhttp3.Call queryValidateBeforeCall(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          
  
          okhttp3.Call localVarCall = queryCall(personalProductCode, alipayUserId, alipayOpenId, alipayLogonId, signScene, externalAgreementNo, thirdPartyType, agreementNo, _callback, customizedParams);
          return localVarCall;
  
      }
  
      /**
       * 支付宝个人代扣协议查询接口
       * 支付宝个人代扣协议查询接口
       * @param personalProductCode 协议产品码，商户和支付宝签约时确定，商户可咨询技术支持。 (optional)
       * @param alipayUserId 用户的支付宝账号对应 的支付宝唯一用户号，以 2088 开头的 16 位纯数字 组成。 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayOpenId 用户的支付宝账号对应 的支付宝唯一用户号， 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayLogonId 用户的支付宝登录账号，支持邮箱或手机号码格式。本参数与alipay_open_id 或 alipay_user_id 同时填写，优先按照 alipay_open_id 或 alipay_user_id 处理。 (optional)
       * @param signScene 签约场景码，该值需要与系统/页面签约接口调用时传入的值保持一 致。如：周期扣款场景与调用 alipay.user.agreement.page.sign(支付宝个人协议页面签约接口) 签约时的 sign_scene 相同。  注意：当传入商户签约号 external_agreement_no 时，该值不能为空或默认值 DEFAULT|DEFAULT。  (optional)
       * @param externalAgreementNo 代扣协议中标示用户的唯一签约号(确保在商户系统中 唯一)。 格式规则:支持大写小写字母和数字，最长 32 位。 (optional)
       * @param thirdPartyType 签约第三方主体类型。对于三方协议，表示当前用户和哪一类的第三方主体进行签约。 默认为PARTNER。 (optional)
       * @param agreementNo 支付宝系统中用以唯一标识用户签约记录的编号（用户签约成功后的协议号 ） ，如果传了该参数，其他参数会被忽略 (optional)
       * @return AlipayUserAgreementQueryResponseModel
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public AlipayUserAgreementQueryResponseModel query(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo) throws ApiException {
          ApiResponse<AlipayUserAgreementQueryResponseModel> localVarResp = queryWithHttpInfo(personalProductCode, alipayUserId, alipayOpenId, alipayLogonId, signScene, externalAgreementNo, thirdPartyType, agreementNo, null);
          return localVarResp.getData();
      }
  
      public AlipayUserAgreementQueryResponseModel query(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo, CustomizedParams customizedParams) throws ApiException {
          ApiResponse<AlipayUserAgreementQueryResponseModel> localVarResp = queryWithHttpInfo(personalProductCode, alipayUserId, alipayOpenId, alipayLogonId, signScene, externalAgreementNo, thirdPartyType, agreementNo, customizedParams);
          return localVarResp.getData();
      }
  
      /**
       * 支付宝个人代扣协议查询接口
       * 支付宝个人代扣协议查询接口
       * @param personalProductCode 协议产品码，商户和支付宝签约时确定，商户可咨询技术支持。 (optional)
       * @param alipayUserId 用户的支付宝账号对应 的支付宝唯一用户号，以 2088 开头的 16 位纯数字 组成。 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayOpenId 用户的支付宝账号对应 的支付宝唯一用户号， 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayLogonId 用户的支付宝登录账号，支持邮箱或手机号码格式。本参数与alipay_open_id 或 alipay_user_id 同时填写，优先按照 alipay_open_id 或 alipay_user_id 处理。 (optional)
       * @param signScene 签约场景码，该值需要与系统/页面签约接口调用时传入的值保持一 致。如：周期扣款场景与调用 alipay.user.agreement.page.sign(支付宝个人协议页面签约接口) 签约时的 sign_scene 相同。  注意：当传入商户签约号 external_agreement_no 时，该值不能为空或默认值 DEFAULT|DEFAULT。  (optional)
       * @param externalAgreementNo 代扣协议中标示用户的唯一签约号(确保在商户系统中 唯一)。 格式规则:支持大写小写字母和数字，最长 32 位。 (optional)
       * @param thirdPartyType 签约第三方主体类型。对于三方协议，表示当前用户和哪一类的第三方主体进行签约。 默认为PARTNER。 (optional)
       * @param agreementNo 支付宝系统中用以唯一标识用户签约记录的编号（用户签约成功后的协议号 ） ，如果传了该参数，其他参数会被忽略 (optional)
       * @return ApiResponse&lt;AlipayUserAgreementQueryResponseModel&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public ApiResponse<AlipayUserAgreementQueryResponseModel> queryWithHttpInfo(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo, CustomizedParams customizedParams) throws ApiException {
          okhttp3.Call localVarCall = queryValidateBeforeCall(personalProductCode, alipayUserId, alipayOpenId, alipayLogonId, signScene, externalAgreementNo, thirdPartyType, agreementNo, null, customizedParams);
          try {
              Type localVarReturnType = new TypeToken<AlipayUserAgreementQueryResponseModel>(){}.getType();
              return localVarApiClient.execute(localVarCall, localVarReturnType);
          } catch (ApiException e) {
              try {
                  e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<AlipayUserAgreementQueryDefaultResponse>(){}.getType()));
              } catch (Exception ex) {
                  AlipayLogger.logBizWarn(ex);
              }
              throw e;
          }
      }
  
      /**
       * 支付宝个人代扣协议查询接口 (asynchronously)
       * 支付宝个人代扣协议查询接口
       * @param personalProductCode 协议产品码，商户和支付宝签约时确定，商户可咨询技术支持。 (optional)
       * @param alipayUserId 用户的支付宝账号对应 的支付宝唯一用户号，以 2088 开头的 16 位纯数字 组成。 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayOpenId 用户的支付宝账号对应 的支付宝唯一用户号， 本参数与alipay_logon_id若都填写，则以本参数为准，优先级高于 alipay_logon_id。 (optional)
       * @param alipayLogonId 用户的支付宝登录账号，支持邮箱或手机号码格式。本参数与alipay_open_id 或 alipay_user_id 同时填写，优先按照 alipay_open_id 或 alipay_user_id 处理。 (optional)
       * @param signScene 签约场景码，该值需要与系统/页面签约接口调用时传入的值保持一 致。如：周期扣款场景与调用 alipay.user.agreement.page.sign(支付宝个人协议页面签约接口) 签约时的 sign_scene 相同。  注意：当传入商户签约号 external_agreement_no 时，该值不能为空或默认值 DEFAULT|DEFAULT。  (optional)
       * @param externalAgreementNo 代扣协议中标示用户的唯一签约号(确保在商户系统中 唯一)。 格式规则:支持大写小写字母和数字，最长 32 位。 (optional)
       * @param thirdPartyType 签约第三方主体类型。对于三方协议，表示当前用户和哪一类的第三方主体进行签约。 默认为PARTNER。 (optional)
       * @param agreementNo 支付宝系统中用以唯一标识用户签约记录的编号（用户签约成功后的协议号 ） ，如果传了该参数，其他参数会被忽略 (optional)
       * @param _callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       * @deprecated
       */
      @Deprecated
      public okhttp3.Call queryAsync(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo, final ApiCallback<AlipayUserAgreementQueryResponseModel> _callback) throws ApiException {
  
          okhttp3.Call localVarCall = queryValidateBeforeCall(personalProductCode, alipayUserId, alipayOpenId, alipayLogonId, signScene, externalAgreementNo, thirdPartyType, agreementNo, _callback, null);
          Type localVarReturnType = new TypeToken<AlipayUserAgreementQueryResponseModel>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
  
      @Deprecated
      public okhttp3.Call queryAsync(String personalProductCode, String alipayUserId, String alipayOpenId, String alipayLogonId, String signScene, String externalAgreementNo, String thirdPartyType, String agreementNo, final ApiCallback<AlipayUserAgreementQueryResponseModel> _callback, CustomizedParams customizedParams) throws ApiException {
  
          okhttp3.Call localVarCall = queryValidateBeforeCall(personalProductCode, alipayUserId, alipayOpenId, alipayLogonId, signScene, externalAgreementNo, thirdPartyType, agreementNo, _callback, customizedParams);
          Type localVarReturnType = new TypeToken<AlipayUserAgreementQueryResponseModel>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
      /**
       * Build call for transfer
       * @param alipayUserAgreementTransferModel  (optional)
       * @param _callback Callback for upload/download progress
       * @param customizedParams
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public okhttp3.Call transferCall(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          String basePath = null;
          // Operation Servers
          String[] localBasePaths = new String[] {  };
  
          // Determine Base Path to Use
          if (localCustomBaseUrl != null){
              basePath = localCustomBaseUrl;
          } else if ( localBasePaths.length > 0 ) {
              basePath = localBasePaths[localHostIndex];
          } else {
              basePath = null;
          }
  
          Object localVarPostBody = (customizedParams != null && !Strings.isNullOrEmpty(customizedParams.getBodyContent()))
                  ? customizedParams.getBodyContent() : alipayUserAgreementTransferModel;
  
          // create path and map variables
          String localVarPath = "/v3/alipay/user/agreement/transfer";
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
          Map<String, String> localVarCookieParams = new HashMap<String, String>();
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) {
              localVarHeaderParams.put("Accept", localVarAccept);
          }
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
          if (localVarContentType != null) {
              localVarHeaderParams.put("Content-Type", localVarContentType);
          }
  
          if (customizedParams != null) {
              //额外query参数
              if (customizedParams.getQueryParams() != null && customizedParams.getQueryParams().size() > 0) {
                  for (Map.Entry<String, String> entry : customizedParams.getQueryParams().entrySet()) {
                      localVarQueryParams.addAll(localVarApiClient.parameterToPair(entry.getKey(), entry.getValue()));
                  }
              }
  
              if (!Strings.isNullOrEmpty(customizedParams.getAppAuthToken())) {
                  localVarHeaderParams.put("alipay-app-auth-token", customizedParams.getAppAuthToken());
              }
  
              //额外非全局header参数
              if (customizedParams.getHeaderParams() != null && customizedParams.getHeaderParams().size() > 0) {
                  localVarHeaderParams.putAll(customizedParams.getHeaderParams());
              }
          }
  
          String[] localVarAuthNames = new String[] {  };
          return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
      }
  
      @SuppressWarnings("rawtypes")
      private okhttp3.Call transferValidateBeforeCall(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          
  
          okhttp3.Call localVarCall = transferCall(alipayUserAgreementTransferModel, _callback, customizedParams);
          return localVarCall;
  
      }
  
      /**
       * 协议由普通通用代扣协议产品转移到周期扣协议产品
       * 由商户调用，将商户之前通用代扣产品转移到周期扣的协议产品
       * @param alipayUserAgreementTransferModel  (optional)
       * @return AlipayUserAgreementTransferResponseModel
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public AlipayUserAgreementTransferResponseModel transfer(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel) throws ApiException {
          ApiResponse<AlipayUserAgreementTransferResponseModel> localVarResp = transferWithHttpInfo(alipayUserAgreementTransferModel, null);
          return localVarResp.getData();
      }
  
      public AlipayUserAgreementTransferResponseModel transfer(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel, CustomizedParams customizedParams) throws ApiException {
          ApiResponse<AlipayUserAgreementTransferResponseModel> localVarResp = transferWithHttpInfo(alipayUserAgreementTransferModel, customizedParams);
          return localVarResp.getData();
      }
  
      /**
       * 协议由普通通用代扣协议产品转移到周期扣协议产品
       * 由商户调用，将商户之前通用代扣产品转移到周期扣的协议产品
       * @param alipayUserAgreementTransferModel  (optional)
       * @return ApiResponse&lt;AlipayUserAgreementTransferResponseModel&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public ApiResponse<AlipayUserAgreementTransferResponseModel> transferWithHttpInfo(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel, CustomizedParams customizedParams) throws ApiException {
          okhttp3.Call localVarCall = transferValidateBeforeCall(alipayUserAgreementTransferModel, null, customizedParams);
          try {
              Type localVarReturnType = new TypeToken<AlipayUserAgreementTransferResponseModel>(){}.getType();
              return localVarApiClient.execute(localVarCall, localVarReturnType);
          } catch (ApiException e) {
              try {
                  e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<AlipayUserAgreementTransferDefaultResponse>(){}.getType()));
              } catch (Exception ex) {
                  AlipayLogger.logBizWarn(ex);
              }
              throw e;
          }
      }
  
      /**
       * 协议由普通通用代扣协议产品转移到周期扣协议产品 (asynchronously)
       * 由商户调用，将商户之前通用代扣产品转移到周期扣的协议产品
       * @param alipayUserAgreementTransferModel  (optional)
       * @param _callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       * @deprecated
       */
      @Deprecated
      public okhttp3.Call transferAsync(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel, final ApiCallback<AlipayUserAgreementTransferResponseModel> _callback) throws ApiException {
  
          okhttp3.Call localVarCall = transferValidateBeforeCall(alipayUserAgreementTransferModel, _callback, null);
          Type localVarReturnType = new TypeToken<AlipayUserAgreementTransferResponseModel>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
  
      @Deprecated
      public okhttp3.Call transferAsync(AlipayUserAgreementTransferModel alipayUserAgreementTransferModel, final ApiCallback<AlipayUserAgreementTransferResponseModel> _callback, CustomizedParams customizedParams) throws ApiException {
  
          okhttp3.Call localVarCall = transferValidateBeforeCall(alipayUserAgreementTransferModel, _callback, customizedParams);
          Type localVarReturnType = new TypeToken<AlipayUserAgreementTransferResponseModel>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
      /**
       * Build call for unsign
       * @param alipayUserAgreementUnsignModel  (optional)
       * @param _callback Callback for upload/download progress
       * @param customizedParams
       * @return Call to execute
       * @throws ApiException If fail to serialize the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public okhttp3.Call unsignCall(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          String basePath = null;
          // Operation Servers
          String[] localBasePaths = new String[] {  };
  
          // Determine Base Path to Use
          if (localCustomBaseUrl != null){
              basePath = localCustomBaseUrl;
          } else if ( localBasePaths.length > 0 ) {
              basePath = localBasePaths[localHostIndex];
          } else {
              basePath = null;
          }
  
          Object localVarPostBody = (customizedParams != null && !Strings.isNullOrEmpty(customizedParams.getBodyContent()))
                  ? customizedParams.getBodyContent() : alipayUserAgreementUnsignModel;
  
          // create path and map variables
          String localVarPath = "/v3/alipay/user/agreement/unsign";
  
          List<Pair> localVarQueryParams = new ArrayList<Pair>();
          List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>();
          Map<String, String> localVarHeaderParams = new HashMap<String, String>();
          Map<String, String> localVarCookieParams = new HashMap<String, String>();
          Map<String, Object> localVarFormParams = new HashMap<String, Object>();
  
          final String[] localVarAccepts = {
              "application/json"
          };
          final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts);
          if (localVarAccept != null) {
              localVarHeaderParams.put("Accept", localVarAccept);
          }
  
          final String[] localVarContentTypes = {
              "application/json"
          };
          final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes);
          if (localVarContentType != null) {
              localVarHeaderParams.put("Content-Type", localVarContentType);
          }
  
          if (customizedParams != null) {
              //额外query参数
              if (customizedParams.getQueryParams() != null && customizedParams.getQueryParams().size() > 0) {
                  for (Map.Entry<String, String> entry : customizedParams.getQueryParams().entrySet()) {
                      localVarQueryParams.addAll(localVarApiClient.parameterToPair(entry.getKey(), entry.getValue()));
                  }
              }
  
              if (!Strings.isNullOrEmpty(customizedParams.getAppAuthToken())) {
                  localVarHeaderParams.put("alipay-app-auth-token", customizedParams.getAppAuthToken());
              }
  
              //额外非全局header参数
              if (customizedParams.getHeaderParams() != null && customizedParams.getHeaderParams().size() > 0) {
                  localVarHeaderParams.putAll(customizedParams.getHeaderParams());
              }
          }
  
          String[] localVarAuthNames = new String[] {  };
          return localVarApiClient.buildCall(basePath, localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback);
      }
  
      @SuppressWarnings("rawtypes")
      private okhttp3.Call unsignValidateBeforeCall(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel, final ApiCallback _callback, CustomizedParams customizedParams) throws ApiException {
          
  
          okhttp3.Call localVarCall = unsignCall(alipayUserAgreementUnsignModel, _callback, customizedParams);
          return localVarCall;
  
      }
  
      /**
       * 支付宝个人代扣协议解约接口
       * 支付宝个人代扣协议解约接口
       * @param alipayUserAgreementUnsignModel  (optional)
       * @return Object
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public Object unsign(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel) throws ApiException {
          ApiResponse<Object> localVarResp = unsignWithHttpInfo(alipayUserAgreementUnsignModel, null);
          return localVarResp.getData();
      }
  
      public Object unsign(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel, CustomizedParams customizedParams) throws ApiException {
          ApiResponse<Object> localVarResp = unsignWithHttpInfo(alipayUserAgreementUnsignModel, customizedParams);
          return localVarResp.getData();
      }
  
      /**
       * 支付宝个人代扣协议解约接口
       * 支付宝个人代扣协议解约接口
       * @param alipayUserAgreementUnsignModel  (optional)
       * @return ApiResponse&lt;Object&gt;
       * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       */
      public ApiResponse<Object> unsignWithHttpInfo(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel, CustomizedParams customizedParams) throws ApiException {
          okhttp3.Call localVarCall = unsignValidateBeforeCall(alipayUserAgreementUnsignModel, null, customizedParams);
          try {
              Type localVarReturnType = new TypeToken<Object>(){}.getType();
              return localVarApiClient.execute(localVarCall, localVarReturnType);
          } catch (ApiException e) {
              try {
                  e.setErrorObject(localVarApiClient.getJSON().getGson().fromJson(e.getResponseBody(), new TypeToken<AlipayUserAgreementUnsignDefaultResponse>(){}.getType()));
              } catch (Exception ex) {
                  AlipayLogger.logBizWarn(ex);
              }
              throw e;
          }
      }
  
      /**
       * 支付宝个人代扣协议解约接口 (asynchronously)
       * 支付宝个人代扣协议解约接口
       * @param alipayUserAgreementUnsignModel  (optional)
       * @param _callback The callback to be executed when the API call finishes
       * @return The request call
       * @throws ApiException If fail to process the API call, e.g. serializing the request body object
       * @http.response.details
       <table summary="Response Details" border="1">
          <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
          <tr><td> 200 </td><td> common response </td><td>  -  </td></tr>
          <tr><td> 0 </td><td> 请求失败 </td><td>  -  </td></tr>
       </table>
       * @deprecated
       */
      @Deprecated
      public okhttp3.Call unsignAsync(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel, final ApiCallback<Object> _callback) throws ApiException {
  
          okhttp3.Call localVarCall = unsignValidateBeforeCall(alipayUserAgreementUnsignModel, _callback, null);
          Type localVarReturnType = new TypeToken<Object>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
  
      @Deprecated
      public okhttp3.Call unsignAsync(AlipayUserAgreementUnsignModel alipayUserAgreementUnsignModel, final ApiCallback<Object> _callback, CustomizedParams customizedParams) throws ApiException {
  
          okhttp3.Call localVarCall = unsignValidateBeforeCall(alipayUserAgreementUnsignModel, _callback, customizedParams);
          Type localVarReturnType = new TypeToken<Object>(){}.getType();
          localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback);
          return localVarCall;
      }
  }
  