'In Square, when we mark an Order as Ready, is there any way to get Square to notify that user via email or text?

With the new API, it is great that we are able to push orders to the POS app - now I just need a way to notify customers that the pick-up is ready. I have my own system seperately right now, but is there any way to do this inside of Square. Or even better, is there any way to hook into a square event?

I see webhooks, but only things like payment, refund, dispute events. Is there any way to catch an order status change?



Solution 1:[1]

Unfortunately, there's currently no Order webhooks at this time. Webhooks are definitely an area Square's APIs have been focusing and improving lately, so I suspect this to be an area we continue to improve. With that said, there is no ETA on if/when this is coming, sadly we do not share public timelines.

Solution 2:[2]

You can not use namedquery with non-JPA query language as described in the documentation

The examples use the element and @NamedQuery annotation. The queries for these configuration elements have to be defined in the JPA query language. Of course, you can use or @NamedNativeQuery too. These elements let you define the query in native SQL by losing the database platform independence.

So you can use NamedNativeQueries, below is example how to define them in a entity class

@SqlResultSetMapping(name="flagResult", columns = { @ColumnResult(name = "@FLAG")})

@NamedNativeQueries(
  {
    @NamedNativeQuery(
      name = "native1",
      query = "select * from user where name=:name",
      resultClass = User.class
    ),
    @NamedNativeQuery(
      name = "nativeSessionSet",
      query = "set @FLAG=:name",
      resultClass = User.class
    ),
    @NamedNativeQuery(
      name = "nativeSessionGet",
      query = "select @FLAG",
      resultSetMapping = "flagResult"
    ),
    @NamedNativeQuery(
      name = "UpdateStoredProc",
      query = "call UPDATE_USER(:id, :name, :mail)",
      resultClass = User.class
    ),
  }
)
@Data
@Entity // This tells Hibernate to make a table out of this class
public class User {

in order to call that native query from a repository check code below

public interface UserRepository extends CrudRepository<User, Integer> {
    public User findByName(String name);
    @Query(name = "native1")
    public User native1(String name);
    @Modifying
    @Query(name = "nativeSessionSet")
    @Transactional
    public void nativeSessionSet(String name);
    @Query(name = "nativeSessionGet")
    public Object nativeSessionGet();

here are the outputs in my machine calling example spring boot app with curl

you can find running example here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 sjosey
Solution 2