From 36a51295c4326becc9fc0c1ebf8eb1f8d5f1f4f4 Mon Sep 17 00:00:00 2001 From: Aditya Date: Mon, 31 Aug 2020 19:57:40 +0530 Subject: [PATCH] added INR support --- add_ons.go | 3 ++- add_ons_test.go | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/add_ons.go b/add_ons.go index 72f4952..d33748e 100644 --- a/add_ons.go +++ b/add_ons.go @@ -71,12 +71,13 @@ type UnitAmount struct { GBP int `xml:"GBP,omitempty"` CAD int `xml:"CAD,omitempty"` AUD int `xml:"AUD,omitempty"` + INR int `xml:"INR,omitempty"` } // MarshalXML ensures UnitAmount is not marshaled unless one or more currencies // has a value greater than zero. func (u UnitAmount) MarshalXML(e *xml.Encoder, start xml.StartElement) error { - if u.USD > 0 || u.EUR > 0 || u.CAD > 0 || u.GBP > 0 || u.AUD > 0 { + if u.USD > 0 || u.EUR > 0 || u.CAD > 0 || u.GBP > 0 || u.AUD > 0 || u.INR > 0 { type uaAlias UnitAmount e.EncodeElement(uaAlias(u), start) } diff --git a/add_ons_test.go b/add_ons_test.go index a904b87..6d4905a 100644 --- a/add_ons_test.go +++ b/add_ons_test.go @@ -244,6 +244,15 @@ func TestUnitAmount(t *testing.T) { `), }, + {v: s{Amount: recurly.UnitAmount{INR: 500}}, + expected: MustCompactString(` + + + 500 + + + `), + }, } buf := new(bytes.Buffer)