Skip to content

Commit 3444781

Browse files
authored
Merge pull request #97 from GianniTie/feature/add-cbp-support
[Feature] Add cbp support
2 parents 822ff6a + facc98a commit 3444781

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

pkg/payment/request.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ type Request struct {
1616
PaymentMethod *PaymentMethodRequest `json:"payment_method,omitempty"`
1717
DateOfExpiration *time.Time `json:"date_of_expiration,omitempty"`
1818
Taxes []TaxRequest `json:"taxes,omitempty"`
19+
Amounts *AmountsRequest `json:"amounts,omitempty"`
20+
CounterCurrency *CounterCurrencyRequest `json:"counter_currency,omitempty"`
1921

2022
CallbackURL string `json:"callback_url,omitempty"`
2123
CouponCode string `json:"coupon_code,omitempty"`
@@ -326,3 +328,20 @@ type TaxRequest struct {
326328
Value float64 `json:"value,omitempty"`
327329
Percentage bool `json:"percentage,omitempty"`
328330
}
331+
332+
// AmountsRequest represents amounts request within Request.
333+
type AmountsRequest struct {
334+
Collector UserAmountsRequest `json:"collector,omitempty"`
335+
Payer UserAmountsRequest `json:"payer,omitempty"`
336+
}
337+
338+
// UserAmountsRequest represents user amounts request within AmountsRequest.
339+
type UserAmountsRequest struct {
340+
CurrencyID string `json:"currency_id,omitempty"`
341+
Transaction float64 `json:"transaction,omitempty"`
342+
}
343+
344+
// CounterCurrencyRequest represents counter currency request within Request.
345+
type CounterCurrencyRequest struct {
346+
CurrencyID string `json:"currency_id,omitempty"`
347+
}

pkg/payment/response.go

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ type Response struct {
2525
FeeDetails []FeeDetailResponse `json:"fee_details"`
2626
Taxes []TaxResponse `json:"taxes"`
2727
Refunds []RefundResponse `json:"refunds"`
28+
Amounts *AmountsResponse `json:"amounts,omitempty"`
29+
CounterCurrency *CounterCurrencyResponse `json:"counter_currency,omitempty"`
2830

2931
DifferentialPricingID int `json:"differential_pricing_id"`
3032
MoneyReleaseSchema string `json:"money_release_schema"`
@@ -51,7 +53,6 @@ type Response struct {
5153
PosID string `json:"pos_id"`
5254
StoreID string `json:"store_id"`
5355
DeductionSchema string `json:"deduction_schema"`
54-
CounterCurrency string `json:"counter_currency"`
5556
CallForAuthorizeID string `json:"call_for_authorize_id"`
5657
StatementDescriptor string `json:"statement_descriptor"`
5758
MoneyReleaseStatus string `json:"money_release_status"`
@@ -428,3 +429,31 @@ type GatewayResponse struct {
428429
type ReferenceResponse struct {
429430
NetworkTransactionID string `json:"network_transaction_id,omitempty"`
430431
}
432+
433+
// AmountsResponse represents amounts response.
434+
type AmountsResponse struct {
435+
Collector CollectorAmountResponse `json:"collector,omitempty"`
436+
Payer PayerAmountResponse `json:"payer,omitempty"`
437+
}
438+
439+
// PayerAmountResponse represents payer amounts response.
440+
type PayerAmountResponse struct {
441+
CurrencyID string `json:"currency_id,omitempty"`
442+
Transaction float64 `json:"transaction,omitempty"`
443+
TotalPaid float64 `json:"total_paid,omitempty"`
444+
}
445+
446+
// CollectorAmountResponse represents collector amounts response.
447+
type CollectorAmountResponse struct {
448+
CurrencyID string `json:"currency_id,omitempty"`
449+
Transaction float64 `json:"transaction,omitempty"`
450+
NetReceived float64 `json:"net_received,omitempty"`
451+
}
452+
453+
// CounterCurrencyResponse represents counter currency response.
454+
type CounterCurrencyResponse struct {
455+
CurrencyID string `json:"currency_id,omitempty"`
456+
Rate float64 `json:"rate,omitempty"`
457+
Amount float64 `json:"amount,omitempty"`
458+
AmountRefunded float64 `json:"amount_refunded,omitempty"`
459+
}

pkg/preference/request.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ type Request struct {
1717
Items []ItemRequest `json:"items,omitempty"`
1818
Taxes []TaxRequest `json:"taxes,omitempty"`
1919
Tracks []TrackRequest `json:"tracks,omitempty"`
20+
Amounts *AmountsRequest `json:"amounts,omitempty"`
21+
CounterCurrency *CounterCurrencyRequest `json:"counter_currency,omitempty"`
2022

2123
AdditionalInfo string `json:"additional_info,omitempty"`
2224
AutoReturn string `json:"auto_return,omitempty"`
@@ -193,3 +195,20 @@ type ValuesRequest struct {
193195
ConversionLabel string `json:"conversion_label,omitempty"`
194196
PixelID string `json:"pixel_id,omitempty"`
195197
}
198+
199+
// AmountsRequest represents amounts request within Request.
200+
type AmountsRequest struct {
201+
Collector UserAmountsRequest `json:"collector,omitempty"`
202+
Payer UserAmountsRequest `json:"payer,omitempty"`
203+
}
204+
205+
// UserAmountsRequest represents user amounts request within AmountsRequest.
206+
type UserAmountsRequest struct {
207+
CurrencyID string `json:"currency_id,omitempty"`
208+
Transaction float64 `json:"transaction,omitempty"`
209+
}
210+
211+
// CounterCurrencyRequest represents counter currency request within Request.
212+
type CounterCurrencyRequest struct {
213+
CurrencyID string `json:"currency_id,omitempty"`
214+
}

pkg/preference/response.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ type Response struct {
1919
Taxes []TaxResponse `json:"taxes"`
2020
Tracks []TrackResponse `json:"tracks"`
2121
Items []ItemResponse `json:"items"`
22+
Amounts *AmountsResponse `json:"amounts,omitempty"`
23+
CounterCurrency *CounterCurrencyResponse `json:"counter_currency,omitempty"`
2224

2325
ID string `json:"id"`
2426
ClientID string `json:"client_id"`
@@ -184,3 +186,20 @@ type AddressResponse struct {
184186
StreetName string `json:"street_name"`
185187
StreetNumber string `json:"street_number"`
186188
}
189+
190+
// AmountsResponse represents amounts response.
191+
type AmountsResponse struct {
192+
Collector UserAmountsResponse `json:"collector,omitempty"`
193+
Payer UserAmountsResponse `json:"payer,omitempty"`
194+
}
195+
196+
// UserAmountsResponse represents user amounts response.
197+
type UserAmountsResponse struct {
198+
CurrencyID string `json:"currency_id,omitempty"`
199+
Transaction float64 `json:"transaction,omitempty"`
200+
}
201+
202+
// CounterCurrencyResponse represents counter currency response.
203+
type CounterCurrencyResponse struct {
204+
CurrencyID string `json:"currency_id,omitempty"`
205+
}

0 commit comments

Comments
 (0)