Skip to content

Commit 995d779

Browse files
committed
Added new API & Contract
1 parent 9ebe333 commit 995d779

14 files changed

Lines changed: 850 additions & 64 deletions
Lines changed: 261 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,261 @@
1+
<?php
2+
3+
namespace net\authorize\api\contract\v1;
4+
5+
/**
6+
* Class representing OtherTaxType
7+
*
8+
*
9+
* XSD Type: otherTaxType
10+
*/
11+
class OtherTaxType implements \JsonSerializable
12+
{
13+
14+
/**
15+
* @property float $nationalTaxAmount
16+
*/
17+
private $nationalTaxAmount = null;
18+
19+
/**
20+
* @property float $localTaxAmount
21+
*/
22+
private $localTaxAmount = null;
23+
24+
/**
25+
* @property float $alternateTaxAmount
26+
*/
27+
private $alternateTaxAmount = null;
28+
29+
/**
30+
* @property string $alternateTaxId
31+
*/
32+
private $alternateTaxId = null;
33+
34+
/**
35+
* @property float $vatTaxRate
36+
*/
37+
private $vatTaxRate = null;
38+
39+
/**
40+
* @property float $vatTaxAmount
41+
*/
42+
private $vatTaxAmount = null;
43+
44+
/**
45+
* Gets as nationalTaxAmount
46+
*
47+
* @return float
48+
*/
49+
public function getNationalTaxAmount()
50+
{
51+
return $this->nationalTaxAmount;
52+
}
53+
54+
/**
55+
* Sets a new nationalTaxAmount
56+
*
57+
* @param float $nationalTaxAmount
58+
* @return self
59+
*/
60+
public function setNationalTaxAmount($nationalTaxAmount)
61+
{
62+
$this->nationalTaxAmount = $nationalTaxAmount;
63+
return $this;
64+
}
65+
66+
/**
67+
* Gets as localTaxAmount
68+
*
69+
* @return float
70+
*/
71+
public function getLocalTaxAmount()
72+
{
73+
return $this->localTaxAmount;
74+
}
75+
76+
/**
77+
* Sets a new localTaxAmount
78+
*
79+
* @param float $localTaxAmount
80+
* @return self
81+
*/
82+
public function setLocalTaxAmount($localTaxAmount)
83+
{
84+
$this->localTaxAmount = $localTaxAmount;
85+
return $this;
86+
}
87+
88+
/**
89+
* Gets as alternateTaxAmount
90+
*
91+
* @return float
92+
*/
93+
public function getAlternateTaxAmount()
94+
{
95+
return $this->alternateTaxAmount;
96+
}
97+
98+
/**
99+
* Sets a new alternateTaxAmount
100+
*
101+
* @param float $alternateTaxAmount
102+
* @return self
103+
*/
104+
public function setAlternateTaxAmount($alternateTaxAmount)
105+
{
106+
$this->alternateTaxAmount = $alternateTaxAmount;
107+
return $this;
108+
}
109+
110+
/**
111+
* Gets as alternateTaxId
112+
*
113+
* @return string
114+
*/
115+
public function getAlternateTaxId()
116+
{
117+
return $this->alternateTaxId;
118+
}
119+
120+
/**
121+
* Sets a new alternateTaxId
122+
*
123+
* @param string $alternateTaxId
124+
* @return self
125+
*/
126+
public function setAlternateTaxId($alternateTaxId)
127+
{
128+
$this->alternateTaxId = $alternateTaxId;
129+
return $this;
130+
}
131+
132+
/**
133+
* Gets as vatTaxRate
134+
*
135+
* @return float
136+
*/
137+
public function getVatTaxRate()
138+
{
139+
return $this->vatTaxRate;
140+
}
141+
142+
/**
143+
* Sets a new vatTaxRate
144+
*
145+
* @param float $vatTaxRate
146+
* @return self
147+
*/
148+
public function setVatTaxRate($vatTaxRate)
149+
{
150+
$this->vatTaxRate = $vatTaxRate;
151+
return $this;
152+
}
153+
154+
/**
155+
* Gets as vatTaxAmount
156+
*
157+
* @return float
158+
*/
159+
public function getVatTaxAmount()
160+
{
161+
return $this->vatTaxAmount;
162+
}
163+
164+
/**
165+
* Sets a new vatTaxAmount
166+
*
167+
* @param float $vatTaxAmount
168+
* @return self
169+
*/
170+
public function setVatTaxAmount($vatTaxAmount)
171+
{
172+
$this->vatTaxAmount = $vatTaxAmount;
173+
return $this;
174+
}
175+
176+
177+
// Json Serialize Code
178+
public function jsonSerialize(){
179+
$values = array_filter((array)get_object_vars($this),
180+
function ($val){
181+
return !is_null($val);
182+
});
183+
$mapper = \net\authorize\util\Mapper::Instance();
184+
foreach($values as $key => $value){
185+
$classDetails = $mapper->getClass(get_class() , $key);
186+
if (isset($value)){
187+
if ($classDetails->className === 'Date'){
188+
$dateTime = $value->format('Y-m-d');
189+
$values[$key] = $dateTime;
190+
}
191+
else if ($classDetails->className === 'DateTime'){
192+
$dateTime = $value->format('Y-m-d\TH:i:s\Z');
193+
$values[$key] = $dateTime;
194+
}
195+
if (is_array($value)){
196+
if (!$classDetails->isInlineArray){
197+
$subKey = $classDetails->arrayEntryname;
198+
$subArray = [$subKey => $value];
199+
$values[$key] = $subArray;
200+
}
201+
}
202+
}
203+
}
204+
if (get_parent_class() == ""){
205+
return $values;
206+
}
207+
else{
208+
return array_merge(parent::jsonSerialize(), $values);
209+
}
210+
}
211+
212+
// Json Set Code
213+
public function set($data)
214+
{
215+
if(is_array($data) || is_object($data)) {
216+
$mapper = \net\authorize\util\Mapper::Instance();
217+
foreach($data AS $key => $value) {
218+
$classDetails = $mapper->getClass(get_class() , $key);
219+
220+
if($classDetails !== NULL ) {
221+
if ($classDetails->isArray) {
222+
if ($classDetails->isCustomDefined) {
223+
foreach($value AS $keyChild => $valueChild) {
224+
$type = new $classDetails->className;
225+
$type->set($valueChild);
226+
$this->{'addTo' . $key}($type);
227+
}
228+
}
229+
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
230+
foreach($value AS $keyChild => $valueChild) {
231+
$type = new \DateTime($valueChild);
232+
$this->{'addTo' . $key}($type);
233+
}
234+
}
235+
else {
236+
foreach($value AS $keyChild => $valueChild) {
237+
$this->{'addTo' . $key}($valueChild);
238+
}
239+
}
240+
}
241+
else {
242+
if ($classDetails->isCustomDefined){
243+
$type = new $classDetails->className;
244+
$type->set($value);
245+
$this->{'set' . $key}($type);
246+
}
247+
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
248+
$type = new \DateTime($value);
249+
$this->{'set' . $key}($type);
250+
}
251+
else {
252+
$this->{'set' . $key}($value);
253+
}
254+
}
255+
}
256+
}
257+
}
258+
}
259+
260+
}
261+

