Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

https://developers.google.com/wallet/generic/getting-started/onboarding-guide #2517

Open
Mohamadrezashiri1 opened this issue Nov 20, 2024 · 1 comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.

Comments

@Mohamadrezashiri1
Copy link

Mohamadrezashiri1 commented Nov 20, 2024

/**
 * Create a class.
 *
 * @param issuerId The issuer ID being used for this request.
 * @param classSuffix Developer-defined unique ID for this pass class.
 * @return The pass class ID: "{issuerId}.{classSuffix}"
 */
public String createClass(String issuerId, String classSuffix) throws IOException {
  // Check if the class exists
  try {
    service.genericclass().get(String.format("%s.%s", issuerId, classSuffix)).execute();

    System.out.printf("Class %s.%s already exists!%n", issuerId, classSuffix);
    return String.format("%s.%s", issuerId, classSuffix);
  } catch (GoogleJsonResponseException ex) {
    if (ex.getStatusCode() != 404) {
      // Something else went wrong...
      ex.printStackTrace();
      return String.format("%s.%s", issuerId, classSuffix);
    }
  }

  // See link below for more information on required properties
  // https://developers.google.com/wallet/generic/rest/v1/genericclass
  GenericClass newClass = new GenericClass().setId(String.format("%s.%s", issuerId, classSuffix));

  GenericClass response = service.genericclass().insert(newClass).execute();

  System.out.println("Class insert response");
  System.out.println(response.toPrettyString());

  return response.getId();
}
@diegomarquezp diegomarquezp added type: question Request for information or clarification. Not an issue. priority: p3 Desirable enhancement or fix. May not be included in next release. labels Nov 21, 2024
@diegomarquezp
Copy link
Contributor

Hi @Mohamadrezashiri1, would you mind helping us clarifying what issue does this code bring? Also, for faster response times, please refer to our support hub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: p3 Desirable enhancement or fix. May not be included in next release. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants