public function init($arr = null)
 {
     if ($arr != null) {
         foreach ($arr as $arry) {
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'token') {
                 $this->Token = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'payerinfo') {
                     $this->PayerInfo = new PayerInfoType();
                     $this->PayerInfo->init($arry["children"]);
                 }
             }
             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'] == 'contactphone') {
                 $this->ContactPhone = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'billingagreementacceptedstatus') {
                 $this->BillingAgreementAcceptedStatus = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'redirectrequired') {
                 $this->RedirectRequired = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'billingaddress') {
                     $this->BillingAddress = new AddressType();
                     $this->BillingAddress->init($arry["children"]);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'note') {
                 $this->Note = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'checkoutstatus') {
                 $this->CheckoutStatus = $arry["text"];
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'paypaladjustment') {
                     $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->PayPalAdjustment = new BasicAmountType();
                     $this->PayPalAdjustment->init($atr);
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 $i = 0;
                 while (true) {
                     if ($arry["name"] == "paymentdetails[{$i}]") {
                         $this->PaymentDetails[$i] = new PaymentDetailsType();
                         $this->PaymentDetails[$i]->init($arry["children"]);
                     } else {
                         break;
                     }
                     $i++;
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null && $arry["name"] == "paymentdetails") {
                 $this->PaymentDetails = new PaymentDetailsType();
                 $this->PaymentDetails->init($arry["children"]);
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'userselectedoptions') {
                     $this->UserSelectedOptions = new UserSelectedOptionType();
                     $this->UserSelectedOptions->init($arry["children"]);
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 $i = 0;
                 while (true) {
                     if ($arry["name"] == "incentivedetails[{$i}]") {
                         $this->IncentiveDetails[$i] = new IncentiveDetailsType();
                         $this->IncentiveDetails[$i]->init($arry["children"]);
                     } else {
                         break;
                     }
                     $i++;
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null && $arry["name"] == "incentivedetails") {
                 $this->IncentiveDetails = new IncentiveDetailsType();
                 $this->IncentiveDetails->init($arry["children"]);
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'giftmessage') {
                 $this->GiftMessage = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'giftreceiptenable') {
                 $this->GiftReceiptEnable = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'giftwrapname') {
                 $this->GiftWrapName = $arry["text"];
             }
             if (is_array($arry["attributes"]) && $arry["attributes"] != null) {
                 if ($arry["name"] == 'giftwrapamount') {
                     $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->GiftWrapAmount = new BasicAmountType();
                     $this->GiftWrapAmount->init($atr);
                 }
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'buyermarketingemail') {
                 $this->BuyerMarketingEmail = $arry["text"];
             }
             if ($arry != null && isset($arry['text']) && $arry['name'] == 'surveyquestion') {
                 $this->SurveyQuestion = $arry["text"];
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 $i = 0;
                 while (true) {
                     if ($arry["name"] == "paymentrequestinfo[{$i}]") {
                         $this->PaymentRequestInfo[$i] = new PaymentRequestInfoType();
                         $this->PaymentRequestInfo[$i]->init($arry["children"]);
                     } else {
                         break;
                     }
                     $i++;
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null && $arry["name"] == "paymentrequestinfo") {
                 $this->PaymentRequestInfo = new PaymentRequestInfoType();
                 $this->PaymentRequestInfo->init($arry["children"]);
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'externalremembermestatusdetails') {
                     $this->ExternalRememberMeStatusDetails = new ExternalRememberMeStatusDetailsType();
                     $this->ExternalRememberMeStatusDetails->init($arry["children"]);
                 }
             }
             if (is_array($arry["children"]) && $arry["children"] != null) {
                 if ($arry["name"] == 'refreshtokenstatusdetails') {
                     $this->RefreshTokenStatusDetails = new RefreshTokenStatusDetailsType();
                     $this->RefreshTokenStatusDetails->init($arry["children"]);
                 }
             }
         }
     }
 }
Beispiel #2
0
 public function init($map = null, $prefix = '')
 {
     if ($map != null) {
         if (PPUtils::array_match_key($map, $prefix . "responseEnvelope.")) {
             $newPrefix = $prefix . "responseEnvelope.";
             $this->responseEnvelope = new ResponseEnvelope();
             $this->responseEnvelope->init($map, $newPrefix);
         }
         if (PPUtils::array_match_key($map, $prefix . "invoice.")) {
             $newPrefix = $prefix . "invoice.";
             $this->invoice = new InvoiceType();
             $this->invoice->init($map, $newPrefix);
         }
         if (PPUtils::array_match_key($map, $prefix . "invoiceDetails.")) {
             $newPrefix = $prefix . "invoiceDetails.";
             $this->invoiceDetails = new InvoiceDetailsType();
             $this->invoiceDetails->init($map, $newPrefix);
         }
         if (PPUtils::array_match_key($map, $prefix . "paymentDetails.")) {
             $newPrefix = $prefix . "paymentDetails.";
             $this->paymentDetails = new PaymentDetailsType();
             $this->paymentDetails->init($map, $newPrefix);
         }
         if (PPUtils::array_match_key($map, $prefix . "refundDetails.")) {
             $newPrefix = $prefix . "refundDetails.";
             $this->refundDetails = new PaymentRefundDetailsType();
             $this->refundDetails->init($map, $newPrefix);
         }
         $mapKeyName = $prefix . 'invoiceURL';
         if ($map != null && array_key_exists($mapKeyName, $map)) {
             $this->invoiceURL = $map[$mapKeyName];
         }
         $i = 0;
         while (true) {
             if (PPUtils::array_match_key($map, $prefix . "error({$i})")) {
                 $newPrefix = $prefix . "error({$i}).";
                 $this->error[$i] = new ErrorData();
                 $this->error[$i]->init($map, $newPrefix);
             } else {
                 break;
             }
             $i++;
         }
     }
 }