=== AddToWallet for LatePoint ===
Contributors: lakshayaddtowallet
Tags: latepoint, appointments, wallet, apple wallet, google wallet
Requires at least: 5.8
Tested up to: 7.1
Requires PHP: 7.4
Stable tag: 2.0.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Turn every LatePoint booking into an Apple or Google Wallet pass, so customers carry
their appointment on their phone.

== Description ==

A customer books an appointment, and the last step of LatePoint's booking form offers them
**Add to Apple Wallet** and **Add to Google Wallet** buttons, right under the confirmation
message. Every booking gets its own pass, with the customer's name, the service, the date
and time, the agent and the location, and a barcode carrying LatePoint's booking code.

= Design the pass =

The *Pass design* tab is a visual editor with a live Apple Wallet and Google Wallet
preview, front and back, filled in with your latest booking.

* Your business name, logo and colour.
* A header line, the pass title and up to three fields on the front.
* Sections on the back: text, links, phone numbers, email addresses and addresses.
* "+ Data Field" puts each booking's details on the pass: the customer's name, the
  service, date, start and end time, duration, agent, location and its address, booking
  code, price, your business details and more.
* A hero image, with a different image per service if you like.
* The barcode format, and a Wallet reminder before the appointment.

= How it works =

* The buttons appear in the confirmation step of LatePoint's booking form, under the
  confirmation message. Bookings that already have a pass also show the buttons in
  LatePoint's customer account.
* An order with several appointments gets one pass per booking, each labelled with its
  service and time.
* The passes are created on your server with your AddToWallet API key. The key never
  reaches your visitors' browsers.
* The browser sends only the order key LatePoint itself puts in the confirmation step (the
  same key as in its "manage your order" link), and the booking details are read from
  LatePoint, so nobody can create a pass for someone else's booking or put made-up details
  on one.
* Showing the confirmation again never creates a second pass for the same booking.
* When a payment takes a moment to confirm, the confirmation step waits for it rather than
  giving up.

= Reschedules and cancellations =

When a booking is cancelled, marked a no show, or deleted, the pass in the customer's
wallet is marked expired straight away. When a booking is rescheduled, or its service,
agent or location changes, the pass is updated to match, without using another credit.
This all happens on your server, from LatePoint's own notifications, with a check every
ten minutes for anything changed some other way. You choose which of these expire a pass
on the Settings tab.

= Requirements =

* LatePoint
* An AddToWallet account and API key

= Coming from the 1.x zip? =

AddToWallet for LatePoint 1.x was handed out as a download. This plugin installs into a
new folder, so WordPress treats it as a separate plugin. When you activate it, it copies
your 1.x API key, logo, image, colour and barcode setting, and the record of every pass
1.x issued, and from then on it creates, updates and expires the passes. Then deactivate
and delete the 1.x plugin. Until you do, it stays switched off and you will see a
reminder.

== Frequently Asked Questions ==

= Which bookings get a pass? =

Every Approved booking, and Completed ones. You can also issue passes for bookings still
Pending Approval, though you may not approve them.

= No buttons appear. What should I check? =

* You are out of AddToWallet credits.
* The booking has a status you do not issue passes for (Pending Approval, say).
* Your theme or another plugin replaced LatePoint's confirmation step.

The *Bookings & passes* tab lists every booking and whether it received a pass.

= What does the barcode scan as? =

LatePoint's booking code, the one the customer sees in their confirmation and emails, and
the one you can search for in LatePoint.

= Does expiring a pass refund the credit? =

No. Each pass costs one credit when it is created.

== External services ==

This plugin connects to the AddToWallet API at https://app.addtowallet.co to create,
update and expire Apple Wallet and Google Wallet passes. Without this service it cannot
issue passes.

* When you save an API key, the plugin checks it by reading your credit balance
  (`/api/payment/usage`), sending only the key. The balance is read again when you open the
  Settings tab.
* When a booking's confirmation step is shown and the booking qualifies, the plugin sends
  the details you put on its pass from your server to AddToWallet (`/api/card/create`).
  With the default design that is the customer's name, the service, the date and time, the
  booking code (also as the barcode), the agent's name, the location's address, your
  business name, phone number and site address, the site's admin email address, and the
  logo, image and colors you configured. The customer's email address or phone number and
  the price are only sent if you add them to the pass design.
* When a booking is cancelled, marked a no show or deleted, it sends the pass id and your
  logo so the pass can be expired; when the booking changes, it sends the pass id with the
  updated pass details (`/api/card/edit`).
* The Help tab's contact form sends the name, email address and message you type, plus your
  site address and the plugin version, to AddToWallet support (`/api/admin/contactus`),
  only when you press Send.

Every request to `/api/card/*` and `/api/payment/usage` carries your API key to
authenticate it. Your API key is never sent to the customer's browser.

The service is provided by AddToWallet: [Terms of Service](https://addtowallet.co/terms/),
[Privacy Policy](https://addtowallet.co/privacy-policy/).

== Screenshots ==

1. LatePoint's booking confirmation step with Add to Google Wallet and Add to Apple Wallet buttons.
2. Pass design: brand, front, back and hero image, with a live Apple Wallet and Google Wallet preview.
3. Bookings & passes: every booking, with whether its wallet pass was issued, expired or failed.
4. Settings: which bookings issue passes and what expires them, and the account's credit balance.

== Changelog ==

= 2.0.0 =
* First release on WordPress.org. Replaces the 1.x zip: settings and issued passes are copied over on activation.
* New admin screen, with Pass design, Bookings & passes, Settings and Help tabs.
* Pass design: a visual editor with a live Apple Wallet and Google Wallet preview, front and back.
* Choose the business name, header line, pass title and up to three front fields, using "+ Data Field" to add booking details: customer, service, date and time, agent, location, booking code and more.
* Add sections to the back of the pass: text, links, phone numbers, email addresses and addresses. By default the back has the agent, the location's address (opens a map) and your contact details.
* Hero image variations per service.
* Passes are expired when a booking is cancelled, marked a no show or deleted, and updated when it is rescheduled or its details change, without using another credit. You choose what expires a pass on the Settings tab.
* Choose which booking statuses issue passes (Approved and Completed, and optionally Pending Approval).
* An order with several appointments gets one pass per booking.
* Passes are created when the confirmation step is shown, not when a booking is saved, so bookings made by staff in the admin do not use credits until the customer sees them.
* The Wallet reminder before the appointment can be switched off.
* The API key is checked with AddToWallet before it is saved.
* Bookings & passes shows why a pass could not be created (for example, no credits left), and when a pass was updated, expired (and why) or failed to update or expire.

= 1.0.1 =
* Pass preview on the Settings screen.

= 1.0.0 =
* First release.

== Upgrade Notice ==

= 2.0.0 =
Replaces the AddToWallet for LatePoint 1.x zip. Activate this plugin, check your settings were copied over, then deactivate and delete the old plugin.
