getCustomerInfo method

Future<GetCustomerInfoResponse> getCustomerInfo (
  1. GetCustomerInfoRequest request
)

Check the status of a customers info (customer GET) This endpoint allows clients to:

Implementation

// 1. Fetch the fields the server requires in order to register a new customer:
// If the server does not have a customer registered for the parameters sent in the request, it will return the fields required in the response. The same response will be returned when no parameters are sent.
// 2. Check the status of a customer that may already be registered
// This allows clients to check whether the customers information was accepted, rejected, or still needs more info. If the server still needs more info, or the server needs updated information, it will return the fields required.
Future<GetCustomerInfoResponse> getCustomerInfo(
    GetCustomerInfoRequest request) async {
  checkNotNull(request, "request cannot be null");
  Uri serverURI = Uri.parse(_serviceAddress + "/customer");

  _GetCustomerInfoRequestBuilder requestBuilder =
      new _GetCustomerInfoRequestBuilder(httpClient, serverURI);

  final Map<String, String> queryParams = {};

  if (request.id != null) {
    queryParams["id"] = request.id;
  }
  if (request.account != null) {
    queryParams["account"] = request.account;
  }
  if (request.memo != null) {
    queryParams["memo"] = request.memo;
  }
  if (request.memoType != null) {
    queryParams["memo_type"] = request.memoType;
  }
  if (request.type != null) {
    queryParams["type"] = request.type;
  }
  if (request.lang != null) {
    queryParams["lang"] = request.lang;
  }

  GetCustomerInfoResponse response = await requestBuilder
      .forQueryParameters(queryParams)
      .execute(request.jwt);

  return response;
}