Class PaymentsService

java.lang.Object
edu.suffolk.litlab.efsp.server.services.PaymentsService

@Produces("application/json") public class PaymentsService extends Object
Handles communication with Tyler's API regarding Payments and the Tyler Online Gateway Activation (?), aka TOGA.
Author:
brycew
  • Constructor Details

  • Method Details

    • getAll

      @GET @Path("/") public jakarta.ws.rs.core.Response getAll()
    • getGlobalPaymentList

      @GET @Path("/global-accounts") public jakarta.ws.rs.core.Response getGlobalPaymentList(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders)
    • getGlobalPaymentAccount

      @GET @Path("/global-accounts/{account_id}") public jakarta.ws.rs.core.Response getGlobalPaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("account_id") String accountId)
    • createGlobalWaiverAccount

      @POST @Path("/global-accounts") public jakarta.ws.rs.core.Response createGlobalWaiverAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, String accountName)
      Creates a new global waiver account, which can be used for all filers in this EFSP.

      Access to this API should be gated at the client level. (TODO: should be gated here too, but required new server admin features to be tied to a single Tyler account).

      Parameters:
      httpHeaders -
      accountName - The body should of this should be the waiver account's name.
      Returns:
      The UUID of this new account, to be used as the `tyler_payment_id` attribute when filing.
    • updateGlobalPaymentAccount

      @PATCH @Path("/global-accounts/{account_id}") public jakarta.ws.rs.core.Response updateGlobalPaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("account_id") String accountId, String json)
    • removeGlobalPaymentAccount

      @DELETE @Path("/global-accounts/{account_id}") public jakarta.ws.rs.core.Response removeGlobalPaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("account_id") String accountId)
    • getPaymentAccount

      @GET @Path("/payment-accounts/{account_id}") public jakarta.ws.rs.core.Response getPaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("account_id") String accountId)
    • removePaymentAccount

      @DELETE @Path("/payment-accounts/{account_id}") public jakarta.ws.rs.core.Response removePaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("account_id") String accountId)
    • getPaymentAccountList

      @GET @Path("/payment-accounts") public jakarta.ws.rs.core.Response getPaymentAccountList(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @DefaultValue("") @QueryParam("court_id") String courtId) throws SQLException
      Throws:
      SQLException
    • createWaiverAccount

      @POST @Path("/payment-accounts") public jakarta.ws.rs.core.Response createWaiverAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, String accountName)
      Creates a new waiver account. To create a non-waiver account, see /new-toga-account.
      Parameters:
      httpHeaders -
      accountName - The body should of this should be the waiver account's name. If the user is manually creating this account, it should be given by them. If you are automatically creating the waiver account, it's name should be tied to the form the user is submitting with it (as these are linked on the courts side usually).
      Returns:
      The UUID of this new account, to be used as the `tyler_payment_id` attribute when filing.
    • updatePaymentAccount

      @PATCH @Path("/payment-accounts/{account_id}") public jakarta.ws.rs.core.Response updatePaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @PathParam("account_id") String accountId, String json) throws com.fasterxml.jackson.databind.JsonMappingException, com.fasterxml.jackson.core.JsonProcessingException
      Edits payment account information.

      Can only edit the account_name and whether it is active.

      To edit information like the card or bank account number, you will need to create a whole new form of payment.

      Throws:
      com.fasterxml.jackson.databind.JsonMappingException
      com.fasterxml.jackson.core.JsonProcessingException
    • getPaymentAccountTypeList

      @GET @Path("/types") public jakarta.ws.rs.core.Response getPaymentAccountTypeList(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders)
    • redirectToToga

      @POST @Consumes("application/x-www-form-urlencoded") @Path("/new-toga-account") @Produces("text/html") public jakarta.ws.rs.core.Response redirectToToga(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @FormParam("account_name") String name, @FormParam("global") boolean global, @FormParam("type_code") String typeCode, @Deprecated @FormParam("type_code_id") int typeCodeId, @FormParam("tyler_info") String tylerInfo, @FormParam("original_url") String originalUrl, @FormParam("error_url") String errorUrl)
      An endpoint that generates HTML+JS in order to send a user to Tyler's site where payment information can be securely entered. Should be visited with a form submission from the user's browser, so they can be securely redirected to Tyler's site.

      The HTML will generate a form submission from the user's browser targeted to Tyler's payment page, using Javascript.

      Tyler will redirect the user to back to /payments/toga-account once payment info is entered.

      Parameters:
      name - The desired name of the account
      global - whether the new payment type should be global or not (should be false in most cases).
      typeCode - a valid string code from /types (getPaymentAccountTypeList).
      typeCodeId - (optional, deprecated) the numerical code ID of the payment; used if Tyler responds back with an invalid type.
      tylerInfo - the login / token information of an authenticated Tyler user. Include here instead of the headers since this page is reached via a form submission. The info is saved to act as the user on Tyler's redirection response.
      originalUrl - If entry on Tyler's site is successful, forwards the user to this URL.
      errorUrl - If there's an error from Tyler's side, forwards the user to this URL.
      Returns:
      an HTML page that the user should visit directly
    • makeNewPaymentAccount

      @POST @Consumes("application/x-www-form-urlencoded") @Path("/toga-account") public jakarta.ws.rs.core.Response makeNewPaymentAccount(@Context jakarta.ws.rs.core.HttpHeaders httpHeaders, @FormParam("ResponseXML") String body)
      The endpoint that Tyler calls when the user enters their payment info into Tyler's system. /payments/new-toga-account will always be called before this endpoint.
      Parameters:
      httpHeaders -
      body - XML that adheres to TogaResponseXml.