-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmodel_card.go
114 lines (101 loc) · 3.96 KB
/
model_card.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
Cashfree Payment Gateway APIs
Cashfree's Payment Gateway APIs provide developers with a streamlined pathway to integrate advanced payment processing capabilities into their applications, platforms and websites.
API version: 2023-08-01
Contact: [email protected]
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package cashfree_pg
import (
"encoding/json"
"strings"
)
// checks if the Card type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &Card{}
// Card Card Payment method
type Card struct {
// The channel for card payments can be \"link\" or \"post\". Post is used for seamless OTP payments where merchant captures OTP on their own page.
Channel string `json:"channel"`
// Customer card number for plain card transactions. Token pan number for tokenized card transactions.
CardNumber *string `json:"card_number,omitempty"`
// Customer name mentioned on the card.
CardHolderName *string `json:"card_holder_name,omitempty"`
// Card expiry month for plain card transactions. Token expiry month for tokenized card transactions.
CardExpiryMm *string `json:"card_expiry_mm,omitempty"`
// Card expiry year for plain card transactions. Token expiry year for tokenized card transactions.
CardExpiryYy *string `json:"card_expiry_yy,omitempty"`
// CVV mentioned on the card.
CardCvv *string `json:"card_cvv,omitempty"`
// instrument id of saved card. Required only to make payment using saved instrument.
InstrumentId *string `json:"instrument_id,omitempty"`
// cryptogram received from card network. Required only for tokenized card transactions.
Cryptogram *string `json:"cryptogram,omitempty"`
// TRID issued by card networks. Required only for tokenized card transactions.
TokenRequestorId *string `json:"token_requestor_id,omitempty"`
// Token Reference Id provided by Diners for Guest Checkout Token. Required only for Diners cards.
TokenReferenceId *string `json:"token_reference_id,omitempty"`
TokenType *string `json:"token_type,omitempty"`
// last 4 digits of original card number. Required only for tokenized card transactions.
CardDisplay *string `json:"card_display,omitempty"`
// Card alias as returned by Cashfree Vault API.
CardAlias *string `json:"card_alias,omitempty"`
// One of [\"Kotak\", \"ICICI\", \"RBL\", \"BOB\", \"Standard Chartered\"]. Card bank name, required for EMI payments. This is the bank user has selected for EMI
CardBankName *string `json:"card_bank_name,omitempty"`
// EMI tenure selected by the user
EmiTenure *int32 `json:"emi_tenure,omitempty"`
}
func (o Card) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o Card) ToMap() (map[string]interface{}, error) {
strings.HasPrefix("cf", "cf")
toSerialize := map[string]interface{}{}
toSerialize["channel"] = o.Channel
if !IsNil(o.CardNumber) {
toSerialize["card_number"] = o.CardNumber
}
if !IsNil(o.CardHolderName) {
toSerialize["card_holder_name"] = o.CardHolderName
}
if !IsNil(o.CardExpiryMm) {
toSerialize["card_expiry_mm"] = o.CardExpiryMm
}
if !IsNil(o.CardExpiryYy) {
toSerialize["card_expiry_yy"] = o.CardExpiryYy
}
if !IsNil(o.CardCvv) {
toSerialize["card_cvv"] = o.CardCvv
}
if !IsNil(o.InstrumentId) {
toSerialize["instrument_id"] = o.InstrumentId
}
if !IsNil(o.Cryptogram) {
toSerialize["cryptogram"] = o.Cryptogram
}
if !IsNil(o.TokenRequestorId) {
toSerialize["token_requestor_id"] = o.TokenRequestorId
}
if !IsNil(o.TokenReferenceId) {
toSerialize["token_reference_id"] = o.TokenReferenceId
}
if !IsNil(o.TokenType) {
toSerialize["token_type"] = o.TokenType
}
if !IsNil(o.CardDisplay) {
toSerialize["card_display"] = o.CardDisplay
}
if !IsNil(o.CardAlias) {
toSerialize["card_alias"] = o.CardAlias
}
if !IsNil(o.CardBankName) {
toSerialize["card_bank_name"] = o.CardBankName
}
if !IsNil(o.EmiTenure) {
toSerialize["emi_tenure"] = o.EmiTenure
}
return toSerialize, nil
}