Overview
  • Namespace
  • Class

Namespaces

  • PayPal
    • Api
    • Auth
    • Cache
    • Common
    • Converter
    • Core
    • Exception
    • Handler
    • Log
    • Rest
    • Security
    • Transport
    • Validation

Classes

  • PayPal\Api\Address
  • PayPal\Api\Agreement
  • PayPal\Api\AgreementDetails
  • PayPal\Api\AgreementStateDescriptor
  • PayPal\Api\AgreementTransaction
  • PayPal\Api\AgreementTransactions
  • PayPal\Api\AlternatePayment
  • PayPal\Api\Amount
  • PayPal\Api\Authorization
  • PayPal\Api\BankAccount
  • PayPal\Api\BankAccountsList
  • PayPal\Api\BankToken
  • PayPal\Api\BaseAddress
  • PayPal\Api\Billing
  • PayPal\Api\BillingAgreementToken
  • PayPal\Api\BillingInfo
  • PayPal\Api\CancelNotification
  • PayPal\Api\Capture
  • PayPal\Api\CarrierAccount
  • PayPal\Api\CarrierAccountToken
  • PayPal\Api\CartBase
  • PayPal\Api\ChargeModel
  • PayPal\Api\Cost
  • PayPal\Api\CountryCode
  • PayPal\Api\CreateProfileResponse
  • PayPal\Api\Credit
  • PayPal\Api\CreditCard
  • PayPal\Api\CreditCardHistory
  • PayPal\Api\CreditCardList
  • PayPal\Api\CreditCardToken
  • PayPal\Api\CreditFinancingOffered
  • PayPal\Api\Currency
  • PayPal\Api\CurrencyConversion
  • PayPal\Api\CustomAmount
  • PayPal\Api\DetailedRefund
  • PayPal\Api\Details
  • PayPal\Api\Error
  • PayPal\Api\ErrorDetails
  • PayPal\Api\ExtendedBankAccount
  • PayPal\Api\ExternalFunding
  • PayPal\Api\FileAttachment
  • PayPal\Api\FlowConfig
  • PayPal\Api\FmfDetails
  • PayPal\Api\FundingDetail
  • PayPal\Api\FundingInstrument
  • PayPal\Api\FundingOption
  • PayPal\Api\FundingSource
  • PayPal\Api\FuturePayment
  • PayPal\Api\HyperSchema
  • PayPal\Api\Image
  • PayPal\Api\Incentive
  • PayPal\Api\InputFields
  • PayPal\Api\InstallmentInfo
  • PayPal\Api\InstallmentOption
  • PayPal\Api\Invoice
  • PayPal\Api\InvoiceAddress
  • PayPal\Api\InvoiceItem
  • PayPal\Api\InvoiceNumber
  • PayPal\Api\InvoiceSearchResponse
  • PayPal\Api\Item
  • PayPal\Api\ItemList
  • PayPal\Api\Links
  • PayPal\Api\Measurement
  • PayPal\Api\MerchantInfo
  • PayPal\Api\MerchantPreferences
  • PayPal\Api\Metadata
  • PayPal\Api\NameValuePair
  • PayPal\Api\Notification
  • PayPal\Api\OpenIdAddress
  • PayPal\Api\OpenIdError
  • PayPal\Api\OpenIdSession
  • PayPal\Api\OpenIdTokeninfo
  • PayPal\Api\OpenIdUserinfo
  • PayPal\Api\Order
  • PayPal\Api\OverrideChargeModel
  • PayPal\Api\Participant
  • PayPal\Api\Patch
  • PayPal\Api\PatchRequest
  • PayPal\Api\Payee
  • PayPal\Api\Payer
  • PayPal\Api\PayerInfo
  • PayPal\Api\Payment
  • PayPal\Api\PaymentCard
  • PayPal\Api\PaymentCardToken
  • PayPal\Api\PaymentDefinition
  • PayPal\Api\PaymentDetail
  • PayPal\Api\PaymentExecution
  • PayPal\Api\PaymentHistory
  • PayPal\Api\PaymentInstruction
  • PayPal\Api\PaymentOptions
  • PayPal\Api\PaymentSummary
  • PayPal\Api\PaymentTerm
  • PayPal\Api\Payout
  • PayPal\Api\PayoutBatch
  • PayPal\Api\PayoutBatchHeader
  • PayPal\Api\PayoutItem
  • PayPal\Api\PayoutItemDetails
  • PayPal\Api\PayoutSenderBatchHeader
  • PayPal\Api\Phone
  • PayPal\Api\Plan
  • PayPal\Api\PlanList
  • PayPal\Api\PotentialPayerInfo
  • PayPal\Api\Presentation
  • PayPal\Api\PrivateLabelCard
  • PayPal\Api\ProcessorResponse
  • PayPal\Api\RecipientBankingInstruction
  • PayPal\Api\RedirectUrls
  • PayPal\Api\Refund
  • PayPal\Api\RefundDetail
  • PayPal\Api\RefundRequest
  • PayPal\Api\RelatedResources
  • PayPal\Api\Sale
  • PayPal\Api\Search
  • PayPal\Api\ShippingAddress
  • PayPal\Api\ShippingCost
  • PayPal\Api\ShippingInfo
  • PayPal\Api\Tax
  • PayPal\Api\Template
  • PayPal\Api\TemplateData
  • PayPal\Api\Templates
  • PayPal\Api\TemplateSettings
  • PayPal\Api\TemplateSettingsMetadata
  • PayPal\Api\Terms
  • PayPal\Api\Transaction
  • PayPal\Api\TransactionBase
  • PayPal\Api\Transactions
  • PayPal\Api\VerifyWebhookSignature
  • PayPal\Api\VerifyWebhookSignatureResponse
  • PayPal\Api\Webhook
  • PayPal\Api\WebhookEvent
  • PayPal\Api\WebhookEventList
  • PayPal\Api\WebhookEventType
  • PayPal\Api\WebhookEventTypeList
  • PayPal\Api\WebhookList
  • PayPal\Api\WebProfile
  • PayPal\Auth\OAuthTokenCredential
  • PayPal\Cache\AuthorizationCache
  • PayPal\Common\ArrayUtil
  • PayPal\Common\PayPalModel
  • PayPal\Common\PayPalResourceModel
  • PayPal\Common\PayPalUserAgent
  • PayPal\Common\ReflectionUtil
  • PayPal\Converter\FormatConverter
  • PayPal\Core\PayPalConfigManager
  • PayPal\Core\PayPalConstants
  • PayPal\Core\PayPalCredentialManager
  • PayPal\Core\PayPalHttpConfig
  • PayPal\Core\PayPalHttpConnection
  • PayPal\Core\PayPalLoggingManager
  • PayPal\Handler\OauthHandler
  • PayPal\Handler\RestHandler
  • PayPal\Log\PayPalDefaultLogFactory
  • PayPal\Log\PayPalLogger
  • PayPal\Rest\ApiContext
  • PayPal\Security\Cipher
  • PayPal\Transport\PayPalRestCall
  • PayPal\Validation\ArgumentValidator
  • PayPal\Validation\JsonValidator
  • PayPal\Validation\NumericValidator
  • PayPal\Validation\UrlValidator

