Skip to content
This repository was archived by the owner on Mar 8, 2024. It is now read-only.

Commit c463b1b

Browse files
Dino Rodriguez0xCLARITY
andauthored
docs: [6/x] Return All Payment Info Header (#408)
* refactor: todos/comments/error messages * refactor+tests: media types * lint: drop explicit typing on some variables * test: use deepStrictEqual * lint: drop comment * feat: return multiple addresses header * test: fix tests * chore: drop unused file * refactor: paymentInfo -> addressInfo * refactor: acceptHeaders -> headers * chore: package lock fix * fix: merge markers * fix: string cast- * fix: compiler errors, return null on no environment * refactor: clean up tests * refactor: re-organize utils * fix: return null for no environment * tests: getPreferredAddressInfo, getDetailsType, formatPaymentInfo * fix: make environment optional * fix: tests * refactor: code comments + rename acceptType * fix: make environment optional value * nit: renaming fields * nit: const names * fix: append memo * nit: test spacing * merge: pre merge cleanup * nit: rename * fix: test names, environment is optional * docs: update README * refactor: export parseAcceptHeader helper and use in unit tests * Update src/utils/basePayId.ts Co-authored-by: Hans Bergren <hansbergren@gmail.com> * fix: optional memo injection * fix: comments * fix: test failing * fix: memo ref * fix: merge error Co-authored-by: Hans Bergren <hansbergren@gmail.com>
1 parent 3b56b0a commit c463b1b

2 files changed

Lines changed: 29 additions & 16 deletions

File tree

readme.md

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,11 @@ The PayID protocol is designed to be simple, general, open, and universal. This
4848
- [8. Use Xpring SDK with PayID](#8-use-xpring-sdk-with-payid)
4949
- [8.1. Demo](#81-demo)
5050
- [9. Headers for GET requests for PayID Public API](#9-headers-for-get-requests-for-payid-public-api)
51-
- [9.1. Headers for XRP](#91-headers-for-xrp)
52-
- [9.2. Headers for ACH](#92-headers-for-ach)
53-
- [9.3. Headers for BTC](#93-headers-for-btc)
54-
- [9.4. Headers for ETH](#94-headers-for-eth)
51+
- [9.1. Header for All Addresses](#91-headers-for-all-addresses)
52+
- [9.2. Headers for XRP](#92-headers-for-xrp)
53+
- [9.3. Headers for ACH](#93-headers-for-ach)
54+
- [9.4. Headers for BTC](#94-headers-for-btc)
55+
- [9.5. Headers for ETH](#95-headers-for-eth)
5556

5657
## 1. Web standards
5758

@@ -697,11 +698,11 @@ The "Send payment proof" method does not accept any query parameters.
697698

698699
**Send payment proof Object Data Fields**
699700

700-
| Field | Type | Description |
701+
| Field | Type | Description |
701702
| ----------------------- | :----- | -------------------------: |
702703
| paymentSetupDetailsHash | string | Payment setup details hash |
703-
| transactionConfirmation | UUID | Transaction ID |
704-
| memo | string | Optional metadata |
704+
| transactionConfirmation | UUID | Transaction ID |
705+
| memo | string | Optional metadata |
705706

706707
### Response format <!-- omit in toc -->
707708

@@ -778,10 +779,16 @@ A [PaymentInformation](#71-paymentinformation-type) PaymentInformation type) obj
778779

779780
```json
780781
{
781-
"addressDetailsType": "CryptoAddressDetails",
782-
"addressDetails": {
783-
"address": "TVnGpXXZZ3xAZfhT42ntuCR4Uh3Rv9LE4BcZJeH1zds2CQ1"
784-
},
782+
"addresses": [
783+
{
784+
"paymentNetwork": "XRP",
785+
"addressDetailsType": "CryptoAddressDetails",
786+
"addressDetails": {
787+
"address": "TVnGpXXZZ3xAZfhT42ntuCR4Uh3Rv9LE4BcZJeH1zds2CQ1"
788+
}
789+
}
790+
],
791+
"payId": "alice$example.com",
785792
"memo": "this is an XRP testnet address"
786793
}
787794
```
@@ -938,6 +945,7 @@ The different header options are shown here, with example values.
938945
| BTC | application/btc+json | { <br>address: '1BvBMSEYstWetAu4m4GFg7xJaNVN2'<br> } |
939946
| XRP | application/xrpl-mainnet+json | { <br>address: 'XV5sbjUmgPpvXv4ixFWZ5ptAYZ6PD28Sq49uo34VyjnmK5H'<br> } |
940947
| ACH | application/ach+json | { <br> account: '363023456079',<br>routing: '011302838'<br>} |
948+
| All | application/payid+json | Variable depending on the contents of each address |
941949

942950
## 6. Code examples
943951

@@ -1038,28 +1046,34 @@ View [index-payid.js](https://github.com/xpring-eng/Xpring-SDK-Demo/blob/master/
10381046
10391047
This launch of PayID includes those headers specific to the Xpring ecosystem. Each payment network is free to establish its own standard headers. These headers should be submitted with every GET request, but not POST.
10401048
1041-
### 9.1. Headers for XRP
1049+
### 9.1. Header for All Addresses
1050+
1051+
| Accept header | Description |
1052+
| :--------------------: | :-------------------------------: |
1053+
| application/payid+json | Returns all addresses for a PayID |
1054+
1055+
### 9.2. Headers for XRP
10421056
10431057
| Accept header | Description |
10441058
| :---------------------------: | :----------------------: |
10451059
| application/xrpl-mainnet+json | Returns mainnet xAddress |
10461060
| application/xrpl-testnet+json | Returns testnet xAddress |
10471061
| application/xrpl-devnet+json | Returns devnet xAddress |
10481062
1049-
### 9.2. Headers for ACH
1063+
### 9.3. Headers for ACH
10501064
10511065
| Accept header | Description |
10521066
| :------------------: | :--------------------------------: |
10531067
| application/ach+json | Returns account and routing number |
10541068
1055-
### 9.3. Headers for BTC
1069+
### 9.4. Headers for BTC
10561070
10571071
| Accept header | Description |
10581072
| :--------------------------: | :---------------------: |
10591073
| application/btc-mainnet+json | Returns mainnet address |
10601074
| application/btc-testnet+json | Returns testnet address |
10611075
1062-
### 9.4. Headers for ETH
1076+
### 9.5. Headers for ETH
10631077
10641078
<table>
10651079
<tr>

test/unit/basePayId.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ describe('Base PayID - formatPaymentInfo()', function (): void {
106106
},
107107
},
108108
]
109-
110109
const expectedPaymentInfo = {
111110
addresses: [
112111
{

0 commit comments

Comments
 (0)