Skip to content

Commit b0212c9

Browse files
committed
fix: CardPointInquiry returned response struct
1 parent 0ae572c commit b0212c9

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

coreapi/client.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ import (
44
"bytes"
55
"encoding/json"
66
"fmt"
7-
"github.com/midtrans/midtrans-go"
87
"net/http"
98
"strconv"
9+
10+
"github.com/midtrans/midtrans-go"
1011
)
1112

1213
// Client : CoreAPI Client struct
@@ -141,8 +142,8 @@ func RegisterCard(cardNumber string, expMonth int, expYear int) (*CardRegisterRe
141142

142143
// CardPointInquiry : Do `/point_inquiry/{tokenId}` API request to Midtrans Core API return `coreapi.CardTokenResponse`,
143144
// more detail refer to: https://api-docs.midtrans.com/#point-inquiry
144-
func (c Client) CardPointInquiry(cardToken string) (*CardTokenResponse, *midtrans.Error) {
145-
resp := &CardTokenResponse{}
145+
func (c Client) CardPointInquiry(cardToken string) (*PointInquiryResponse, *midtrans.Error) {
146+
resp := &PointInquiryResponse{}
146147
err := c.HttpClient.Call(
147148
http.MethodGet,
148149
fmt.Sprintf("%s/v2/point_inquiry/%s", c.Env.BaseUrl(), cardToken),
@@ -160,7 +161,7 @@ func (c Client) CardPointInquiry(cardToken string) (*CardTokenResponse, *midtran
160161

161162
// CardPointInquiry : Do `/point_inquiry/{tokenId}` API request to Midtrans Core API return `coreapi.CardTokenResponse`,
162163
// more detail refer to: https://api-docs.midtrans.com/#point-inquiry
163-
func CardPointInquiry(cardToken string) (*CardTokenResponse, *midtrans.Error) {
164+
func CardPointInquiry(cardToken string) (*PointInquiryResponse, *midtrans.Error) {
164165
return getDefaultClient().CardPointInquiry(cardToken)
165166
}
166167

coreapi/response.go

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type PaymentAmount struct {
2323
Amount string `json:"amount"`
2424
}
2525

26-
//ChargeResponse : CoreAPI charge response struct when calling Midtrans API
26+
// ChargeResponse : CoreAPI charge response struct when calling Midtrans API
2727
type ChargeResponse struct {
2828
TransactionID string `json:"transaction_id"`
2929
OrderID string `json:"order_id"`
@@ -63,22 +63,22 @@ type ChargeResponse struct {
6363
OnUs bool `json:"on_us"`
6464
}
6565

66-
//ApproveResponse : Approve response type when calling Midtrans approve transaction API
66+
// ApproveResponse : Approve response type when calling Midtrans approve transaction API
6767
type ApproveResponse = ChargeResponse
6868

69-
//DenyResponse : Deny response type when calling Midtrans deny transaction API
69+
// DenyResponse : Deny response type when calling Midtrans deny transaction API
7070
type DenyResponse = ChargeResponse
7171

72-
//CancelResponse : Cancel response type when calling Midtrans cancel transaction API
72+
// CancelResponse : Cancel response type when calling Midtrans cancel transaction API
7373
type CancelResponse = ChargeResponse
7474

75-
//ExpireResponse : Expire response type when calling Midtrans expire transaction API
75+
// ExpireResponse : Expire response type when calling Midtrans expire transaction API
7676
type ExpireResponse = ChargeResponse
7777

78-
//CaptureResponse : Capture response type when calling Midtrans API capture for credit card transaction
78+
// CaptureResponse : Capture response type when calling Midtrans API capture for credit card transaction
7979
type CaptureResponse = ChargeResponse
8080

81-
//TransactionStatusResponse : Status transaction response struct
81+
// TransactionStatusResponse : Status transaction response struct
8282
type TransactionStatusResponse struct {
8383
TransactionTime string `json:"transaction_time"`
8484
GrossAmount string `json:"gross_amount"`
@@ -141,7 +141,7 @@ type RefundDetails struct {
141141
CreatedAt string `json:"created_at"`
142142
}
143143

144-
//RefundResponse : Refund response struct when calling Midtrans refund and direct refund API
144+
// RefundResponse : Refund response struct when calling Midtrans refund and direct refund API
145145
type RefundResponse struct {
146146
StatusCode string `json:"status_code"`
147147
StatusMessage string `json:"status_message"`
@@ -225,7 +225,7 @@ type UpdateSubscriptionResponse struct {
225225
type EnableSubscriptionResponse = UpdateSubscriptionResponse
226226
type DisableSubscriptionResponse = UpdateSubscriptionResponse
227227

228-
//ScheduleResponse Subscription schedule response object
228+
// ScheduleResponse Subscription schedule response object
229229
type ScheduleResponse struct {
230230
Interval int `json:"interval"`
231231
IntervalUnit string `json:"interval_unit"`
@@ -265,3 +265,11 @@ type BalanceDetails struct {
265265
Value string `json:"value"`
266266
Currency string `json:"currency"`
267267
}
268+
269+
type PointInquiryResponse struct {
270+
StatusCode string `json:"status_code"`
271+
StatusMessage string `json:"status_message"`
272+
PointBalance int `json:"point_balance"`
273+
TransactionTime string `json:"transaction_time"`
274+
PointBalanceAmount string `json:"point_balance_amount"`
275+
}

0 commit comments

Comments
 (0)