Interfaces

  • PayPal\Handler\IPayPalHandler
  • PayPal\Log\PayPalLogFactory
  • PayPal\Rest\IResource

Exceptions

  • PayPal\Exception\PayPalConfigurationException
  • PayPal\Exception\PayPalConnectionException
  • PayPal\Exception\PayPalInvalidCredentialException
  • PayPal\Exception\PayPalMissingCredentialException
  1 <?php
  2 
  3 namespace PayPal\Api;
  4 
  5 use PayPal\Common\PayPalResourceModel;
  6 use PayPal\Transport\PayPalRestCall;
  7 use PayPal\Validation\ArgumentValidator;
  8 use PayPal\Api\Template;
  9 use PayPal\Rest\ApiContext;
 10 
 11 /**
 12  * Class Templates
 13  *
 14  * List of templates belonging to merchant.
 15  *
 16  * @package PayPal\Api
 17  *
 18  * @property \PayPal\Api\Address[] addresses
 19  * @property string[] emails
 20  * @property \PayPal\Api\Phone[] phones
 21  * @property \PayPal\Api\Template[] templates
 22  * @property \PayPal\Api\Links[] links
 23  */
 24 class Templates extends PayPalResourceModel
 25 {
 26     /**
 27      * List of addresses in merchant's profile.
 28      *
 29      * @param \PayPal\Api\Address[] $addresses
 30      * 
 31      * @return $this
 32      */
 33     public function setAddresses($addresses)
 34     {
 35         $this->addresses = $addresses;
 36         return $this;
 37     }
 38 
 39     /**
 40      * List of addresses in merchant's profile.
 41      *
 42      * @return \PayPal\Api\Address[]
 43      */
 44     public function getAddresses()
 45     {
 46         return $this->addresses;
 47     }
 48 
 49     /**
 50      * Append Addresses to the list.
 51      *
 52      * @param \PayPal\Api\Address $address
 53      * @return $this
 54      */
 55     public function addAddress($address)
 56     {
 57         if (!$this->getAddresses()) {
 58             return $this->setAddresses(array($address));
 59         } else {
 60             return $this->setAddresses(
 61                 array_merge($this->getAddresses(), array($address))
 62             );
 63         }
 64     }
 65 
 66     /**
 67      * Remove Addresses from the list.
 68      *
 69      * @param \PayPal\Api\Address $address
 70      * @return $this
 71      */
 72     public function removeAddress($address)
 73     {
 74         return $this->setAddresses(
 75             array_diff($this->getAddresses(), array($address))
 76         );
 77     }
 78 
 79     /**
 80      * List of emails in merchant's profile.
 81      *
 82      * @param string[] $emails
 83      * 
 84      * @return $this
 85      */
 86     public function setEmails($emails)
 87     {
 88         $this->emails = $emails;
 89         return $this;
 90     }
 91 
 92     /**
 93      * List of emails in merchant's profile.
 94      *
 95      * @return string[]
 96      */
 97     public function getEmails()
 98     {
 99         return $this->emails;
100     }
101 
102     /**
103      * Append Emails to the list.
104      *
105      * @param string $string
106      * @return $this
107      */
108     public function addEmail($string)
109     {
110         if (!$this->getEmails()) {
111             return $this->setEmails(array($string));
112         } else {
113             return $this->setEmails(
114                 array_merge($this->getEmails(), array($string))
115             );
116         }
117     }
118 
119     /**
120      * Remove Emails from the list.
121      *
122      * @param string $string
123      * @return $this
124      */
125     public function removeEmail($string)
126     {
127         return $this->setEmails(
128             array_diff($this->getEmails(), array($string))
129         );
130     }
131 
132     /**
133      * List of phone numbers in merchant's profile.
134      *
135      * @param \PayPal\Api\Phone[] $phones
136      * 
137      * @return $this
138      */
139     public function setPhones($phones)
140     {
141         $this->phones = $phones;
142         return $this;
143     }
144 
145     /**
146      * List of phone numbers in merchant's profile.
147      *
148      * @return \PayPal\Api\Phone[]
149      */
150     public function getPhones()
151     {
152         return $this->phones;
153     }
154 
155     /**
156      * Append Phones to the list.
157      *
158      * @param \PayPal\Api\Phone $phone
159      * @return $this
160      */
161     public function addPhone($phone)
162     {
163         if (!$this->getPhones()) {
164             return $this->setPhones(array($phone));
165         } else {
166             return $this->setPhones(
167                 array_merge($this->getPhones(), array($phone))
168             );
169         }
170     }
171 
172     /**
173      * Remove Phones from the list.
174      *
175      * @param \PayPal\Api\Phone $phone
176      * @return $this
177      */
178     public function removePhone($phone)
179     {
180         return $this->setPhones(
181             array_diff($this->getPhones(), array($phone))
182         );
183     }
184 
185     /**
186      * Array of templates.
187      *
188      * @param \PayPal\Api\Template[] $templates
189      * 
190      * @return $this
191      */
192     public function setTemplates($templates)
193     {
194         $this->templates = $templates;
195         return $this;
196     }
197 
198     /**
199      * Array of templates.
200      *
201      * @return \PayPal\Api\Template[]
202      */
203     public function getTemplates()
204     {
205         return $this->templates;
206     }
207 
208     /**
209      * Append Templates to the list.
210      *
211      * @param \PayPal\Api\Template $template
212      * @return $this
213      */
214     public function addTemplate($template)
215     {
216         if (!$this->getTemplates()) {
217             return $this->setTemplates(array($template));
218         } else {
219             return $this->setTemplates(
220                 array_merge($this->getTemplates(), array($template))
221             );
222         }
223     }
224 
225     /**
226      * Remove Templates from the list.
227      *
228      * @param \PayPal\Api\Template $template
229      * @return $this
230      */
231     public function removeTemplate($template)
232     {
233         return $this->setTemplates(
234             array_diff($this->getTemplates(), array($template))
235         );
236     }
237 
238     /**
239      * Retrieve the details for a particular template by passing the template ID to the request URI.
240      *
241      * @deprecated Please use `Template::get()` instead.
242      * @see Template::get
243      * @param string $templateId
244      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
245      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
246      * @return Template
247      */
248     public static function get($templateId, $apiContext = null, $restCall = null)
249     {
250         ArgumentValidator::validate($templateId, 'templateId');
251         $payLoad = "";
252         $json = self::executeCall(
253             "/v1/invoicing/templates/$templateId",
254             "GET",
255             $payLoad,
256             null,
257             $apiContext,
258             $restCall
259         );
260         $ret = new Template();
261         $ret->fromJson($json);
262         return $ret;
263     }
264 
265     /**
266      * Retrieves the template information of the merchant.
267      *
268      * @param array $params
269      * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
270      * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
271      * @return Templates
272      */
273     public static function getAll($params = array(), $apiContext = null, $restCall = null)
274     {
275         ArgumentValidator::validate($params, 'params');
276         $payLoad = "";
277         $allowedParams = array(
278           'fields' => 1,
279       );
280         $json = self::executeCall(
281             "/v1/invoicing/templates/" . "?" . http_build_query(array_intersect_key($params, $allowedParams)),
282             "GET",
283             $payLoad,
284             null,
285             $apiContext,
286             $restCall
287         );
288         $ret = new Templates();
289         $ret->fromJson($json);
290         return $ret;
291     }
292 }
293 
API documentation generated by ApiGen