Skip to content

Commit 5fea677

Browse files
committed
refactor: Add omitempty to CallbackURL JSON tags in PaymentRequest and BasicPaymentRequest structs.
1 parent dd4390a commit 5fea677

File tree

2 files changed

+104
-104
lines changed

2 files changed

+104
-104
lines changed

models.go

Lines changed: 95 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -150,25 +150,25 @@ type SubscriptionPricingPlan struct {
150150

151151
// PaymentRequest represents payment request
152152
type PaymentRequest struct {
153-
Locale string `json:"locale"`
154-
ConversationID string `json:"conversationId"`
155-
Price string `json:"price"`
156-
PaidPrice string `json:"paidPrice"`
157-
Currency string `json:"currency"`
158-
Installment int `json:"installment"`
159-
BasketID string `json:"basketId"`
160-
PaymentChannel string `json:"paymentChannel"`
161-
PaymentGroup string `json:"paymentGroup"`
162-
PaymentCard *PaymentCard `json:"paymentCard"`
163-
Buyer *Buyer `json:"buyer"`
164-
ShippingAddress *Address `json:"shippingAddress"`
165-
BillingAddress *Address `json:"billingAddress"`
166-
BasketItems []BasketItem `json:"basketItems"`
167-
PaymentSource string `json:"paymentSource"`
168-
GsmNumber string `json:"gsmNumber"`
169-
PosOrderID string `json:"posOrderId"`
170-
ConnectorName string `json:"connectorName"`
171-
CallbackURL string `json:"callbackUrl"`
153+
Locale string `json:"locale"`
154+
ConversationID string `json:"conversationId"`
155+
Price string `json:"price"`
156+
PaidPrice string `json:"paidPrice"`
157+
Currency string `json:"currency"`
158+
Installment int `json:"installment"`
159+
BasketID string `json:"basketId"`
160+
PaymentChannel string `json:"paymentChannel"`
161+
PaymentGroup string `json:"paymentGroup"`
162+
PaymentCard *PaymentCard `json:"paymentCard"`
163+
Buyer *Buyer `json:"buyer"`
164+
ShippingAddress *Address `json:"shippingAddress"`
165+
BillingAddress *Address `json:"billingAddress"`
166+
BasketItems []BasketItem `json:"basketItems"`
167+
PaymentSource string `json:"paymentSource"`
168+
GsmNumber string `json:"gsmNumber"`
169+
PosOrderID string `json:"posOrderId"`
170+
ConnectorName string `json:"connectorName"`
171+
CallbackURL string `json:"callbackUrl,omitempty"`
172172
}
173173

174174
// BasicPaymentRequest represents basic payment request
@@ -185,31 +185,31 @@ type BasicPaymentRequest struct {
185185
PaymentCard *PaymentCard `json:"paymentCard"`
186186
Currency string `json:"currency"`
187187
ConnectorName string `json:"connectorName"`
188-
CallbackURL string `json:"callbackUrl"`
188+
CallbackURL string `json:"callbackUrl,omitempty"`
189189
}
190190

191191
// APMRequest represents APM payment request
192192
type APMRequest struct {
193-
Locale string `json:"locale"`
194-
ConversationID string `json:"conversationId"`
195-
Price string `json:"price"`
196-
PaidPrice string `json:"paidPrice"`
197-
PaymentChannel string `json:"paymentChannel"`
198-
PaymentGroup string `json:"paymentGroup"`
199-
PaymentSource string `json:"paymentSource"`
200-
Currency string `json:"currency"`
201-
MerchantOrderID string `json:"merchantOrderId"`
202-
CountryCode string `json:"countryCode"`
203-
AccountHolderName string `json:"accountHolderName"`
204-
MerchantCallbackURL string `json:"merchantCallbackUrl"`
205-
MerchantErrorURL string `json:"merchantErrorUrl"`
206-
MerchantNotificationURL string `json:"merchantNotificationUrl"`
207-
APMType string `json:"apmType"`
208-
BasketID string `json:"basketId"`
209-
Buyer *Buyer `json:"buyer"`
210-
ShippingAddress *Address `json:"shippingAddress"`
211-
BillingAddress *Address `json:"billingAddress"`
212-
BasketItems []BasketItem `json:"basketItems"`
193+
Locale string `json:"locale"`
194+
ConversationID string `json:"conversationId"`
195+
Price string `json:"price"`
196+
PaidPrice string `json:"paidPrice"`
197+
PaymentChannel string `json:"paymentChannel"`
198+
PaymentGroup string `json:"paymentGroup"`
199+
PaymentSource string `json:"paymentSource"`
200+
Currency string `json:"currency"`
201+
MerchantOrderID string `json:"merchantOrderId"`
202+
CountryCode string `json:"countryCode"`
203+
AccountHolderName string `json:"accountHolderName"`
204+
MerchantCallbackURL string `json:"merchantCallbackUrl"`
205+
MerchantErrorURL string `json:"merchantErrorUrl"`
206+
MerchantNotificationURL string `json:"merchantNotificationUrl"`
207+
APMType string `json:"apmType"`
208+
BasketID string `json:"basketId"`
209+
Buyer *Buyer `json:"buyer"`
210+
ShippingAddress *Address `json:"shippingAddress"`
211+
BillingAddress *Address `json:"billingAddress"`
212+
BasketItems []BasketItem `json:"basketItems"`
213213
}
214214

215215
// RefundRequest represents refund request
@@ -236,68 +236,68 @@ type CancelRequest struct {
236236

237237
// PaymentResponse represents payment response
238238
type PaymentResponse struct {
239-
Status string `json:"status"`
240-
Locale string `json:"locale"`
241-
SystemTime int64 `json:"systemTime"`
242-
ConversationID string `json:"conversationId"`
243-
Price string `json:"price"`
244-
PaidPrice string `json:"paidPrice"`
245-
Installment int `json:"installment"`
246-
PaymentID string `json:"paymentId"`
247-
FraudStatus int `json:"fraudStatus"`
248-
MerchantCommission string `json:"merchantCommissionRate"`
249-
IyziCommission string `json:"iyziCommissionRateAmount"`
250-
IyziCommissionFee string `json:"iyziCommissionFee"`
251-
CardType string `json:"cardType"`
252-
CardAssociation string `json:"cardAssociation"`
253-
CardFamily string `json:"cardFamily"`
254-
CardToken string `json:"cardToken"`
255-
CardUserKey string `json:"cardUserKey"`
256-
BinNumber string `json:"binNumber"`
257-
BasketID string `json:"basketId"`
258-
Currency string `json:"currency"`
259-
ItemTransactions []ItemTransaction `json:"itemTransactions"`
260-
ConnectorName string `json:"connectorName"`
261-
AuthCode string `json:"authCode"`
262-
Phase string `json:"phase"`
263-
LastFourDigits string `json:"lastFourDigits"`
264-
PosOrderID string `json:"posOrderId"`
265-
PaymentSource string `json:"paymentSource"`
266-
ErrorCode string `json:"errorCode"`
267-
ErrorMessage string `json:"errorMessage"`
268-
ErrorGroup string `json:"errorGroup"`
269-
Signature string `json:"signature"`
239+
Status string `json:"status"`
240+
Locale string `json:"locale"`
241+
SystemTime int64 `json:"systemTime"`
242+
ConversationID string `json:"conversationId"`
243+
Price string `json:"price"`
244+
PaidPrice string `json:"paidPrice"`
245+
Installment int `json:"installment"`
246+
PaymentID string `json:"paymentId"`
247+
FraudStatus int `json:"fraudStatus"`
248+
MerchantCommission string `json:"merchantCommissionRate"`
249+
IyziCommission string `json:"iyziCommissionRateAmount"`
250+
IyziCommissionFee string `json:"iyziCommissionFee"`
251+
CardType string `json:"cardType"`
252+
CardAssociation string `json:"cardAssociation"`
253+
CardFamily string `json:"cardFamily"`
254+
CardToken string `json:"cardToken"`
255+
CardUserKey string `json:"cardUserKey"`
256+
BinNumber string `json:"binNumber"`
257+
BasketID string `json:"basketId"`
258+
Currency string `json:"currency"`
259+
ItemTransactions []ItemTransaction `json:"itemTransactions"`
260+
ConnectorName string `json:"connectorName"`
261+
AuthCode string `json:"authCode"`
262+
Phase string `json:"phase"`
263+
LastFourDigits string `json:"lastFourDigits"`
264+
PosOrderID string `json:"posOrderId"`
265+
PaymentSource string `json:"paymentSource"`
266+
ErrorCode string `json:"errorCode"`
267+
ErrorMessage string `json:"errorMessage"`
268+
ErrorGroup string `json:"errorGroup"`
269+
Signature string `json:"signature"`
270270
}
271271

272272
// ItemTransaction represents item transaction
273273
type ItemTransaction struct {
274-
ItemID string `json:"itemId"`
275-
PaymentTransactionID string `json:"paymentTransactionId"`
276-
TransactionStatus int `json:"transactionStatus"`
277-
Price string `json:"price"`
278-
PaidPrice string `json:"paidPrice"`
279-
MerchantCommissionRate string `json:"merchantCommissionRate"`
280-
MerchantCommissionRateAmount string `json:"merchantCommissionRateAmount"`
281-
IyziCommissionRateAmount string `json:"iyziCommissionRateAmount"`
282-
IyziCommissionFee string `json:"iyziCommissionFee"`
283-
BlockageRate string `json:"blockageRate"`
284-
BlockageRateAmountMerchant string `json:"blockageRateAmountMerchant"`
285-
BlockageRateAmountSubMerchant string `json:"blockageRateAmountSubMerchant"`
286-
BlockageResolvedDate string `json:"blockageResolvedDate"`
287-
SubMerchantKey string `json:"subMerchantKey"`
288-
SubMerchantPrice string `json:"subMerchantPrice"`
289-
SubMerchantPayoutRate string `json:"subMerchantPayoutRate"`
290-
SubMerchantPayoutAmount string `json:"subMerchantPayoutAmount"`
291-
MerchantPayoutAmount string `json:"merchantPayoutAmount"`
292-
ConvertedPayout ConvertedPayout `json:"convertedPayout"`
274+
ItemID string `json:"itemId"`
275+
PaymentTransactionID string `json:"paymentTransactionId"`
276+
TransactionStatus int `json:"transactionStatus"`
277+
Price string `json:"price"`
278+
PaidPrice string `json:"paidPrice"`
279+
MerchantCommissionRate string `json:"merchantCommissionRate"`
280+
MerchantCommissionRateAmount string `json:"merchantCommissionRateAmount"`
281+
IyziCommissionRateAmount string `json:"iyziCommissionRateAmount"`
282+
IyziCommissionFee string `json:"iyziCommissionFee"`
283+
BlockageRate string `json:"blockageRate"`
284+
BlockageRateAmountMerchant string `json:"blockageRateAmountMerchant"`
285+
BlockageRateAmountSubMerchant string `json:"blockageRateAmountSubMerchant"`
286+
BlockageResolvedDate string `json:"blockageResolvedDate"`
287+
SubMerchantKey string `json:"subMerchantKey"`
288+
SubMerchantPrice string `json:"subMerchantPrice"`
289+
SubMerchantPayoutRate string `json:"subMerchantPayoutRate"`
290+
SubMerchantPayoutAmount string `json:"subMerchantPayoutAmount"`
291+
MerchantPayoutAmount string `json:"merchantPayoutAmount"`
292+
ConvertedPayout ConvertedPayout `json:"convertedPayout"`
293293
}
294294

295295
// ConvertedPayout represents converted payout information
296296
type ConvertedPayout struct {
297-
PaidPrice string `json:"paidPrice"`
298-
IyziCommissionRateAmount string `json:"iyziCommissionRateAmount"`
299-
IyziCommissionFee string `json:"iyziCommissionFee"`
300-
BlockageRateAmountMerchant string `json:"blockageRateAmountMerchant"`
297+
PaidPrice string `json:"paidPrice"`
298+
IyziCommissionRateAmount string `json:"iyziCommissionRateAmount"`
299+
IyziCommissionFee string `json:"iyziCommissionFee"`
300+
BlockageRateAmountMerchant string `json:"blockageRateAmountMerchant"`
301301
BlockageRateAmountSubMerchant string `json:"blockageRateAmountSubMerchant"`
302302
SubMerchantPayoutAmount string `json:"subMerchantPayoutAmount"`
303303
MerchantPayoutAmount string `json:"merchantPayoutAmount"`
@@ -321,4 +321,4 @@ type BaseResponse struct {
321321
type APITestResponse struct {
322322
BaseResponse
323323
SystemTime int64 `json:"systemTime"`
324-
}
324+
}

requests.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ type CheckoutFormInitializeRequest struct {
3838
Currency string `json:"currency"`
3939
BasketID string `json:"basketId"`
4040
PaymentGroup string `json:"paymentGroup"`
41-
CallbackURL string `json:"callbackUrl"`
41+
CallbackURL string `json:"callbackUrl,omitempty"`
4242
EnabledInstallments []int `json:"enabledInstallments"`
4343
Buyer *Buyer `json:"buyer"`
4444
ShippingAddress *Address `json:"shippingAddress"`
@@ -243,7 +243,7 @@ type BKMInitializeRequest struct {
243243
ShippingAddress *Address `json:"shippingAddress"`
244244
BillingAddress *Address `json:"billingAddress"`
245245
BasketItems []BasketItem `json:"basketItems"`
246-
CallbackURL string `json:"callbackUrl"`
246+
CallbackURL string `json:"callbackUrl,omitempty"`
247247
PaymentSource string `json:"paymentSource"`
248248
EnabledInstallments []BkmInstallment `json:"enabledInstallments"`
249249
}
@@ -253,7 +253,7 @@ type BasicBKMInitializeRequest struct {
253253
Locale string `json:"locale"`
254254
ConversationID string `json:"conversationId"`
255255
Price string `json:"price"`
256-
CallbackURL string `json:"callbackUrl"`
256+
CallbackURL string `json:"callbackUrl,omitempty"`
257257
BuyerEmail string `json:"buyerEmail"`
258258
BuyerID string `json:"buyerId"`
259259
BuyerIP string `json:"buyerIp"`
@@ -443,7 +443,7 @@ type RefundToBalanceRequest struct {
443443
PaymentTransactionID string `json:"paymentTransactionId"`
444444
Price string `json:"price"`
445445
Currency string `json:"currency"`
446-
CallbackURL string `json:"callbackUrl"`
446+
CallbackURL string `json:"callbackUrl,omitempty"`
447447
}
448448

449449
// RefundToBalanceResponse represents refund to balance response
@@ -462,7 +462,7 @@ type SettlementToBalanceRequest struct {
462462
SubMerchantKey string `json:"subMerchantKey"`
463463
Price string `json:"price"`
464464
Currency string `json:"currency"`
465-
CallbackURL string `json:"callbackUrl"`
465+
CallbackURL string `json:"callbackUrl,omitempty"`
466466
}
467467

468468
// SettlementToBalanceResponse represents settlement to balance response
@@ -480,7 +480,7 @@ type UniversalCardStorageInitializeRequest struct {
480480
Email string `json:"email"`
481481
GsmNumber string `json:"gsmNumber"`
482482
CardAlias string `json:"cardAlias"`
483-
CallbackURL string `json:"callbackUrl"`
483+
CallbackURL string `json:"callbackUrl,omitempty"`
484484
}
485485

486486
// UniversalCardStorageInitializeResponse represents universal card storage initialize response
@@ -574,7 +574,7 @@ type CreatePeccoInitializeRequest struct {
574574
Currency string `json:"currency"`
575575
BasketID string `json:"basketId"`
576576
PaymentGroup string `json:"paymentGroup"`
577-
CallbackURL string `json:"callbackUrl"`
577+
CallbackURL string `json:"callbackUrl,omitempty"`
578578
PaymentSource string `json:"paymentSource"`
579579
Buyer *Buyer `json:"buyer"`
580580
ShippingAddress *Address `json:"shippingAddress"`
@@ -629,7 +629,7 @@ type SubscriptionCheckoutFormRequest struct {
629629
ConversationID string `json:"conversationId"`
630630
PricingPlanReferenceCode string `json:"pricingPlanReferenceCode"`
631631
CustomerReferenceCode string `json:"customerReferenceCode"`
632-
CallbackURL string `json:"callbackUrl"`
632+
CallbackURL string `json:"callbackUrl,omitempty"`
633633
Customer *SubscriptionCustomer `json:"customer"`
634634
SubscriptionInitialStatus string `json:"subscriptionInitialStatus"`
635635
}
@@ -638,6 +638,6 @@ type SubscriptionCheckoutFormRequest struct {
638638
type SubscriptionCardUpdateRequest struct {
639639
Locale string `json:"locale"`
640640
ConversationID string `json:"conversationId"`
641-
CallbackURL string `json:"callbackUrl"`
641+
CallbackURL string `json:"callbackUrl,omitempty"`
642642
SubscriptionReferenceCode string `json:"subscriptionReferenceCode"`
643643
}

0 commit comments

Comments
 (0)