-
Notifications
You must be signed in to change notification settings - Fork 0
/
inquiry.go
52 lines (45 loc) · 1.59 KB
/
inquiry.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package sat
import (
"encoding/json"
)
// InquiryRequest to hold inquiry request
type InquiryRequest struct {
ID string `jsonapi:"primary,inquiry"`
ProductCode string `jsonapi:"attr,product_code"`
ClientNumber string `jsonapi:"attr,client_number"`
Amount int64 `jsonapi:"attr,amount"`
Fields Fields `jsonapi:"attr,fields"`
DownlineID string `jsonapi:"attr,downline_id"`
}
// InquiryResponse to hold inquiry response
type InquiryResponse struct {
ID string `jsonapi:"primary,inquiry"`
ProductCode string `jsonapi:"attr,product_code"`
SalesPrice int64 `jsonapi:"attr,sales_price"`
Fields Fields `jsonapi:"attr,fields"`
InquiryResult Fields `jsonapi:"attr,inquiry_result"`
BasePrice int64 `jsonapi:"attr,base_price"`
AdminFee int64 `jsonapi:"attr,admin_fee"`
ClientName string `jsonapi:"attr,client_name"`
ClientNumber string `jsonapi:"attr,client_number"`
MeterID string `jsonapi:"attr,meter_id"`
RefID string `jsonapi:"attr,ref_id,omitempty"`
MaxPayment int64 `jsonapi:"attr,max_payment,omitempty"`
MinPayment int64 `jsonapi:"attr,min_payment,omitempty"`
MinAmount int64 `jsonapi:"attr,min_amount,omitempty"`
}
// Fields contains dynamic key value
type Fields []Field
// Field contains field detail information
type Field struct {
Name string `json:"name" jsonapi:"attr,name"`
Value string `json:"value" jsonapi:"attr,value"`
}
// UnmarshalJSON override unmarshal jsonapi
func (s *Field) UnmarshalJSON(data []byte) error {
err := json.Unmarshal(data, s)
if err != nil {
return err
}
return nil
}