-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathmodel_create_order_request.go
More file actions
95 lines (82 loc) · 3.62 KB
/
Copy pathmodel_create_order_request.go
File metadata and controls
95 lines (82 loc) · 3.62 KB
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
/*
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: 2026-01-01
Contact: developers@cashfree.com
*/
// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT.
package cashfree_pg
import (
"encoding/json"
"fmt"
"strings"
)
var _ = fmt.Errorf
// 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. For orders in non-INR currency, please refer to [supported amounts](https://www.cashfree.com/docs/payments/international-payments/ipg/currencies-supported#decimal-support) per currency.
OrderAmount float64 `json:"order_amount"`
// Currency for the order. INR if left empty. For support currency list, refer [here](https://www.cashfree.com/docs/payments/international-payments/ipg/currencies-supported#full-currency-list). Submit [Support Form](https://merchant.cashfree.com/auth/login) to enable new currencies.
OrderCurrency string `json:"order_currency"`
CartDetails *CartDetails `json:"cart_details,omitempty"`
CustomerDetails *CustomerDetails `json:"customer_details,omitempty"`
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 the 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"`
Products *Products `json:"products,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
if !IsNil(o.CartDetails) {
toSerialize["cart_details"] = o.CartDetails
}
if !IsNil(o.CustomerDetails) {
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
}
if !IsNil(o.Products) {
toSerialize["products"] = o.Products
}
return toSerialize, nil
}