/** * @test */ public function testToNVPString() { $this->object->firstName = 'John'; $this->object->lastName = 'Smith'; $this->object->businessName = 'Invoicing'; $this->object->phone = '235566788'; $this->object->fax = '348678903'; $this->object->website = 'www.invoicing.com'; $this->object->customValue = 'Invoicing'; $address = new BaseAddress("Main St", "San Jose", "US"); $address->line2 = '6th Avenue'; $address->postalCode = '2345667'; $address->state = 'California'; $this->object->address = $address; $ret = $this->object->toNVPString(); $this->assertEquals('firstName=John&lastName=Smith&businessName=Invoicing&phone=235566788&fax=348678903&website=www.invoicing.com&customValue=Invoicing&address.line1=Main+St&address.line2=6th+Avenue&address.city=San+Jose&address.state=California&address.postalCode=2345667&address.countryCode=US', $ret); }
public function toXMLString() { $str = ''; if ($this->ProgramCode != null) { $str .= '<ebl:ProgramCode>' . PPUtils::escapeInvalidXmlCharsRegex($this->ProgramCode) . '</ebl:ProgramCode>'; } if ($this->ProductList != null) { $str .= '<ebl:ProductList>' . PPUtils::escapeInvalidXmlCharsRegex($this->ProductList) . '</ebl:ProductList>'; } if ($this->PartnerCustom != null) { $str .= '<ebl:PartnerCustom>' . PPUtils::escapeInvalidXmlCharsRegex($this->PartnerCustom) . '</ebl:PartnerCustom>'; } if ($this->ImageUrl != null) { $str .= '<ebl:ImageUrl>' . PPUtils::escapeInvalidXmlCharsRegex($this->ImageUrl) . '</ebl:ImageUrl>'; } if ($this->MarketingCategory != null) { $str .= '<ebl:MarketingCategory>' . PPUtils::escapeInvalidXmlCharsRegex($this->MarketingCategory) . '</ebl:MarketingCategory>'; } if ($this->BusinessInfo != null) { $str .= '<ebl:BusinessInfo>'; $str .= $this->BusinessInfo->toXMLString(); $str .= '</ebl:BusinessInfo>'; } if ($this->OwnerInfo != null) { $str .= '<ebl:OwnerInfo>'; $str .= $this->OwnerInfo->toXMLString(); $str .= '</ebl:OwnerInfo>'; } if ($this->BankAccount != null) { $str .= '<ebl:BankAccount>'; $str .= $this->BankAccount->toXMLString(); $str .= '</ebl:BankAccount>'; } return $str; }
public function init($map = null, $prefix = '') { if ($map != null) { $mapKeyName = $prefix . 'merchantEmail'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->merchantEmail = $map[$mapKeyName]; } $mapKeyName = $prefix . 'payerEmail'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->payerEmail = $map[$mapKeyName]; } $mapKeyName = $prefix . 'number'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->number = $map[$mapKeyName]; } if (PPUtils::array_match_key($map, $prefix . "merchantInfo.")) { $newPrefix = $prefix . "merchantInfo."; $this->merchantInfo = new BusinessInfoType(); $this->merchantInfo->init($map, $newPrefix); } if (PPUtils::array_match_key($map, $prefix . "itemList.")) { $newPrefix = $prefix . "itemList."; $this->itemList = new InvoiceItemListType(); $this->itemList->init($map, $newPrefix); } $mapKeyName = $prefix . 'currencyCode'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->currencyCode = $map[$mapKeyName]; } $mapKeyName = $prefix . 'invoiceDate'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->invoiceDate = $map[$mapKeyName]; } $mapKeyName = $prefix . 'dueDate'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->dueDate = $map[$mapKeyName]; } $mapKeyName = $prefix . 'paymentTerms'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->paymentTerms = $map[$mapKeyName]; } $mapKeyName = $prefix . 'discountPercent'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->discountPercent = $map[$mapKeyName]; } $mapKeyName = $prefix . 'discountAmount'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->discountAmount = $map[$mapKeyName]; } $mapKeyName = $prefix . 'terms'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->terms = $map[$mapKeyName]; } $mapKeyName = $prefix . 'note'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->note = $map[$mapKeyName]; } $mapKeyName = $prefix . 'merchantMemo'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->merchantMemo = $map[$mapKeyName]; } if (PPUtils::array_match_key($map, $prefix . "billingInfo.")) { $newPrefix = $prefix . "billingInfo."; $this->billingInfo = new BusinessInfoType(); $this->billingInfo->init($map, $newPrefix); } if (PPUtils::array_match_key($map, $prefix . "shippingInfo.")) { $newPrefix = $prefix . "shippingInfo."; $this->shippingInfo = new BusinessInfoType(); $this->shippingInfo->init($map, $newPrefix); } $mapKeyName = $prefix . 'shippingAmount'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->shippingAmount = $map[$mapKeyName]; } $mapKeyName = $prefix . 'shippingTaxName'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->shippingTaxName = $map[$mapKeyName]; } $mapKeyName = $prefix . 'shippingTaxRate'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->shippingTaxRate = $map[$mapKeyName]; } $mapKeyName = $prefix . 'logoUrl'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->logoUrl = $map[$mapKeyName]; } $mapKeyName = $prefix . 'referrerCode'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->referrerCode = $map[$mapKeyName]; } $mapKeyName = $prefix . 'customAmountLabel'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->customAmountLabel = $map[$mapKeyName]; } $mapKeyName = $prefix . 'customAmountValue'; if ($map != null && array_key_exists($mapKeyName, $map)) { $this->customAmountValue = $map[$mapKeyName]; } } }
public function toXMLString() { $str = ''; if ($this->ProgramCode != null) { //prop is not a collection //prop not complex //prop is not value $str .= '<ebl:ProgramCode>' . $this->ProgramCode . '</ebl:ProgramCode>'; } if ($this->ProductList != null) { //prop is not a collection //prop not complex //prop is not value $str .= '<ebl:ProductList>' . $this->ProductList . '</ebl:ProductList>'; } if ($this->PartnerCustom != null) { //prop is not a collection //prop not complex //prop is not value $str .= '<ebl:PartnerCustom>' . $this->PartnerCustom . '</ebl:PartnerCustom>'; } if ($this->ImageUrl != null) { //prop is not a collection //prop not complex //prop is not value $str .= '<ebl:ImageUrl>' . $this->ImageUrl . '</ebl:ImageUrl>'; } if ($this->MarketingCategory != null) { //prop is not a collection //prop not complex //prop is not value $str .= '<ebl:MarketingCategory>' . $this->MarketingCategory . '</ebl:MarketingCategory>'; } if ($this->BusinessInfo != null) { //prop is not a collection //prop is complex //prop is not enum //does not contain attribute or is attribute $str .= '<ebl:BusinessInfo>'; $str .= $this->BusinessInfo->toXMLString(); $str .= '</ebl:BusinessInfo>'; } if ($this->OwnerInfo != null) { //prop is not a collection //prop is complex //prop is not enum //does not contain attribute or is attribute $str .= '<ebl:OwnerInfo>'; $str .= $this->OwnerInfo->toXMLString(); $str .= '</ebl:OwnerInfo>'; } if ($this->BankAccount != null) { //prop is not a collection //prop is complex //prop is not enum //does not contain attribute or is attribute $str .= '<ebl:BankAccount>'; $str .= $this->BankAccount->toXMLString(); $str .= '</ebl:BankAccount>'; } return $str; }