Skip to content

Commit

Permalink
fix broken methods, update http verb, examples. CF-593
Browse files Browse the repository at this point in the history
  • Loading branch information
Jason Matthias committed Dec 8, 2022
1 parent f1ce76c commit fc8fd6b
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 3 deletions.
27 changes: 27 additions & 0 deletions examples/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@
- [Create Subnet](#create-subnet)
- [Update Subnet](#update-subnet)
- [Ship Card](#ship-card)
- [Push To Wallet](#push-to-wallet)
- [Get Card Shipment](#get-card-shipment)
- [Transactions](#transactions)
- [Get Transactions](#get-transactions)
- [Get Node Transactions](#get-node-transactions)
Expand Down Expand Up @@ -573,6 +575,31 @@ body := `{
data, err := user.ShipCard(nodeID, subnetID, body)
```

#### Push to Wallet
[Synapse Docs](https://docs.synapsefi.com/api-references/subnets/push-to-wallet)
```go
nodeID := "594e606212e17a002f2e3251"
subnetID := "5bc920f2fff373002bf0d51b"
body := `{
"type": "APPLE_PUSH",
"nonce": "RH0jOQ==",
"nonce_signature": "QNyNZuyDO...EFg/Q",
"certificates": [
"MIICzD....OPQ7"
]
}`

data, err := user.PushToWallet(nodeID, subnetID, body)
```

#### Get Card Shipment
```go
nodeID := "594e606212e17a002f2e3251"
subnetID := "5bc920f2fff373002bf0d51b"

data, err := user.GetCardShipment(nodeID, subnetID)
```

### Transactions

#### Get Transactions
Expand Down
20 changes: 17 additions & 3 deletions users.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,12 @@ func (u *User) VerifyMicroDeposit(nodeID, data string) (map[string]interface{},
func (u *User) ReinitiateMicroDeposits(nodeID string) (map[string]interface{}, error) {
log.info("========== RE-INITIATE MICRO-DEPOSITS ==========")
url := buildURL(path["users"], u.UserID, path["nodes"], nodeID) + "?resend_micro=YES"
data := `{"resend_micro":"YES"}`

return u.do("PATCH", url, "", nil)
return u.do("PATCH", url, data, nil)
}

// DEPRECATED
// ResetCardNode resets the debit card number, card cvv, and expiration date
func (u *User) ResetCardNode(nodeID string) (map[string]interface{}, error) {
log.info("========== RESET CARD ==========)")
Expand All @@ -237,6 +239,7 @@ func (u *User) ResetCardNode(nodeID string) (map[string]interface{}, error) {
return u.do("PATCH", url, "", nil)
}

// DEPRECATED, use User.ShipCard instead
// ShipCardNode ships a physical debit card out to the user
func (u *User) ShipCardNode(nodeID, data string) (map[string]interface{}, error) {
log.info("========== SHIP CARD ==========")
Expand All @@ -245,6 +248,7 @@ func (u *User) ShipCardNode(nodeID, data string) (map[string]interface{}, error)
return u.do("PATCH", url, data, nil)
}

// DEPRECATED
// GetApplePayToken generates tokenized info for Apple Wallet
func (u *User) GetApplePayToken(nodeID, data string) (map[string]interface{}, error) {
log.info("========== GET APPLE PAY TOKEN ==========")
Expand All @@ -271,6 +275,7 @@ func (u *User) GetNodeStatements(nodeID string, queryParams ...string) (map[stri
return u.do("GET", url, "", queryParams)
}

// DEPRECATED - statements are automatically generated
// CreateNodeStatements creates ad-hoc statements for the specified node
func (u *User) CreateNodeStatements(nodeID, data string, idempotencyKey ...string) (map[string]interface{}, error) {
log.info("========== CREATE AD-HOC STATEMENT ==========")
Expand Down Expand Up @@ -329,6 +334,14 @@ func (u *User) ShipCard(nodeID, subnetID, data string) (map[string]interface{},
return u.do("PATCH", url, data, nil)
}

// PushToWallet Mobile Wallets are digital wallets held on mobile devices that transact with merchants by turning Native Card Primary Account Numbers (PANs) into digital tokens
func (u *User) PushToWallet(nodeID, subnetID, data string) (map[string]interface{}, error) {
log.info("========== PUSH TO MOBILE WALLET ==========")
url := buildURL(path["users"], u.UserID, path["nodes"], nodeID, path["subnets"], subnetID, "push")

return u.do("POST", url, data, nil)
}

// GetCardShipment gets card shipment details
func (u *User) GetCardShipment(nodeID, subnetID string) (map[string]interface{}, error) {
log.info("========== GET CARD SHIPMENT DETAILS ==========")
Expand Down Expand Up @@ -380,11 +393,12 @@ func (u *User) CancelTransaction(nodeID, transactionID string) (map[string]inter
}

// CommentOnTransactionStatus adds comment to the transaction status
func (u *User) CommentOnTransactionStatus(nodeID, transactionID, data string, idempotencyKey ...string) (map[string]interface{}, error) {
func (u *User) CommentOnTransactionStatus(nodeID, transactionID, comment string, idempotencyKey ...string) (map[string]interface{}, error) {
log.info("========== COMMENT ON TRANSACTION STATUS ==========")
url := buildURL(path["users"], u.UserID, path["nodes"], nodeID, path["transactions"], transactionID)
data := `{"comment":"` + comment + `"}`

return u.do("POST", url, data, idempotencyKey)
return u.do("PATCH", url, data, idempotencyKey)
}

// DisputeTransaction disputes a transaction for a user
Expand Down

0 comments on commit fc8fd6b

Please sign in to comment.