Skip to content

Commit

Permalink
Added function to get datetime of profile creation (#3)
Browse files Browse the repository at this point in the history
* Added function to get datetime of subscription

* fix GetProfileCreatedDate

* add nil check

* remove white space
  • Loading branch information
tamaki0506 authored and evalphobia committed Jan 23, 2017
1 parent 9841e35 commit 4c73fda
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions client/transaction/transaction_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,18 @@ func (r *TransactionSearchResponse) TransactionIDList() (list []string) {
return
}

// GetProfileCreatedDate returns time of profile created.
func (r *TransactionSearchResponse) GetProfileCreatedDate() (time.Time, bool) {
if len(r.Items) == 0 {
return time.Time{}, false
}
item := r.Items[0]
if item.IsProfile() && item.IsCreated() {
return item.Timestamp, true
}
return time.Time{}, false
}

// GetCancelDate returns time of canceled.
func (r *TransactionSearchResponse) GetCancelDate() (time.Time, bool) {
for i := len(r.Items) - 1; i >= 0; i-- {
Expand Down

0 comments on commit 4c73fda

Please sign in to comment.