Skip to content

Commit

Permalink
Add status descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
AchoArnold committed Dec 4, 2021
1 parent 384b47d commit 58fb609
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,33 @@ type RequestToPayStatus struct {
Amount string `json:"amount"`
Currency string `json:"currency"`
ExternalID string `json:"externalId"`
ReferenceID string `json:"referenceId"`
Payer *RequestToPayPayer `json:"payer"`
Status string `json:"status"`
FinancialTransactionID *string `json:"financialTransactionId,omitempty"`
Reason *string `json:"reason,omitempty"`
}

// IsPending checks if a transaction is in pending status
func (status *RequestToPayStatus) IsPending() bool {
return status.Status == "PENDING"
}

// IsFailed checks if a transaction is in failed status
func (status *RequestToPayStatus) IsFailed() bool {
return status.Status == "FAILED"
}

// IsCancelled checks if a transaction is cancelled
func (status *RequestToPayStatus) IsCancelled() bool {
return status.Status == "CANCELLED"
}

// IsSuccessful checks if a transaction is successful
func (status *RequestToPayStatus) IsSuccessful() bool {
return status.Status == "SUCCESSFUL"
}

// RequestToPayPayer identifies an account holder in the wallet platform.
type RequestToPayPayer struct {
PartyIDType string `json:"partyIdType"`
Expand Down
1 change: 1 addition & 0 deletions collection_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ func (service *collectionService) GetRequestToPayStatus(
return nil, response, err
}

status.ReferenceID = referenceID
return status, response, err
}

Expand Down

0 comments on commit 58fb609

Please sign in to comment.