| 1 |  |  | package mollie | 
            
                                                                                                            
                            
            
                                    
            
            
                | 2 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 3 |  |  | import ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 4 |  |  | 	"encoding/json" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 5 |  |  | 	"fmt" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 6 |  |  | 	"net/http" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 7 |  |  | 	"time" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 8 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 9 |  |  | 	"github.com/google/go-querystring/query" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 10 |  |  | ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 11 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 12 |  |  | // Orders explain the items that customers need to pay for. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 13 |  |  | type Orders struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 14 |  |  | 	Resource            string         `json:"resource,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 15 |  |  | 	ID                  string         `json:"id,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 16 |  |  | 	ProfileID           string         `json:"profileId,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 17 |  |  | 	Method              *PaymentMethod `json:"method,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 18 |  |  | 	Mode                *Mode          `json:"mode,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 19 |  |  | 	Amount              *Amount        `json:"amount,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 20 |  |  | 	AmountCaptured      *Amount        `json:"amountCaptured,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 21 |  |  | 	AmountRefunded      *Amount        `json:"amountRefunded,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 22 |  |  | 	Status              *OrderStatus   `json:"status,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 23 |  |  | 	IsCancelable        bool           `json:"isCancelable,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 24 |  |  | 	BillingAddress      *OrderAddress  `json:"billingAddress,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 25 |  |  | 	ConsumerDateOfBirth *ShortDate     `json:"consumerDateOfBirth,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 26 |  |  | 	OrderNumber         string         `json:"orderNumber,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 27 |  |  | 	ShippingAddress     *OrderAddress  `json:"shippingAddress,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 28 |  |  | 	Locale              *Locale        `json:"locale,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 29 |  |  | 	Metadata            interface{}    `json:"metadata,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 30 |  |  | 	RedirectURL         string         `json:"redirectUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 31 |  |  | 	Lines               []*OrderLines  `json:"lines,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 32 |  |  | 	WebhookURL          string         `json:"webhookUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 33 |  |  | 	CreatedAt           *time.Time     `json:"createdAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 34 |  |  | 	ExpiresAt           *time.Time     `json:"expiresAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 35 |  |  | 	ExpiredAt           *time.Time     `json:"expiredAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 36 |  |  | 	PaidAt              *time.Time     `json:"paidAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 37 |  |  | 	AuthorizedAt        *time.Time     `json:"authorizedAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 38 |  |  | 	CanceledAt          *time.Time     `json:"canceledAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 39 |  |  | 	CompletedAt         *time.Time     `json:"completedAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 40 |  |  | 	Embedded            struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 41 |  |  | 		Payments []Payment `json:"payments,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 42 |  |  | 		Refunds  []Refund  `json:"refunds,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 43 |  |  | 	} `json:"_embedded,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 44 |  |  | 	Links        *OrderLinks   `json:"_links,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 45 |  |  | 	OrderPayment *OrderPayment `json:"payment,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 46 |  |  | 	Description  string        `json:"description,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 47 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 48 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 49 |  |  | // OrderPayment describes payment specific parameters that can be passed during order creation | 
            
                                                                                                            
                            
            
                                    
            
            
                | 50 |  |  | type OrderPayment struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 51 |  |  | 	ConsumerAccount   string          `json:"consumerAccount,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 52 |  |  | 	CustomerID        string          `json:"customerId,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 53 |  |  | 	CustomerReference string          `json:"customerReference,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 54 |  |  | 	Issuer            string          `json:"issuer,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 55 |  |  | 	MandateID         string          `json:"mandateId,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 56 |  |  | 	SequenceType      *SequenceType   `json:"sequenceType,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 57 |  |  | 	VoucherNumber     string          `json:"voucherNumber,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 58 |  |  | 	VoucherPin        string          `json:"voucherPin,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 59 |  |  | 	WebhookURL        string          `json:"webhookUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 60 |  |  | 	ApplicationFee    *ApplicationFee `json:"applicationFee,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 61 |  |  | 	Method            *PaymentMethod  `json:"method,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 62 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 63 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 64 |  |  | // OrderStatus describes the valid order status. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 65 |  |  | type OrderStatus string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 66 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 67 |  |  | // Valid order status. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 68 |  |  | const ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 69 |  |  | 	Created    OrderStatus = "created" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 70 |  |  | 	Paid       OrderStatus = "paid" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 71 |  |  | 	Authorized OrderStatus = "authorized" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 72 |  |  | 	Canceled   OrderStatus = "canceled" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 73 |  |  | 	Shipping   OrderStatus = "shipping" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 74 |  |  | 	Completed  OrderStatus = "completed" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 75 |  |  | 	Expired    OrderStatus = "expired" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 76 |  |  | ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 77 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 78 |  |  | // OrderAddress identify both the address and the person the order is billed or shipped to. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 79 |  |  | type OrderAddress struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 80 |  |  | 	OrganizationName string       `json:"organizationName,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 81 |  |  | 	Title            string       `json:"title,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 82 |  |  | 	GivenName        string       `json:"givenName,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 83 |  |  | 	FamilyName       string       `json:"familyName,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 84 |  |  | 	Email            string       `json:"email,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 85 |  |  | 	Phone            *PhoneNumber `json:"phone,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 86 |  |  | 	StreetAndNumber  string       `json:"streetAndNumber,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 87 |  |  | 	StreetAdditional string       `json:"streetAdditional,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 88 |  |  | 	PostalCode       string       `json:"postalCode,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 89 |  |  | 	City             string       `json:"city,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 90 |  |  | 	Region           string       `json:"region,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 91 |  |  | 	Country          string       `json:"country,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 92 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 93 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 94 |  |  | // OrderLinks describes an object with several URL objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 95 |  |  | // relevant to the order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 96 |  |  | // Every URL object will contain an href and a type field. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 97 |  |  | type OrderLinks struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 98 |  |  | 	Self          *URL `json:"self,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 99 |  |  | 	Checkout      *URL `json:"checkout,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 100 |  |  | 	Documentation *URL `json:"documentation,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 101 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 102 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 103 |  |  | // OrderListLinks describes an object with several URL objects | 
            
                                                                                                            
                            
            
                                    
            
            
                | 104 |  |  | // relevant to the order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 105 |  |  | // Every URL object will contain an href and a type field. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 106 |  |  | type OrderListLinks struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 107 |  |  | 	Self          *URL `json:"self,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 108 |  |  | 	Previous      *URL `json:"previous,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 109 |  |  | 	Next          *URL `json:"next,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 110 |  |  | 	Documentation *URL `json:"documentation,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 111 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 112 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 113 |  |  | // OrderLines contain the actual things the customer bought. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 114 |  |  | type OrderLines struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 115 |  |  | 	Resource           string           `json:"resource,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 116 |  |  | 	ID                 string           `json:"id,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 117 |  |  | 	OrderID            string           `json:"orderId,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 118 |  |  | 	ProductType        *ProductType     `json:"type,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 119 |  |  | 	Name               string           `json:"name,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 120 |  |  | 	Amount             *Amount          `json:"amount,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 121 |  |  | 	Status             *OrderLineStatus `json:"status,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 122 |  |  | 	IsCancelable       bool             `json:"isCancelable,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 123 |  |  | 	Quantity           int              `json:"quantity,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 124 |  |  | 	QuantityShipped    int              `json:"quantityShipped,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 125 |  |  | 	AmountShipped      *Amount          `json:"amountShipped,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 126 |  |  | 	QuantityRefunded   int              `json:"quantityRefunded,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 127 |  |  | 	AmountRefunded     *Amount          `json:"amountRefunded,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 128 |  |  | 	QuantityCanceled   int              `json:"quantityCanceled,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 129 |  |  | 	AmountCanceled     *Amount          `json:"amountCanceled,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 130 |  |  | 	ShippableQuantity  int              `json:"shippableQuantity,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 131 |  |  | 	RefundableQuantity int              `json:"refundableQuantity,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 132 |  |  | 	CancelableQuantity int              `json:"cancelableQuantity,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 133 |  |  | 	UnitPrice          *Amount          `json:"unitPrice,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 134 |  |  | 	DiscountAmount     *Amount          `json:"discountAmount,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 135 |  |  | 	TotalAmount        *Amount          `json:"totalAmount,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 136 |  |  | 	VatRate            string           `json:"vatRate,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 137 |  |  | 	VatAmount          *Amount          `json:"vatAmount,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 138 |  |  | 	SKU                string           `json:"sku,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 139 |  |  | 	CreatedAt          *time.Time       `json:"createdAt,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 140 |  |  | 	Links              *OrderLineLinks  `json:"_links,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 141 |  |  | 	ImageURL           string           `json:"imageUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 142 |  |  | 	ProductURL         string           `json:"productUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 143 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 144 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 145 |  |  | // OrderList for containing the response of list orders | 
            
                                                                                                            
                            
            
                                    
            
            
                | 146 |  |  | type OrderList struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 147 |  |  | 	Count    int `json:"count,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 148 |  |  | 	Embedded struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 149 |  |  | 		Orders []Orders `json:"orders,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 150 |  |  | 	} `json:"_embedded,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 151 |  |  | 	Links OrderListLinks `json:"links,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 152 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 153 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 154 |  |  | // OrderListRefund for containing the response of list orders | 
            
                                                                                                            
                            
            
                                    
            
            
                | 155 |  |  | type OrderListRefund struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 156 |  |  | 	Count    int `json:"count,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 157 |  |  | 	Embedded struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 158 |  |  | 		Refunds []Refund `json:"refund,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 159 |  |  | 	} `json:"_embedded,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 160 |  |  | 	Links OrderListLinks `json:"links,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 161 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 162 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 163 |  |  | // ProductType describes the type of product bought, for example, a physical or a digital product. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 164 |  |  | type ProductType string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 165 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 166 |  |  | // Valid product type. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 167 |  |  | const ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 168 |  |  | 	Physical        ProductType = "physical" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 169 |  |  | 	Discount        ProductType = "discount" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 170 |  |  | 	Digital         ProductType = "digital" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 171 |  |  | 	ShippingFee     ProductType = "shipping_fee" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 172 |  |  | 	StoreCredit     ProductType = "store_credit" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 173 |  |  | 	GiftCardProduct ProductType = "gift_card" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 174 |  |  | 	Surcharge       ProductType = "surcharge" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 175 |  |  | ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 176 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 177 |  |  | // OrderLineStatus describes status of the order line. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 178 |  |  | type OrderLineStatus string | 
            
                                                                                                            
                            
            
                                    
            
            
                | 179 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 180 |  |  | // Valid order line status. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 181 |  |  | const ( | 
            
                                                                                                            
                            
            
                                    
            
            
                | 182 |  |  | 	OrderLineCreated    OrderLineStatus = "created" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 183 |  |  | 	OrderLineAuthorized OrderLineStatus = "authorized" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 184 |  |  | 	OrderLinePaid       OrderLineStatus = "paid" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 185 |  |  | 	OrderLineShipping   OrderLineStatus = "shipping" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 186 |  |  | 	OrderLineCanceled   OrderLineStatus = "canceled" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 187 |  |  | 	OrderLineCompleted  OrderLineStatus = "completed" | 
            
                                                                                                            
                            
            
                                    
            
            
                | 188 |  |  | ) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 189 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 190 |  |  | // OrderLineLinks describes object with several URL objects relevant to the order line. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 191 |  |  | type OrderLineLinks struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 192 |  |  | 	ProductURL *URL `json:"productUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 193 |  |  | 	ImageURL   *URL `json:"imageUrl,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 194 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 195 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 196 |  |  | // OrderOptions describes order endpoint valid query string parameters. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 197 |  |  | // See: https://docs.mollie.com/reference/v2/orders-api/get-order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 198 |  |  | type OrderOptions struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 199 |  |  | 	Embed     []EmbedValue `url:"embed,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 200 |  |  | 	ProfileID string       `url:"profileId,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 201 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 202 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 203 |  |  | // OrderListOptions describes order endpoint valid query string parameters. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 204 |  |  | // See: https://docs.mollie.com/reference/v2/orders-api/list-orders. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 205 |  |  | type OrderListOptions struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 206 |  |  | 	ProfileID string `url:"profileId,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 207 |  |  | 	From      string `url:"from,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 208 |  |  | 	Limit     int    `url:"limit,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 209 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 210 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 211 |  |  | // OrderListRefundOptions describes order endpoint valid query string parameters. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 212 |  |  | // See: https://docs.mollie.com/reference/v2/orders-api/list-orders. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 213 |  |  | type OrderListRefundOptions struct { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 214 |  |  | 	From  string     `url:"from,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 215 |  |  | 	Limit int        `url:"limit,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 216 |  |  | 	Embed EmbedValue `url:"embed,omitempty"` | 
            
                                                                                                            
                            
            
                                    
            
            
                | 217 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 218 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 219 |  |  | // OrdersService instance operates over refund resources. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 220 |  |  | type OrdersService service | 
            
                                                                                                            
                            
            
                                    
            
            
                | 221 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 222 |  |  | // Get retrieve a single order by its ID. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 223 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/get-order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 224 |  |  | func (ors *OrdersService) Get(orID string, opt *OrderOptions) (order Orders, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 225 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s", orID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 226 | 1 |  | 	if opt != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 227 | 1 |  | 		v, _ := query.Values(opt) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 228 | 1 |  | 		u = fmt.Sprintf("%s?%s", u, v.Encode()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 229 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 230 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 231 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodGet, u, nil) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 232 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 233 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 234 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 235 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 236 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 237 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 238 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 239 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 240 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 241 | 1 |  | 	if err = json.Unmarshal(res.content, &order); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 242 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 243 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 244 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 245 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 246 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 247 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 248 |  |  | // Create an order will automatically create the required payment to allow your customer to pay for the order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 249 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/create-order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 250 |  |  | func (ors *OrdersService) Create(ord Orders, opt *OrderOptions) (order Orders, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 251 | 1 |  | 	u := fmt.Sprintf("v2/orders") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 252 | 1 |  | 	if opt != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 253 | 1 |  | 		v, _ := query.Values(opt) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 254 | 1 |  | 		u = fmt.Sprintf("%s?%s", u, v.Encode()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 255 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 256 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 257 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodPost, u, ord) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 258 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 259 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 260 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 261 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 262 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 263 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 264 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 265 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 266 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 267 | 1 |  | 	if err = json.Unmarshal(res.content, &order); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 268 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 269 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 270 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 271 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 272 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 273 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 274 |  |  | // Update is used to update the billing and/or shipping address of an order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 275 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/update-order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 276 |  |  | func (ors *OrdersService) Update(orderID string, ord Orders) (order Orders, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 277 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s", orderID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 278 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 279 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodPatch, u, ord) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 280 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 281 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 282 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 283 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 284 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 285 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 286 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 287 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 288 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 289 | 1 |  | 	if err = json.Unmarshal(res.content, &order); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 290 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 291 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 292 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 293 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 294 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 295 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 296 |  |  | // Cancel try to cancel the order that fulfill certain requirements | 
            
                                                                                                            
                            
            
                                    
            
            
                | 297 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/cancel-order | 
            
                                                                                                            
                            
            
                                    
            
            
                | 298 |  |  | func (ors *OrdersService) Cancel(orderID string) (order Orders, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 299 | 1 |  | 	u := fmt.Sprintf("v2/orders/" + orderID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 300 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 301 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodDelete, u, nil) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 302 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 303 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 304 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 305 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 306 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 307 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 308 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 309 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 310 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 311 | 1 |  | 	if err = json.Unmarshal(res.content, &order); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 312 |  |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 313 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 314 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 315 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 316 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 317 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 318 |  |  | // List is to retrieve all orders. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 319 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/list-orders | 
            
                                                                                                            
                            
            
                                    
            
            
                | 320 |  |  | func (ors *OrdersService) List(opt *OrderListOptions) (ordList OrderList, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 321 | 1 |  | 	u := fmt.Sprintf("v2/orders") | 
            
                                                                                                            
                            
            
                                    
            
            
                | 322 | 1 |  | 	if opt != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 323 | 1 |  | 		v, _ := query.Values(opt) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 324 | 1 |  | 		u = fmt.Sprintf("%s?%s", u, v.Encode()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 325 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 326 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 327 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodGet, u, nil) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 328 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 329 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 330 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 331 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 332 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 333 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 334 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 335 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 336 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 337 | 1 |  | 	if err = json.Unmarshal(res.content, &ordList); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 338 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 339 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 340 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 341 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 342 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 343 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 344 |  |  | // UpdateOrderline can be used to update an order line. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 345 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/update-orderline | 
            
                                                                                                            
                            
            
                                    
            
            
                | 346 |  |  | func (ors *OrdersService) UpdateOrderline(orderID string, orderlineID string, orderline OrderLines) (order Orders, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 347 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s/lines/%s", orderID, orderlineID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 348 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 349 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodPatch, u, nil) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 350 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 351 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 352 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 353 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 354 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 355 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 356 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 357 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 358 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 359 | 1 |  | 	if err = json.Unmarshal(res.content, &order); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 360 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 361 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 362 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 363 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 364 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 365 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 366 |  |  | // CancelOrderLine can be used to cancel one or more order lines | 
            
                                                                                                            
                            
            
                                    
            
            
                | 367 |  |  | // that were previously authorized using a pay after delivery payment method. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 368 |  |  | // Use the Cancel Order API if you want to cancel the entire order or the remainder of the order. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 369 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/cancel-order-lines | 
            
                                                                                                            
                            
            
                                    
            
            
                | 370 |  |  | func (ors *OrdersService) CancelOrderLine(orderID string, orderlines *Orders) (errorResponse *ErrorResponse, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 371 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s/lines", orderID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 372 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 373 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodDelete, u, orderlines) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 374 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 375 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 376 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 377 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 378 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 379 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 380 | 1 |  | 		if len(res.content) != 0 { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 381 | 1 |  | 			err = json.Unmarshal(res.content, &errorResponse) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 382 | 1 |  | 			if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 383 | 1 |  | 				return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 384 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 385 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 386 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 387 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 388 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 389 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 390 |  |  | 	if res.StatusCode == http.StatusNoContent { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 391 |  |  | 		return nil, nil | 
            
                                                                                                            
                            
            
                                    
            
            
                | 392 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 393 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 394 |  |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 395 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 396 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 397 |  |  | // CreateOrderPayment can only be created while the status of the order is created, | 
            
                                                                                                            
                            
            
                                    
            
            
                | 398 |  |  | // and when the status of the existing payment is either expired, canceled or failed. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 399 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/create-order-payment | 
            
                                                                                                            
                            
            
                                    
            
            
                | 400 |  |  | func (ors *OrdersService) CreateOrderPayment(orderID string, ordPay *OrderPayment) (payment *Payment, errorResponse *ErrorResponse, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 401 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s/payments", orderID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 402 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 403 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodPost, u, ordPay) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 404 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 405 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 406 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 407 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 408 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 409 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 410 | 1 |  | 		if len(res.content) != 0 { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 411 | 1 |  | 			err = json.Unmarshal(res.content, &errorResponse) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 412 | 1 |  | 			if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 413 | 1 |  | 				return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 414 |  |  | 			} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 415 |  |  | 		} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 416 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 417 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 418 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 419 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 420 | 1 |  | 	if err = json.Unmarshal(res.content, &payment); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 421 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 422 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 423 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 424 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 425 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 426 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 427 |  |  | // CreateOrderRefund using the Orders API, refunds should be made against the order. | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 428 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/create-order-refund | 
            
                                                                        
                            
            
                                    
            
            
                | 429 |  |  | func (ors *OrdersService) CreateOrderRefund(orderID string, order *Orders) (refund Refund, errorResponse *ErrorResponse, err error) { | 
            
                                                                        
                            
            
                                    
            
            
                | 430 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s/refunds", orderID) | 
            
                                                                        
                            
            
                                    
            
            
                | 431 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 432 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodPost, u, order) | 
            
                                                                        
                            
            
                                    
            
            
                | 433 | 1 |  | 	if err != nil { | 
            
                                                                        
                            
            
                                    
            
            
                | 434 | 1 |  | 		return | 
            
                                                                        
                            
            
                                    
            
            
                | 435 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 436 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 437 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                        
                            
            
                                    
            
            
                | 438 | 1 |  | 	if err != nil { | 
            
                                                                        
                            
            
                                    
            
            
                | 439 | 1 |  | 		if len(res.content) != 0 { | 
            
                                                                        
                            
            
                                    
            
            
                | 440 | 1 |  | 			err = json.Unmarshal(res.content, &errorResponse) | 
            
                                                                        
                            
            
                                    
            
            
                | 441 | 1 |  | 			if err != nil { | 
            
                                                                        
                            
            
                                    
            
            
                | 442 | 1 |  | 				return | 
            
                                                                        
                            
            
                                    
            
            
                | 443 |  |  | 			} | 
            
                                                                        
                            
            
                                    
            
            
                | 444 |  |  | 		} | 
            
                                                                        
                            
            
                                    
            
            
                | 445 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 446 | 1 |  | 		return | 
            
                                                                        
                            
            
                                    
            
            
                | 447 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 448 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 449 | 1 |  | 	if err = json.Unmarshal(res.content, &refund); err != nil { | 
            
                                                                        
                            
            
                                    
            
            
                | 450 | 1 |  | 		return | 
            
                                                                        
                            
            
                                    
            
            
                | 451 |  |  | 	} | 
            
                                                                        
                            
            
                                    
            
            
                | 452 |  |  |  | 
            
                                                                        
                            
            
                                    
            
            
                | 453 | 1 |  | 	return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 454 |  |  | } | 
            
                                                                                                            
                            
            
                                    
            
            
                | 455 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 456 |  |  | // ListOrderRefunds retrieve all order refunds. | 
            
                                                                                                            
                            
            
                                    
            
            
                | 457 |  |  | // See https://docs.mollie.com/reference/v2/orders-api/list-order-refunds | 
            
                                                                                                            
                            
            
                                    
            
            
                | 458 |  |  | func (ors *OrdersService) ListOrderRefunds(orderID string, opt *OrderListRefundOptions) (orderListRefund OrderListRefund, err error) { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 459 | 1 |  | 	u := fmt.Sprintf("v2/orders/%s/refunds", orderID) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 460 | 1 |  | 	if opt != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 461 | 1 |  | 		v, _ := query.Values(opt) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 462 | 1 |  | 		u = fmt.Sprintf("%s?%s", u, v.Encode()) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 463 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 464 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 465 | 1 |  | 	req, err := ors.client.NewAPIRequest(http.MethodGet, u, nil) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 466 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 467 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 468 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 469 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 470 | 1 |  | 	res, err := ors.client.Do(req) | 
            
                                                                                                            
                            
            
                                    
            
            
                | 471 | 1 |  | 	if err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 472 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 473 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 474 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 475 | 1 |  | 	if err = json.Unmarshal(res.content, &orderListRefund); err != nil { | 
            
                                                                                                            
                            
            
                                    
            
            
                | 476 | 1 |  | 		return | 
            
                                                                                                            
                            
            
                                    
            
            
                | 477 |  |  | 	} | 
            
                                                                                                            
                            
            
                                    
            
            
                | 478 |  |  |  | 
            
                                                                                                            
                            
            
                                    
            
            
                | 479 | 1 |  | 	return | 
            
                                                                                                            
                                                                
            
                                    
            
            
                | 480 |  |  | } | 
            
                                                        
            
                                    
            
            
                | 481 |  |  |  |