lib/net/authorize/api/contract/v1/PaymentScheduleType.php

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
/**
66
* Class representing PaymentScheduleType
77
*
8-
*
8+
*
99
* XSD Type: paymentScheduleType
1010
*/
1111
class PaymentScheduleType implements \JsonSerializable
@@ -161,47 +161,49 @@ function ($val){
161161
// Json Set Code
162162
public function set($data)
163163
{
164-
$mapper = \net\authorize\util\Mapper::Instance();
165-
foreach($data AS $key => $value) {
166-
$classDetails = $mapper->getClass(get_class() , $key);
167-
168-
if($classDetails !== NULL ) {
169-
if ($classDetails->isArray) {
170-
if ($classDetails->isCustomDefined) {
171-
foreach($value AS $keyChild => $valueChild) {
172-
$type = new $classDetails->className;
173-
$type->set($valueChild);
174-
$this->{'addTo' . $key}($type);
175-
}
176-
}
177-
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
178-
foreach($value AS $keyChild => $valueChild) {
179-
$type = new \DateTime($valueChild);
180-
$this->{'addTo' . $key}($type);
181-
}
182-
}
183-
else {
184-
foreach($value AS $keyChild => $valueChild) {
185-
$this->{'addTo' . $key}($valueChild);
186-
}
187-
}
188-
}
189-
else {
190-
if ($classDetails->isCustomDefined){
191-
$type = new $classDetails->className;
192-
$type->set($value);
193-
$this->{'set' . $key}($type);
194-
}
195-
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
196-
$type = new \DateTime($value);
197-
$this->{'set' . $key}($type);
198-
}
199-
else {
200-
$this->{'set' . $key}($value);
201-
}
202-
}
203-
}
204-
}
164+
if(is_array($data) || is_object($data)) {
165+
$mapper = \net\authorize\util\Mapper::Instance();
166+
foreach($data AS $key => $value) {
167+
$classDetails = $mapper->getClass(get_class() , $key);
168+
169+
if($classDetails !== NULL ) {
170+
if ($classDetails->isArray) {
171+
if ($classDetails->isCustomDefined) {
172+
foreach($value AS $keyChild => $valueChild) {
173+
$type = new $classDetails->className;
174+
$type->set($valueChild);
175+
$this->{'addTo' . $key}($type);
176+
}
177+
}
178+
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
179+
foreach($value AS $keyChild => $valueChild) {
180+
$type = new \DateTime($valueChild);
181+
$this->{'addTo' . $key}($type);
182+
}
183+
}
184+
else {
185+
foreach($value AS $keyChild => $valueChild) {
186+
$this->{'addTo' . $key}($valueChild);
187+
}
188+
}
189+
}
190+
else {
191+
if ($classDetails->isCustomDefined){
192+
$type = new $classDetails->className;
193+
$type->set($value);
194+
$this->{'set' . $key}($type);
195+
}
196+
else if ($classDetails->className === 'DateTime' || $classDetails->className === 'Date' ) {
197+
$type = new \DateTime($value);
198+
$this->{'set' . $key}($type);
199+
}
200+
else {
201+
$this->{'set' . $key}($value);
202+
}
203+
}
204+
}
205+
}
206+
}
205207
}
206208

207209
}

0 commit comments

Comments
 (0)