Skip to content

Commit

Permalink
docs: add plugin images and update readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
devaguia committed Feb 26, 2024
1 parent 21fb2df commit 306507b
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 7 deletions.
77 changes: 77 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- [Install dependencies](#install)
- [Build dependencies](#build)
- [Ignored folders and files](#ignore)
- [REST API](#api)
- [File Tree](#tree)


Expand Down Expand Up @@ -49,6 +50,82 @@ yarn build
- *.lock


<h2 id="api">REST API</h1>

### AUTHORIZATION
Use Basic Authentication para se autenticar e utilizar a REST API do plugin WooCommerce Payment Links;
<br>
Example:
```PHP
base64_encode(USER:PASSWORD)
```
### GET
#### Endpoint:
```
https://{domain}/wp-json/wc-payment-link/links/?{id}
```

Use the endpoint above to make a get request and search for the links registered on your website. You can also use the link ID as a parameter to search for a specific ID.

If necessary, it is possible to provide more information in the body of the request:
```JSON
{
"page": 1,
"per_page": 10,
"order":"ASC",
"order_by": "name"
}
```

### POST
#### Endpoint:
```
https://{domain}/wp-json/wc-payment-link/links/
```
Use o método POST para cadastrar novos links usando a REST API. Você vai precisar enviar os dados do link través do corpo da requisição:
```JSON
{
"name": "New Link",
"token": "3b356f26-6ea8-47ba-8649-d76c89e498be",
"coupon": "coupon-code",
"expire_at": "2024-02-22 00:00:00",
"products": [
{
"product": 43,
"quantity": 4
}
]
}
```

### PUT
#### Endpoint:
```
https://{domain}/wp-json/wc-payment-link/links/{id}
```
Use o método PUT para atualizar os links já cadastrados usando a REST API. Você vai precisar adiocioar o ID do link como parâmetro de URL e enviar os dados do link través do corpo da requisição:
```JSON
{
"name": "New Link 02",
"token": "3b356f26-6ea8-47ba-8649-d76c89e498be",
"coupon": "coupon-code",
"expire_at": "2024-02-22 00:00:00",
"products": [
{
"product": 43,
"quantity": 4
}
]
}
```

### DELETE
#### Endpoint:
```
https://{domain}/wp-json/wc-payment-link/links/{id}
```
Use the DELETE method passing the id of the link you want to remove using the REST API.

<h2 id="tree">File Tree</h2>

```
Expand Down
13 changes: 6 additions & 7 deletions app/Views/Admin/menus/settings/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,20 @@
<label for="default-search" class="mb-2 text-sm font-medium text-gray-900 sr-only"><?= __('Search', 'wc-payment-link'); ?></label>
<form id="wc-link-search-form" class="flex items-center justify-start" action="admin.php?page=wc-payment-link-links">
<div class="relative">
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
<svg class="w-4 h-4 text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
</svg>
</div>
<input type="search"
name="search"
id="default-search"
class="block w-[180px] h-4 !p-4 !ps-10 !text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500"
class="block w-[180px] h-4 !p-4 !text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-blue-500 focus:border-blue-500"
placeholder="<?= __('Search for links', 'wc-payment-link'); ?>"
value="<?=esc_attr( isset($search) ? $search : '')?>"
/>
</div>
<input type="hidden" value="wc-payment-link-links" name="page"/>
<button class="ml-2 px-8 py-[8px] bg-blue-600 text-white rounded justify-center hover:bg-[#316beb]"><?php echo __("Search", "wc-payment-link"); ?></button>
<button class="ml-2 px-4 py-[8px] text-blue-600 bg-white rounded justify-center shadow-md border-0 border-gray-300">
<svg class="w-4 h-4 text-blue-600" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
</svg>
</button>
</form>
</div>
<div class="relative overflow-x-auto shadow-md sm:rounded-lg">
Expand Down
3 changes: 3 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.html
== Description ==
Payment links for WooCommerce

== Documentation ==
[Access README.md on our official github](https://github.com/devaguia/wc-payment-link)

= Requisitos =
- PHP version 7.4 or higher.

Expand Down
Binary file added screenshot-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added screenshot-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 306507b

Please sign in to comment.