-
Notifications
You must be signed in to change notification settings - Fork 5
/
model_create_order_request.go
83 lines (70 loc) · 2.94 KB
/
model_create_order_request.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
/*
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 CreateOrderRequest type satisfies the MappedNullable interface at compile time
var _ MappedNullable = &CreateOrderRequest{}
// CreateOrderRequest Request body to create an order at cashfree
type CreateOrderRequest struct {
// Order identifier present in your system. Alphanumeric, '_' and '-' only
OrderId *string `json:"order_id,omitempty"`
// Bill amount for the order. Provide upto two decimals. 10.15 means Rs 10 and 15 paisa
OrderAmount float64 `json:"order_amount"`
// Currency for the order. INR if left empty. Contact [email protected] to enable new currencies.
OrderCurrency string `json:"order_currency"`
CustomerDetails CustomerDetails `json:"customer_details"`
Terminal *TerminalDetails `json:"terminal,omitempty"`
OrderMeta *OrderMeta `json:"order_meta,omitempty"`
// Time after which the order expires. Customers will not be able to make the payment beyond the time specified here. We store timestamps in IST, but you can provide them in a valid ISO 8601 time format. Example 2021-07-02T10:20:12+05:30 for IST, 2021-07-02T10:20:12Z for UTC
OrderExpiryTime *string `json:"order_expiry_time,omitempty"`
// Order note for reference.
OrderNote *string `json:"order_note,omitempty"`
// Custom Tags in thr form of {\"key\":\"value\"} which can be passed for an order. A maximum of 10 tags can be added
OrderTags *map[string]string `json:"order_tags,omitempty"`
// If you have Easy split enabled in your Cashfree account then you can use this option to split the order amount.
OrderSplits []VendorSplit `json:"order_splits,omitempty"`
}
func (o CreateOrderRequest) MarshalJSON() ([]byte, error) {
toSerialize,err := o.ToMap()
if err != nil {
return []byte{}, err
}
return json.Marshal(toSerialize)
}
func (o CreateOrderRequest) ToMap() (map[string]interface{}, error) {
strings.HasPrefix("cf", "cf")
toSerialize := map[string]interface{}{}
if !IsNil(o.OrderId) {
toSerialize["order_id"] = o.OrderId
}
toSerialize["order_amount"] = o.OrderAmount
toSerialize["order_currency"] = o.OrderCurrency
toSerialize["customer_details"] = o.CustomerDetails
if !IsNil(o.Terminal) {
toSerialize["terminal"] = o.Terminal
}
if !IsNil(o.OrderMeta) {
toSerialize["order_meta"] = o.OrderMeta
}
if !IsNil(o.OrderExpiryTime) {
toSerialize["order_expiry_time"] = o.OrderExpiryTime
}
if !IsNil(o.OrderNote) {
toSerialize["order_note"] = o.OrderNote
}
if !IsNil(o.OrderTags) {
toSerialize["order_tags"] = o.OrderTags
}
if !IsNil(o.OrderSplits) {
toSerialize["order_splits"] = o.OrderSplits
}
return toSerialize, nil
}