public function init($arr = null)
 {
     if ($arr != null) {
         foreach ($arr as $arry) {
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'ordertotal') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->OrderTotal = new BasicAmountType();
                     $this->OrderTotal->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'itemtotal') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ItemTotal = new BasicAmountType();
                     $this->ItemTotal->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'shippingtotal') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ShippingTotal = new BasicAmountType();
                     $this->ShippingTotal->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'handlingtotal') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->HandlingTotal = new BasicAmountType();
                     $this->HandlingTotal->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'taxtotal') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->TaxTotal = new BasicAmountType();
                     $this->TaxTotal->init($atr);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'orderdescription') {
                 $this->OrderDescription = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'custom') {
                 $this->Custom = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'invoiceid') {
                 $this->InvoiceID = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'buttonsource') {
                 $this->ButtonSource = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'notifyurl') {
                 $this->NotifyURL = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'shiptoaddress') {
                     $this->ShipToAddress = new AddressType();
                     $this->ShipToAddress->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'fulfillmentreferencenumber') {
                 $this->FulfillmentReferenceNumber = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'fulfillmentaddress') {
                     $this->FulfillmentAddress = new AddressType();
                     $this->FulfillmentAddress->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'paymentcategorytype') {
                 $this->PaymentCategoryType = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'shippingmethod') {
                 $this->ShippingMethod = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'profileaddresschangedate') {
                 $this->ProfileAddressChangeDate = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 $i = 0;
                 while (true) {
                     if ($arry["name"] == "paymentdetailsitem[{$i}]") {
                         $this->PaymentDetailsItem[$i] = new PaymentDetailsItemType();
                         $this->PaymentDetailsItem[$i]->init($arry["children"]);
                     } else {
                         break;
                     }
                     $i++;
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null && $arry["name"] == "paymentdetailsitem") {
                 $this->PaymentDetailsItem = new PaymentDetailsItemType();
                 $this->PaymentDetailsItem->init($arry["children"]);
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'insurancetotal') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->InsuranceTotal = new BasicAmountType();
                     $this->InsuranceTotal->init($atr);
                 }
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'shippingdiscount') {
                     $tmp = array();
                     $atr = array();
                     foreach ($arry["attributes"] as $key => $val) {
                         $atr[0]["name"] = $key;
                         $atr[0]["text"] = $val;
                     }
                     $atr[1]["name"] = "value";
                     $atr[1]["text"] = $arry["text"];
                     $this->ShippingDiscount = new BasicAmountType();
                     $this->ShippingDiscount->init($atr);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'insuranceoptionoffered') {
                 $this->InsuranceOptionOffered = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'allowedpaymentmethod') {
                 $this->AllowedPaymentMethod = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'enhancedpaymentdata') {
                     $this->EnhancedPaymentData = new EnhancedPaymentDataType();
                     $this->EnhancedPaymentData->init($arry["children"]);
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'sellerdetails') {
                     $this->SellerDetails = new SellerDetailsType();
                     $this->SellerDetails->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'notetext') {
                 $this->NoteText = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'transactionid') {
                 $this->TransactionId = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'paymentaction') {
                 $this->PaymentAction = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'paymentrequestid') {
                 $this->PaymentRequestID = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'orderurl') {
                 $this->OrderURL = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'softdescriptor') {
                 $this->SoftDescriptor = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'branchlevel') {
                 $this->BranchLevel = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'offerdetails') {
                     $this->OfferDetails = new OfferDetailsType();
                     $this->OfferDetails->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'recurring') {
                 $this->Recurring = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'paymentreason') {
                 $this->PaymentReason = $arry["text"];
             }
         }
     }
 }