forked from LiveCarta/PayPal-PHP-SDK
@@ -24,7 +24,7 @@ use PayPal\Common\PayPalModel;
|
||||
class BillingInfo extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Email address of the invoice recipient. 260 characters max.
|
||||
* The invoice recipient email address. Maximum length is 260 characters.
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
@@ -37,7 +37,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the invoice recipient. 260 characters max.
|
||||
* The invoice recipient email address. Maximum length is 260 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -47,7 +47,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* First name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient first name. Maximum length is 30 characters.
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -60,7 +60,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* First name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient first name. Maximum length is 30 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -70,7 +70,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Last name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient last name. Maximum length is 30 characters.
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -83,7 +83,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Last name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient last name. Maximum length is 30 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -93,7 +93,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Company business name of the invoice recipient. 100 characters max.
|
||||
* The invoice recipient company business name. Maximum length is 100 characters.
|
||||
*
|
||||
* @param string $business_name
|
||||
*
|
||||
@@ -106,7 +106,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Company business name of the invoice recipient. 100 characters max.
|
||||
* The invoice recipient company business name. Maximum length is 100 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -116,7 +116,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of the invoice recipient.
|
||||
* The invoice recipient address.
|
||||
*
|
||||
* @param \PayPal\Api\InvoiceAddress $address
|
||||
*
|
||||
@@ -129,7 +129,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of the invoice recipient.
|
||||
* The invoice recipient address.
|
||||
*
|
||||
* @return \PayPal\Api\InvoiceAddress
|
||||
*/
|
||||
@@ -139,8 +139,8 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
|
||||
* Valid Values: ["da_DK", "de_DE", "en_AU", "en_GB", "en_US", "es_ES", "es_XC", "fr_CA", "fr_FR", "fr_XC", "he_IL", "id_ID", "it_IT", "ja_JP", "nl_NL", "no_NO", "pl_PL", "pt_BR", "pt_PT", "ru_RU", "sv_SE", "th_TH", "tr_TR", "zh_CN", "zh_HK", "zh_TW", "zh_XC"]
|
||||
* The language in which the email was sent to the payer. Used only when the payer does not have a PayPal account.
|
||||
* Valid Values: ["da_DK", "de_DE", "en_AU", "en_GB", "en_US", "es_ES", "es_XC", "fr_CA", "fr_FR", "fr_XC", "he_IL", "id_ID", "it_IT", "ja_JP", "nl_NL", "no_NO", "pl_PL", "pt_BR", "pt_PT", "ru_RU", "sv_SE", "th_TH", "zh_CN", "zh_HK", "zh_TW", "zh_XC"]
|
||||
*
|
||||
* @param string $language
|
||||
*
|
||||
@@ -153,7 +153,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Language of the email sent to the payer. Will only be used if payer doesn't have a PayPal account.
|
||||
* The language in which the email was sent to the payer. Used only when the payer does not have a PayPal account.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -163,7 +163,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Option to display additional information such as business hours. 40 characters max.
|
||||
* Additional information, such as business hours. Maximum length is 40 characters.
|
||||
*
|
||||
* @param string $additional_info
|
||||
*
|
||||
@@ -176,7 +176,7 @@ class BillingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Option to display additional information such as business hours. 40 characters max.
|
||||
* Additional information, such as business hours. Maximum length is 40 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -15,6 +15,7 @@ use PayPal\Common\PayPalModel;
|
||||
* @property string note
|
||||
* @property bool send_to_merchant
|
||||
* @property bool send_to_payer
|
||||
* @property string[] cc_emails
|
||||
*/
|
||||
class CancelNotification extends PayPalModel
|
||||
{
|
||||
@@ -65,7 +66,7 @@ class CancelNotification extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||
* Indicates whether to send a copy of the notification to the merchant.
|
||||
*
|
||||
* @param bool $send_to_merchant
|
||||
*
|
||||
@@ -78,7 +79,7 @@ class CancelNotification extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||
* Indicates whether to send a copy of the notification to the merchant.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -88,7 +89,7 @@ class CancelNotification extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether a copy of the email has to be sent to the payer.
|
||||
* Indicates whether to send a copy of the notification to the payer.
|
||||
*
|
||||
* @param bool $send_to_payer
|
||||
*
|
||||
@@ -101,7 +102,7 @@ class CancelNotification extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether a copy of the email has to be sent to the payer.
|
||||
* Indicates whether to send a copy of the notification to the payer.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -110,4 +111,57 @@ class CancelNotification extends PayPalModel
|
||||
return $this->send_to_payer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported.
|
||||
*
|
||||
* @param string[] $cc_emails
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCcEmails($cc_emails)
|
||||
{
|
||||
$this->cc_emails = $cc_emails;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCcEmails()
|
||||
{
|
||||
return $this->cc_emails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append CcEmails to the list.
|
||||
*
|
||||
* @param string $string
|
||||
* @return $this
|
||||
*/
|
||||
public function addCcEmail($string)
|
||||
{
|
||||
if (!$this->getCcEmails()) {
|
||||
return $this->setCcEmails(array($string));
|
||||
} else {
|
||||
return $this->setCcEmails(
|
||||
array_merge($this->getCcEmails(), array($string))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove CcEmails from the list.
|
||||
*
|
||||
* @param string $string
|
||||
* @return $this
|
||||
*/
|
||||
public function removeCcEmail($string)
|
||||
{
|
||||
return $this->setCcEmails(
|
||||
array_diff($this->getCcEmails(), array($string))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ use PayPal\Validation\NumericValidator;
|
||||
/**
|
||||
* Class Cost
|
||||
*
|
||||
* Cost as a percent. For example, 10% should be entered as 10. Alternatively, cost as an amount. For example, an amount of 5 should be entered as 5.
|
||||
* Cost as a percent or an amount. For example, to specify 10%, enter `10`. Alternatively, to specify an amount of 5, enter `5`.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -44,7 +44,7 @@ class Cost extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Cost in amount. Range of 0 to 999999.99.
|
||||
* The cost, as an amount. Valid range is from 0 to 1,000,000.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
@@ -57,7 +57,7 @@ class Cost extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Cost in amount. Range of 0 to 999999.99.
|
||||
* The cost, as an amount. Valid range is from 0 to 1,000,000.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ use PayPal\Common\PayPalModel;
|
||||
/**
|
||||
* Class CustomAmount
|
||||
*
|
||||
* Custom amount applied on an invoice. If a label is included then the amount cannot be empty.
|
||||
* The custom amount applied on an invoice. If you include a label, the amount cannot be empty.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -17,7 +17,7 @@ use PayPal\Common\PayPalModel;
|
||||
class CustomAmount extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Custom amount label. 25 characters max.
|
||||
* The custom amount label. Maximum length is 25 characters.
|
||||
*
|
||||
* @param string $label
|
||||
*
|
||||
@@ -30,7 +30,7 @@ class CustomAmount extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom amount label. 25 characters max.
|
||||
* The custom amount label. Maximum length is 25 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ class CustomAmount extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom amount value. Range of 0 to 999999.99.
|
||||
* The custom amount value. Valid range is from -999999.99 to 999999.99.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
@@ -53,7 +53,7 @@ class CustomAmount extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom amount value. Range of 0 to 999999.99.
|
||||
* The custom amount value. Valid range is from -999999.99 to 999999.99.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
|
||||
67
lib/PayPal/Api/FileAttachment.php
Normal file
67
lib/PayPal/Api/FileAttachment.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
* Class FileAttachment
|
||||
*
|
||||
* File attached to an invoice or template
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string name
|
||||
* @property string url
|
||||
*/
|
||||
class FileAttachment extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Name of the file attached.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the file attached.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL of the attached file that can be downloaded.
|
||||
*
|
||||
* @param string $url
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setUrl($url)
|
||||
{
|
||||
UrlValidator::validate($url, "Url");
|
||||
$this->url = $url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* URL of the attached file that can be downloaded.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->url;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,18 +17,22 @@ use PayPal\Validation\UrlValidator;
|
||||
*
|
||||
* @property string id
|
||||
* @property string number
|
||||
* @property string template_id
|
||||
* @property string uri
|
||||
* @property string status
|
||||
* @property \PayPal\Api\MerchantInfo merchant_info
|
||||
* @property \PayPal\Api\BillingInfo[] billing_info
|
||||
* @property \PayPal\Api\Participant[] cc_info
|
||||
* @property \PayPal\Api\ShippingInfo shipping_info
|
||||
* @property \PayPal\Api\InvoiceItem[] items
|
||||
* @property string invoice_date
|
||||
* @property \PayPal\Api\PaymentTerm payment_term
|
||||
* @property String reference
|
||||
* @property string reference
|
||||
* @property \PayPal\Api\Cost discount
|
||||
* @property \PayPal\Api\ShippingCost shipping_cost
|
||||
* @property \PayPal\Api\CustomAmount custom
|
||||
* @property bool allow_partial_payment
|
||||
* @property \PayPal\Api\Currency minimum_amount_due
|
||||
* @property bool tax_calculated_after_discount
|
||||
* @property bool tax_inclusive
|
||||
* @property string terms
|
||||
@@ -39,12 +43,14 @@ use PayPal\Validation\UrlValidator;
|
||||
* @property \PayPal\Api\PaymentDetail[] payments
|
||||
* @property \PayPal\Api\RefundDetail[] refunds
|
||||
* @property \PayPal\Api\Metadata metadata
|
||||
* @property string additional_data
|
||||
* @property \PayPal\Api\PaymentSummary paid_amount
|
||||
* @property \PayPal\Api\PaymentSummary refunded_amount
|
||||
* @property \PayPal\Api\FileAttachment[] attachments
|
||||
*/
|
||||
class Invoice extends PayPalResourceModel
|
||||
{
|
||||
/**
|
||||
* Unique invoice resource identifier.
|
||||
* The unique invoice resource identifier.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -57,7 +63,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique invoice resource identifier.
|
||||
* The unique invoice resource identifier.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -89,6 +95,29 @@ class Invoice extends PayPalResourceModel
|
||||
return $this->number;
|
||||
}
|
||||
|
||||
/**
|
||||
* The template ID used for the invoice. Useful for copy functionality.
|
||||
*
|
||||
* @param string $template_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTemplateId($template_id)
|
||||
{
|
||||
$this->template_id = $template_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The template ID used for the invoice. Useful for copy functionality.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTemplateId()
|
||||
{
|
||||
return $this->template_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* URI of the invoice resource.
|
||||
*
|
||||
@@ -114,7 +143,7 @@ class Invoice extends PayPalResourceModel
|
||||
|
||||
/**
|
||||
* Status of the invoice.
|
||||
* Valid Values: ["DRAFT", "SENT", "PAID", "MARKED_AS_PAID", "CANCELLED", "REFUNDED", "PARTIALLY_REFUNDED", "MARKED_AS_REFUNDED"]
|
||||
* Valid Values: ["DRAFT", "SENT", "PAID", "MARKED_AS_PAID", "CANCELLED", "REFUNDED", "PARTIALLY_REFUNDED", "MARKED_AS_REFUNDED", "UNPAID", "PAYMENT_PENDING"]
|
||||
*
|
||||
* @param string $status
|
||||
*
|
||||
@@ -160,7 +189,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of invoice recipient (required) and optional billing information. (Note: We currently only allow one recipient).
|
||||
* The required invoice recipient email address and any optional billing information. One recipient is supported.
|
||||
*
|
||||
* @param \PayPal\Api\BillingInfo[] $billing_info
|
||||
*
|
||||
@@ -173,7 +202,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of invoice recipient (required) and optional billing information. (Note: We currently only allow one recipient).
|
||||
* The required invoice recipient email address and any optional billing information. One recipient is supported.
|
||||
*
|
||||
* @return \PayPal\Api\BillingInfo[]
|
||||
*/
|
||||
@@ -213,7 +242,60 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping information for entities to whom items are being shipped.
|
||||
* For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant.
|
||||
*
|
||||
* @param \PayPal\Api\Participant[] $cc_info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCcInfo($cc_info)
|
||||
{
|
||||
$this->cc_info = $cc_info;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant.
|
||||
*
|
||||
* @return \PayPal\Api\Participant[]
|
||||
*/
|
||||
public function getCcInfo()
|
||||
{
|
||||
return $this->cc_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append CcInfo to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Participant $participant
|
||||
* @return $this
|
||||
*/
|
||||
public function addCcInfo($participant)
|
||||
{
|
||||
if (!$this->getCcInfo()) {
|
||||
return $this->setCcInfo(array($participant));
|
||||
} else {
|
||||
return $this->setCcInfo(
|
||||
array_merge($this->getCcInfo(), array($participant))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove CcInfo from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Participant $participant
|
||||
* @return $this
|
||||
*/
|
||||
public function removeCcInfo($participant)
|
||||
{
|
||||
return $this->setCcInfo(
|
||||
array_diff($this->getCcInfo(), array($participant))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The shipping information for entities to whom items are being shipped.
|
||||
*
|
||||
* @param \PayPal\Api\ShippingInfo $shipping_info
|
||||
*
|
||||
@@ -226,7 +308,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping information for entities to whom items are being shipped.
|
||||
* The shipping information for entities to whom items are being shipped.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingInfo
|
||||
*/
|
||||
@@ -236,7 +318,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List of items included in the invoice. 100 items max per invoice.
|
||||
* The list of items to include in the invoice. Maximum value is 100 items per invoice.
|
||||
*
|
||||
* @param \PayPal\Api\InvoiceItem[] $items
|
||||
*
|
||||
@@ -249,7 +331,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List of items included in the invoice. 100 items max per invoice.
|
||||
* The list of items to include in the invoice. Maximum value is 100 items per invoice.
|
||||
*
|
||||
* @return \PayPal\Api\InvoiceItem[]
|
||||
*/
|
||||
@@ -289,7 +371,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date on which the invoice was enabled. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the invoice was enabled. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $invoice_date
|
||||
*
|
||||
@@ -302,7 +384,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date on which the invoice was enabled. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the invoice was enabled. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -312,7 +394,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional field to pass payment deadline for the invoice. Either term_type or due_date can be passed, but not both.
|
||||
* Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentTerm $payment_term
|
||||
*
|
||||
@@ -325,7 +407,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional field to pass payment deadline for the invoice. Either term_type or due_date can be passed, but not both.
|
||||
* Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentTerm
|
||||
*/
|
||||
@@ -337,7 +419,7 @@ class Invoice extends PayPalResourceModel
|
||||
/**
|
||||
* Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters.
|
||||
*
|
||||
* @param String $reference
|
||||
* @param string $reference
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
@@ -350,7 +432,7 @@ class Invoice extends PayPalResourceModel
|
||||
/**
|
||||
* Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters.
|
||||
*
|
||||
* @return String
|
||||
* @return string
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
@@ -358,7 +440,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoice level discount in percent or amount.
|
||||
* The invoice level discount, as a percent or an amount value.
|
||||
*
|
||||
* @param \PayPal\Api\Cost $discount
|
||||
*
|
||||
@@ -371,7 +453,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Invoice level discount in percent or amount.
|
||||
* The invoice level discount, as a percent or an amount value.
|
||||
*
|
||||
* @return \PayPal\Api\Cost
|
||||
*/
|
||||
@@ -381,7 +463,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping cost in percent or amount.
|
||||
* The shipping cost, as a percent or an amount value.
|
||||
*
|
||||
* @param \PayPal\Api\ShippingCost $shipping_cost
|
||||
*
|
||||
@@ -394,7 +476,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping cost in percent or amount.
|
||||
* The shipping cost, as a percent or an amount value.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingCost
|
||||
*/
|
||||
@@ -404,7 +486,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom amount applied on an invoice. If a label is included then the amount cannot be empty.
|
||||
* The custom amount to apply on an invoice. If you include a label, the amount cannot be empty.
|
||||
*
|
||||
* @param \PayPal\Api\CustomAmount $custom
|
||||
*
|
||||
@@ -417,7 +499,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Custom amount applied on an invoice. If a label is included then the amount cannot be empty.
|
||||
* The custom amount to apply on an invoice. If you include a label, the amount cannot be empty.
|
||||
*
|
||||
* @return \PayPal\Api\CustomAmount
|
||||
*/
|
||||
@@ -427,7 +509,53 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether tax is calculated before or after a discount. If false (the default), the tax is calculated before a discount. If true, the tax is calculated after a discount.
|
||||
* Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`.
|
||||
*
|
||||
* @param bool $allow_partial_payment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAllowPartialPayment($allow_partial_payment)
|
||||
{
|
||||
$this->allow_partial_payment = $allow_partial_payment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getAllowPartialPayment()
|
||||
{
|
||||
return $this->allow_partial_payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $minimum_amount_due
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMinimumAmountDue($minimum_amount_due)
|
||||
{
|
||||
$this->minimum_amount_due = $minimum_amount_due;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getMinimumAmountDue()
|
||||
{
|
||||
return $this->minimum_amount_due;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`.
|
||||
*
|
||||
* @param bool $tax_calculated_after_discount
|
||||
*
|
||||
@@ -440,7 +568,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether tax is calculated before or after a discount. If false (the default), the tax is calculated before a discount. If true, the tax is calculated after a discount.
|
||||
* Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -450,7 +578,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether the unit price includes tax. Default is false
|
||||
* Indicates whether the unit price includes tax. Default is `false`.
|
||||
*
|
||||
* @param bool $tax_inclusive
|
||||
*
|
||||
@@ -463,7 +591,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether the unit price includes tax. Default is false
|
||||
* Indicates whether the unit price includes tax. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -519,7 +647,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Bookkeeping memo that is private to the merchant. 150 characters max.
|
||||
* A private bookkeeping memo for the merchant. Maximum length is 150 characters.
|
||||
*
|
||||
* @param string $merchant_memo
|
||||
*
|
||||
@@ -532,7 +660,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Bookkeeping memo that is private to the merchant. 150 characters max.
|
||||
* A private bookkeeping memo for the merchant. Maximum length is 150 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -542,7 +670,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Full URL of an external image to use as the logo. 4000 characters max.
|
||||
* Full URL of an external image to use as the logo. Maximum length is 4000 characters.
|
||||
*
|
||||
* @param string $logo_url
|
||||
* @throws \InvalidArgumentException
|
||||
@@ -556,7 +684,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Full URL of an external image to use as the logo. 4000 characters max.
|
||||
* Full URL of an external image to use as the logo. Maximum length is 4000 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -612,12 +740,12 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Append PaymentDetails to the list.
|
||||
* Append Payments to the list.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentDetail $paymentDetail
|
||||
* @return $this
|
||||
*/
|
||||
public function addPaymentDetail($paymentDetail)
|
||||
public function addPayment($paymentDetail)
|
||||
{
|
||||
if (!$this->getPayments()) {
|
||||
return $this->setPayments(array($paymentDetail));
|
||||
@@ -629,12 +757,12 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove PaymentDetails from the list.
|
||||
* Remove Payments from the list.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentDetail $paymentDetail
|
||||
* @return $this
|
||||
*/
|
||||
public function removePaymentDetail($paymentDetail)
|
||||
public function removePayment($paymentDetail)
|
||||
{
|
||||
return $this->setPayments(
|
||||
array_diff($this->getPayments(), array($paymentDetail))
|
||||
@@ -665,12 +793,12 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Append RefundDetails to the list.
|
||||
* Append Refunds to the list.
|
||||
*
|
||||
* @param \PayPal\Api\RefundDetail $refundDetail
|
||||
* @return $this
|
||||
*/
|
||||
public function addRefundDetail($refundDetail)
|
||||
public function addRefund($refundDetail)
|
||||
{
|
||||
if (!$this->getRefunds()) {
|
||||
return $this->setRefunds(array($refundDetail));
|
||||
@@ -682,12 +810,12 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove RefundDetails from the list.
|
||||
* Remove Refunds from the list.
|
||||
*
|
||||
* @param \PayPal\Api\RefundDetail $refundDetail
|
||||
* @return $this
|
||||
*/
|
||||
public function removeRefundDetail($refundDetail)
|
||||
public function removeRefund($refundDetail)
|
||||
{
|
||||
return $this->setRefunds(
|
||||
array_diff($this->getRefunds(), array($refundDetail))
|
||||
@@ -718,8 +846,8 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Any miscellaneous invoice data. 4000 characters max.
|
||||
*
|
||||
* Any miscellaneous invoice data. Maximum length is 4000 characters.
|
||||
* @deprecated Not publicly available
|
||||
* @param string $additional_data
|
||||
*
|
||||
* @return $this
|
||||
@@ -731,8 +859,8 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Any miscellaneous invoice data. 4000 characters max.
|
||||
*
|
||||
* Any miscellaneous invoice data. Maximum length is 4000 characters.
|
||||
* @deprecated Not publicly available
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalData()
|
||||
@@ -741,7 +869,106 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new invoice by passing the details for the invoice, including the merchant_info, to the request URI.
|
||||
* Payment summary of the invoice including amount paid through PayPal and other sources.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentSummary $paid_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaidAmount($paid_amount)
|
||||
{
|
||||
$this->paid_amount = $paid_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment summary of the invoice including amount paid through PayPal and other sources.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentSummary
|
||||
*/
|
||||
public function getPaidAmount()
|
||||
{
|
||||
return $this->paid_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment summary of the invoice including amount refunded through PayPal and other sources.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentSummary $refunded_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setRefundedAmount($refunded_amount)
|
||||
{
|
||||
$this->refunded_amount = $refunded_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment summary of the invoice including amount refunded through PayPal and other sources.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentSummary
|
||||
*/
|
||||
public function getRefundedAmount()
|
||||
{
|
||||
return $this->refunded_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of files attached to the invoice.
|
||||
*
|
||||
* @param \PayPal\Api\FileAttachment[] $attachments
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttachments($attachments)
|
||||
{
|
||||
$this->attachments = $attachments;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of files attached to the invoice.
|
||||
*
|
||||
* @return \PayPal\Api\FileAttachment[]
|
||||
*/
|
||||
public function getAttachments()
|
||||
{
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Attachments to the list.
|
||||
*
|
||||
* @param \PayPal\Api\FileAttachment $fileAttachment
|
||||
* @return $this
|
||||
*/
|
||||
public function addAttachment($fileAttachment)
|
||||
{
|
||||
if (!$this->getAttachments()) {
|
||||
return $this->setAttachments(array($fileAttachment));
|
||||
} else {
|
||||
return $this->setAttachments(
|
||||
array_merge($this->getAttachments(), array($fileAttachment))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Attachments from the list.
|
||||
*
|
||||
* @param \PayPal\Api\FileAttachment $fileAttachment
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAttachment($fileAttachment)
|
||||
{
|
||||
return $this->setAttachments(
|
||||
array_diff($this->getAttachments(), array($fileAttachment))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an invoice. Include invoice details including merchant information in the request.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
@@ -763,7 +990,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Search for a specific invoice or invoices by passing a search object that specifies your search criteria to the request URI.
|
||||
* Searches for an invoice or invoices. Include a search object that specifies your search criteria in the request.
|
||||
*
|
||||
* @param Search $search
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -788,7 +1015,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a specific invoice to its intended recipient by passing the invoice ID to the request URI. Optionally, you can specify whether to send the merchant an invoice update notification by using the notify_merchant query parameter. By default, notify_merchant is true.
|
||||
* Sends an invoice, by ID, to a recipient. Optionally, set the `notify_merchant` query parameter to send the merchant an invoice update notification. By default, `notify_merchant` is `true`.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
@@ -810,7 +1037,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a reminder about a specific invoice to its intended recipient by providing the ID of the invoice in the request URI. In addition, pass a notification object that specifies the subject of the reminder and other details in the request JSON.
|
||||
* Sends a reminder about a specific invoice, by ID, to a recipient. Include a notification object that defines the reminder subject and other details in the JSON request body.
|
||||
*
|
||||
* @param Notification $notification
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -834,7 +1061,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Cancel an invoice by passing the invoice ID to the request URI.
|
||||
* Cancels an invoice, by ID.
|
||||
*
|
||||
* @param CancelNotification $cancelNotification
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -858,7 +1085,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the status of an invoice as paid by passing the invoice ID to the request URI. In addition, pass a payment detail object that specifies the payment method and other details in the request JSON.
|
||||
* Marks the status of a specified invoice, by ID, as paid. Include a payment detail object that defines the payment method and other details in the JSON request body.
|
||||
*
|
||||
* @param PaymentDetail $paymentDetail
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -882,7 +1109,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Mark the status of an invoice as refunded by passing the invoice ID to the request URI. In addition, pass a refund-detail object that specifies the type of refund and other details in the request JSON.
|
||||
* Marks the status of a specified invoice, by ID, as refunded. Include a refund detail object that defines the refund type and other details in the JSON request body.
|
||||
*
|
||||
* @param RefundDetail $refundDetail
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -906,7 +1133,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve the details for a particular invoice by passing the invoice ID to the request URI.
|
||||
* Gets the details for a specified invoice, by ID.
|
||||
*
|
||||
* @param string $invoiceId
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -931,7 +1158,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* List some or all invoices for a merchant according to optional query string parameters specified.
|
||||
* Lists some or all merchant invoices. Filters the response by any specified optional query string parameters.
|
||||
*
|
||||
* @param array $params
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
@@ -963,7 +1190,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Fully update an invoice by passing the invoice ID to the request URI. In addition, pass a complete invoice object in the request JSON. Partial updates are not supported.
|
||||
* Fully updates an invoice by passing the invoice ID to the request URI. In addition, pass a complete invoice object in the request JSON. Does not support partial updates.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
@@ -986,7 +1213,7 @@ class Invoice extends PayPalResourceModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a particular invoice by passing the invoice ID to the request URI.
|
||||
* Deletes an invoice, by ID.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
@@ -1041,4 +1268,27 @@ class Invoice extends PayPalResourceModel
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the successive invoice number for the merchant.
|
||||
*
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return InvoiceNumber
|
||||
*/
|
||||
public static function generateNumber($apiContext = null, $restCall = null)
|
||||
{
|
||||
$payLoad = "";
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/invoices/next-invoice-number",
|
||||
"POST",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new InvoiceNumber();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ namespace PayPal\Api;
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Converter\FormatConverter;
|
||||
use PayPal\Validation\NumericValidator;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
* Class InvoiceItem
|
||||
@@ -20,11 +21,12 @@ use PayPal\Validation\NumericValidator;
|
||||
* @property \PayPal\Api\Tax tax
|
||||
* @property string date
|
||||
* @property \PayPal\Api\Cost discount
|
||||
* @property string unit_of_measure
|
||||
*/
|
||||
class InvoiceItem extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Name of the item. 60 characters max.
|
||||
* Name of the item. 200 characters max.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
@@ -37,7 +39,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the item. 60 characters max.
|
||||
* Name of the item. 200 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -70,7 +72,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Quantity of the item. Range of 0 to 9999.999.
|
||||
* Quantity of the item. Range of -10000 to 10000.
|
||||
*
|
||||
* @param string|double $quantity
|
||||
*
|
||||
@@ -85,7 +87,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Quantity of the item. Range of 0 to 9999.999.
|
||||
* Quantity of the item. Range of -10000 to 10000.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -95,7 +97,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit price of the item. Range of -999999.99 to 999999.99.
|
||||
* Unit price of the item. Range of -1,000,000 to 1,000,000.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $unit_price
|
||||
*
|
||||
@@ -108,7 +110,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit price of the item. Range of -999999.99 to 999999.99.
|
||||
* Unit price of the item. Range of -1,000,000 to 1,000,000.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
@@ -141,7 +143,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date on which the item or service was provided. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the item or service was provided. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $date
|
||||
*
|
||||
@@ -154,7 +156,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date on which the item or service was provided. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the item or service was provided. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -164,7 +166,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Item discount in percent or amount.
|
||||
* The item discount, as a percent or an amount value.
|
||||
*
|
||||
* @param \PayPal\Api\Cost $discount
|
||||
*
|
||||
@@ -177,7 +179,7 @@ class InvoiceItem extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Item discount in percent or amount.
|
||||
* The item discount, as a percent or an amount value.
|
||||
*
|
||||
* @return \PayPal\Api\Cost
|
||||
*/
|
||||
@@ -186,4 +188,52 @@ class InvoiceItem extends PayPalModel
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* The image URL. Maximum length is 4000 characters.
|
||||
* @deprecated Not publicly available
|
||||
* @param string $image_url
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setImageUrl($image_url)
|
||||
{
|
||||
UrlValidator::validate($image_url, "ImageUrl");
|
||||
$this->image_url = $image_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The image URL. Maximum length is 4000 characters.
|
||||
* @deprecated Not publicly available
|
||||
* @return string
|
||||
*/
|
||||
public function getImageUrl()
|
||||
{
|
||||
return $this->image_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unit of measure of the item being invoiced.
|
||||
* Valid Values: ["QUANTITY", "HOURS", "AMOUNT"]
|
||||
*
|
||||
* @param string $unit_of_measure
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUnitOfMeasure($unit_of_measure)
|
||||
{
|
||||
$this->unit_of_measure = $unit_of_measure;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unit of measure of the item being invoiced.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUnitOfMeasure()
|
||||
{
|
||||
return $this->unit_of_measure;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
38
lib/PayPal/Api/InvoiceNumber.php
Normal file
38
lib/PayPal/Api/InvoiceNumber.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class InvoiceNumber
|
||||
*
|
||||
* The next invoice number
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string number
|
||||
*/
|
||||
class InvoiceNumber extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* The next invoice number.
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNumber($number) {
|
||||
$this->number = $number;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The next invoice number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNumber() {
|
||||
return $this->number;
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use PayPal\Common\PayPalModel;
|
||||
/**
|
||||
* Class MerchantInfo
|
||||
*
|
||||
* Business information of the merchant that will appear on the invoice.
|
||||
* Merchant business information that appears on the invoice.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -20,12 +20,13 @@ use PayPal\Common\PayPalModel;
|
||||
* @property \PayPal\Api\Phone fax
|
||||
* @property string website
|
||||
* @property string tax_id
|
||||
* @property string additional_info_label
|
||||
* @property string additional_info
|
||||
*/
|
||||
class MerchantInfo extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Email address of the merchant. 260 characters max.
|
||||
* The merchant email address. Maximum length is 260 characters.
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
@@ -38,7 +39,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the merchant. 260 characters max.
|
||||
* The merchant email address. Maximum length is 260 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -48,7 +49,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* First name of the merchant. 30 characters max.
|
||||
* The merchant first name. Maximum length is 30 characters.
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -61,7 +62,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* First name of the merchant. 30 characters max.
|
||||
* The merchant first name. Maximum length is 30 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -71,7 +72,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Last name of the merchant. 30 characters max.
|
||||
* The merchant last name. Maximum length is 30 characters.
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -84,7 +85,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Last name of the merchant. 30 characters max.
|
||||
* The merchant last name. Maximum length is 30 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -94,7 +95,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of the merchant.
|
||||
* The merchant address.
|
||||
*
|
||||
* @param \PayPal\Api\InvoiceAddress $address
|
||||
*
|
||||
@@ -107,7 +108,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of the merchant.
|
||||
* The merchant address.
|
||||
*
|
||||
* @return \PayPal\Api\InvoiceAddress
|
||||
*/
|
||||
@@ -117,7 +118,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Company business name of the merchant. 100 characters max.
|
||||
* The merchant company business name. Maximum length is 100 characters.
|
||||
*
|
||||
* @param string $business_name
|
||||
*
|
||||
@@ -130,7 +131,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Company business name of the merchant. 100 characters max.
|
||||
* The merchant company business name. Maximum length is 100 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -140,7 +141,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone number of the merchant.
|
||||
* The merchant phone number.
|
||||
*
|
||||
* @param \PayPal\Api\Phone $phone
|
||||
*
|
||||
@@ -153,7 +154,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Phone number of the merchant.
|
||||
* The merchant phone number.
|
||||
*
|
||||
* @return \PayPal\Api\Phone
|
||||
*/
|
||||
@@ -163,7 +164,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Fax number of the merchant.
|
||||
* The merchant fax number.
|
||||
*
|
||||
* @param \PayPal\Api\Phone $fax
|
||||
*
|
||||
@@ -176,7 +177,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Fax number of the merchant.
|
||||
* The merchant fax number.
|
||||
*
|
||||
* @return \PayPal\Api\Phone
|
||||
*/
|
||||
@@ -186,7 +187,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Website of the merchant. 2048 characters max.
|
||||
* The merchant website. Maximum length is 2048 characters.
|
||||
*
|
||||
* @param string $website
|
||||
*
|
||||
@@ -199,7 +200,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Website of the merchant. 2048 characters max.
|
||||
* The merchant website. Maximum length is 2048 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -209,7 +210,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax ID of the merchant. 100 characters max.
|
||||
* The merchant tax ID. Maximum length is 100 characters.
|
||||
*
|
||||
* @param string $tax_id
|
||||
*
|
||||
@@ -222,7 +223,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax ID of the merchant. 100 characters max.
|
||||
* The merchant tax ID. Maximum length is 100 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -232,7 +233,30 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Option to display additional information such as business hours. 40 characters max.
|
||||
* Option to provide a label to the additional_info field. 40 characters max.
|
||||
*
|
||||
* @param string $additional_info_label
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAdditionalInfoLabel($additional_info_label)
|
||||
{
|
||||
$this->additional_info_label = $additional_info_label;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Option to provide a label to the additional_info field. 40 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalInfoLabel()
|
||||
{
|
||||
return $this->additional_info_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional information, such as business hours. Maximum length is 40 characters.
|
||||
*
|
||||
* @param string $additional_info
|
||||
*
|
||||
@@ -245,7 +269,7 @@ class MerchantInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Option to display additional information such as business hours. 40 characters max.
|
||||
* Additional information, such as business hours. Maximum length is 40 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,7 @@ use PayPal\Validation\UrlValidator;
|
||||
/**
|
||||
* Class Metadata
|
||||
*
|
||||
* Audit information of the resource.
|
||||
* Audit information for the resource.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -26,7 +26,7 @@ use PayPal\Validation\UrlValidator;
|
||||
class Metadata extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Date when the resource was created.
|
||||
* The date and time when the resource was created.
|
||||
*
|
||||
* @param string $created_date
|
||||
*
|
||||
@@ -39,7 +39,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was created.
|
||||
* The date and time when the resource was created.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -49,7 +49,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the account that created the resource.
|
||||
* The email address of the account that created the resource.
|
||||
*
|
||||
* @param string $created_by
|
||||
*
|
||||
@@ -62,7 +62,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the account that created the resource.
|
||||
* The email address of the account that created the resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -72,7 +72,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was cancelled.
|
||||
* The date and time when the resource was cancelled.
|
||||
*
|
||||
* @param string $cancelled_date
|
||||
*
|
||||
@@ -85,7 +85,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was cancelled.
|
||||
* The date and time when the resource was cancelled.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -95,7 +95,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Actor who cancelled the resource.
|
||||
* The actor who cancelled the resource.
|
||||
*
|
||||
* @param string $cancelled_by
|
||||
*
|
||||
@@ -108,7 +108,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Actor who cancelled the resource.
|
||||
* The actor who cancelled the resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -118,7 +118,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was last edited.
|
||||
* The date and time when the resource was last edited.
|
||||
*
|
||||
* @param string $last_updated_date
|
||||
*
|
||||
@@ -131,7 +131,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was last edited.
|
||||
* The date and time when the resource was last edited.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -141,7 +141,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the account that last edited the resource.
|
||||
* The email address of the account that last edited the resource.
|
||||
*
|
||||
* @param string $last_updated_by
|
||||
*
|
||||
@@ -154,7 +154,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the account that last edited the resource.
|
||||
* The email address of the account that last edited the resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -164,7 +164,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was first sent.
|
||||
* The date and time when the resource was first sent.
|
||||
*
|
||||
* @param string $first_sent_date
|
||||
*
|
||||
@@ -177,7 +177,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was first sent.
|
||||
* The date and time when the resource was first sent.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -187,7 +187,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was last sent.
|
||||
* The date and time when the resource was last sent.
|
||||
*
|
||||
* @param string $last_sent_date
|
||||
*
|
||||
@@ -200,7 +200,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the resource was last sent.
|
||||
* The date and time when the resource was last sent.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -210,7 +210,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the account that last sent the resource.
|
||||
* The email address of the account that last sent the resource.
|
||||
*
|
||||
* @param string $last_sent_by
|
||||
*
|
||||
@@ -223,7 +223,7 @@ class Metadata extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Email address of the account that last sent the resource.
|
||||
* The email address of the account that last sent the resource.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ use PayPal\Common\PayPalModel;
|
||||
* @property string subject
|
||||
* @property string note
|
||||
* @property bool send_to_merchant
|
||||
* @property string[] cc_emails
|
||||
*/
|
||||
class Notification extends PayPalModel
|
||||
{
|
||||
@@ -64,7 +65,7 @@ class Notification extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||
* Indicates whether to send a copy of the email to the merchant.
|
||||
*
|
||||
* @param bool $send_to_merchant
|
||||
*
|
||||
@@ -77,7 +78,7 @@ class Notification extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether a copy of the email has to be sent to the merchant.
|
||||
* Indicates whether to send a copy of the email to the merchant.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -86,4 +87,57 @@ class Notification extends PayPalModel
|
||||
return $this->send_to_merchant;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported.
|
||||
*
|
||||
* @param string[] $cc_emails
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCcEmails($cc_emails)
|
||||
{
|
||||
$this->cc_emails = $cc_emails;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applicable for invoices created with Cc emails. If this field is not in the body, all the cc email addresses added as part of the invoice shall be notified else this field can be used to limit the list of email addresses. Note: additional email addresses are not supported.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCcEmails()
|
||||
{
|
||||
return $this->cc_emails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append CcEmails to the list.
|
||||
*
|
||||
* @param string $string
|
||||
* @return $this
|
||||
*/
|
||||
public function addCcEmail($string)
|
||||
{
|
||||
if (!$this->getCcEmails()) {
|
||||
return $this->setCcEmails(array($string));
|
||||
} else {
|
||||
return $this->setCcEmails(
|
||||
array_merge($this->getCcEmails(), array($string))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove CcEmails from the list.
|
||||
*
|
||||
* @param string $string
|
||||
* @return $this
|
||||
*/
|
||||
public function removeCcEmail($string)
|
||||
{
|
||||
return $this->setCcEmails(
|
||||
array_diff($this->getCcEmails(), array($string))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
233
lib/PayPal/Api/Participant.php
Normal file
233
lib/PayPal/Api/Participant.php
Normal file
@@ -0,0 +1,233 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class Participant
|
||||
*
|
||||
* Participant information.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string email
|
||||
* @property string first_name
|
||||
* @property string last_name
|
||||
* @property string business_name
|
||||
* @property \PayPal\Api\Phone phone
|
||||
* @property \PayPal\Api\Phone fax
|
||||
* @property string website
|
||||
* @property string additional_info
|
||||
* @property \PayPal\Api\Address address
|
||||
*/
|
||||
class Participant extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* The participant email address.
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmail($email)
|
||||
{
|
||||
$this->email = $email;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant email address.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->email;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant first name.
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFirstName($first_name)
|
||||
{
|
||||
$this->first_name = $first_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant first name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFirstName()
|
||||
{
|
||||
return $this->first_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant last name.
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setLastName($last_name)
|
||||
{
|
||||
$this->last_name = $last_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant last name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLastName()
|
||||
{
|
||||
return $this->last_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant company business name.
|
||||
*
|
||||
* @param string $business_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBusinessName($business_name)
|
||||
{
|
||||
$this->business_name = $business_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant company business name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getBusinessName()
|
||||
{
|
||||
return $this->business_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant phone number.
|
||||
*
|
||||
* @param \PayPal\Api\Phone $phone
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhone($phone)
|
||||
{
|
||||
$this->phone = $phone;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant phone number.
|
||||
*
|
||||
* @return \PayPal\Api\Phone
|
||||
*/
|
||||
public function getPhone()
|
||||
{
|
||||
return $this->phone;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant fax number.
|
||||
*
|
||||
* @param \PayPal\Api\Phone $fax
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFax($fax)
|
||||
{
|
||||
$this->fax = $fax;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant fax number.
|
||||
*
|
||||
* @return \PayPal\Api\Phone
|
||||
*/
|
||||
public function getFax()
|
||||
{
|
||||
return $this->fax;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant website.
|
||||
*
|
||||
* @param string $website
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setWebsite($website)
|
||||
{
|
||||
$this->website = $website;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant website.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getWebsite()
|
||||
{
|
||||
return $this->website;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional information, such as business hours.
|
||||
*
|
||||
* @param string $additional_info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAdditionalInfo($additional_info)
|
||||
{
|
||||
$this->additional_info = $additional_info;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Additional information, such as business hours.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAdditionalInfo()
|
||||
{
|
||||
return $this->additional_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant address.
|
||||
*
|
||||
* @param \PayPal\Api\Address $address
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAddress($address)
|
||||
{
|
||||
$this->address = $address;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The participant address.
|
||||
*
|
||||
* @return \PayPal\Api\Address
|
||||
*/
|
||||
public function getAddress()
|
||||
{
|
||||
return $this->address;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,11 +17,12 @@ use PayPal\Common\PayPalModel;
|
||||
* @property string date
|
||||
* @property string method
|
||||
* @property string note
|
||||
* @property \PayPal\Api\Currency amount
|
||||
*/
|
||||
class PaymentDetail extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
||||
* The PayPal payment detail. Indicates whether payment was made in an invoicing flow through PayPal or externally. In the case of the mark-as-paid API, the supported payment type is `EXTERNAL`. For backward compatibility, the `PAYPAL` payment type is still supported.
|
||||
* Valid Values: ["PAYPAL", "EXTERNAL"]
|
||||
*
|
||||
* @param string $type
|
||||
@@ -35,7 +36,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* PayPal payment detail indicating whether payment was made in an invoicing flow via PayPal or externally. In the case of the mark-as-paid API, payment type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
||||
* The PayPal payment detail. Indicates whether payment was made in an invoicing flow through PayPal or externally. In the case of the mark-as-paid API, the supported payment type is `EXTERNAL`. For backward compatibility, the `PAYPAL` payment type is still supported.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -45,7 +46,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
|
||||
* The PayPal payment transaction ID. Required with the `PAYPAL` payment type.
|
||||
*
|
||||
* @param string $transaction_id
|
||||
*
|
||||
@@ -58,7 +59,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* PayPal payment transaction id. Mandatory field in case the type value is PAYPAL.
|
||||
* The PayPal payment transaction ID. Required with the `PAYPAL` payment type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -92,7 +93,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the invoice was paid. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the invoice was paid. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $date
|
||||
*
|
||||
@@ -105,7 +106,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the invoice was paid. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the invoice was paid. The date format is *yyyy*-*MM*-*dd* *z* as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -115,7 +116,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment mode or method. This field is mandatory if the value of the type field is EXTERNAL.
|
||||
* The payment mode or method. Required with the `EXTERNAL` payment type.
|
||||
* Valid Values: ["BANK_TRANSFER", "CASH", "CHECK", "CREDIT_CARD", "DEBIT_CARD", "PAYPAL", "WIRE_TRANSFER", "OTHER"]
|
||||
*
|
||||
* @param string $method
|
||||
@@ -129,7 +130,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Payment mode or method. This field is mandatory if the value of the type field is EXTERNAL.
|
||||
* The payment mode or method. Required with the `EXTERNAL` payment type.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -139,7 +140,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional note associated with the payment.
|
||||
* Optional. A note associated with the payment.
|
||||
*
|
||||
* @param string $note
|
||||
*
|
||||
@@ -152,7 +153,7 @@ class PaymentDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional note associated with the payment.
|
||||
* Optional. A note associated with the payment.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -161,4 +162,27 @@ class PaymentDetail extends PayPalModel
|
||||
return $this->note;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount to record as payment against invoice. If you omit this parameter, the total invoice amount is recorded as payment.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The amount to record as payment against invoice. If you omit this parameter, the total invoice amount is recorded as payment.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
65
lib/PayPal/Api/PaymentSummary.php
Normal file
65
lib/PayPal/Api/PaymentSummary.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class PaymentSummary
|
||||
*
|
||||
* Payment/Refund break up
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Currency paypal
|
||||
* @property \PayPal\Api\Currency other
|
||||
*/
|
||||
class PaymentSummary extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Total Amount paid/refunded via PayPal.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $paypal
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaypal($paypal)
|
||||
{
|
||||
$this->paypal = $paypal;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total Amount paid/refunded via PayPal.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getPaypal()
|
||||
{
|
||||
return $this->paypal;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total Amount paid/refunded via other sources.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $other
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setOther($other)
|
||||
{
|
||||
$this->other = $other;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Total Amount paid/refunded via other sources.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getOther()
|
||||
{
|
||||
return $this->other;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,7 +7,7 @@ use PayPal\Common\PayPalModel;
|
||||
/**
|
||||
* Class PaymentTerm
|
||||
*
|
||||
* Payment term of the invoice. If term_type is present, due_date must not be present and vice versa.
|
||||
* The payment term of the invoice. If you specify `term_type`, you cannot specify `due_date` and vice versa.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -17,8 +17,8 @@ use PayPal\Common\PayPalModel;
|
||||
class PaymentTerm extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Terms by which the invoice payment is due.
|
||||
* Valid Values: ["DUE_ON_RECEIPT", "NET_10", "NET_15", "NET_30", "NET_45"]
|
||||
* The terms by which the invoice payment is due.
|
||||
* Valid Values: ["DUE_ON_RECEIPT", "DUE_ON_DATE_SPECIFIED", "NET_10", "NET_15", "NET_30", "NET_45", "NET_60", "NET_90", "NO_DUE_DATE"]
|
||||
*
|
||||
* @param string $term_type
|
||||
*
|
||||
@@ -31,7 +31,7 @@ class PaymentTerm extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Terms by which the invoice payment is due.
|
||||
* The terms by which the invoice payment is due.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ class PaymentTerm extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date on which invoice payment is due. It must be always a future date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the invoice payment is due. This date must be a future date. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $due_date
|
||||
*
|
||||
@@ -54,7 +54,7 @@ class PaymentTerm extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date on which invoice payment is due. It must be always a future date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The date when the invoice payment is due. This date must be a future date. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@ use PayPal\Common\PayPalModel;
|
||||
/**
|
||||
* Class Phone
|
||||
*
|
||||
* Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet.
|
||||
* Representation of a phone number.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -18,7 +18,7 @@ use PayPal\Common\PayPalModel;
|
||||
class Phone extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Country code (from in E.164 format)
|
||||
* The country calling code (CC) as defined by E.164. The combined length of CC+national cannot be more than 15 digits.
|
||||
*
|
||||
* @param string $country_code
|
||||
*
|
||||
@@ -31,7 +31,7 @@ class Phone extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Country code (from in E.164 format)
|
||||
* The country calling code (CC) as defined by E.164. The combined length of CC+national cannot be more than 15 digits.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -41,7 +41,7 @@ class Phone extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* In-country phone number (from in E.164 format)
|
||||
* The national number as defined by E.164. The combined length of CC+national cannot be more than 15 digits. A national number consists of National Destination Code (NDC) and Subscriber Number (SN).
|
||||
*
|
||||
* @param string $national_number
|
||||
*
|
||||
@@ -54,7 +54,7 @@ class Phone extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* In-country phone number (from in E.164 format)
|
||||
* The national number as defined by E.164. The combined length of CC+national cannot be more than 15 digits. A national number consists of National Destination Code (NDC) and Subscriber Number (SN).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
|
||||
@@ -14,11 +14,12 @@ use PayPal\Common\PayPalModel;
|
||||
* @property string type
|
||||
* @property string date
|
||||
* @property string note
|
||||
* @property \PayPal\Api\Currency amount
|
||||
*/
|
||||
class RefundDetail extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* PayPal refund type indicating whether refund was done in invoicing flow via PayPal or externally. In the case of the mark-as-refunded API, refund type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
||||
* The PayPal refund type. Indicates whether refund was paid in invoicing flow through PayPal or externally. In the case of mark-as-refunded API, the supported refund type is `EXTERNAL`. For backward compatability, the `PAYPAL` refund type is still supported.
|
||||
* Valid Values: ["PAYPAL", "EXTERNAL"]
|
||||
*
|
||||
* @param string $type
|
||||
@@ -32,7 +33,7 @@ class RefundDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* PayPal refund type indicating whether refund was done in invoicing flow via PayPal or externally. In the case of the mark-as-refunded API, refund type is EXTERNAL and this is what is now supported. The PAYPAL value is provided for backward compatibility.
|
||||
* The PayPal refund type. Indicates whether refund was paid in invoicing flow through PayPal or externally. In the case of mark-as-refunded API, the supported refund type is `EXTERNAL`. For backward compatability, the `PAYPAL` refund type is still supported.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -42,7 +43,7 @@ class RefundDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* Date on which the invoice was refunded. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||
*
|
||||
* @param string $date
|
||||
*
|
||||
@@ -55,7 +56,7 @@ class RefundDetail extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Date when the invoice was marked as refunded. If no date is specified, the current date and time is used as the default. In addition, the date must be after the invoice payment date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* Date on which the invoice was refunded. Date format: yyyy-MM-dd z. For example, 2014-02-27 PST.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -87,4 +88,27 @@ class RefundDetail extends PayPalModel
|
||||
return $this->note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount to be recorded as refund against invoice. If this field is not passed, the total invoice paid amount is recorded as refund.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAmount($amount)
|
||||
{
|
||||
$this->amount = $amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Amount to be recorded as refund against invoice. If this field is not passed, the total invoice paid amount is recorded as refund.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getAmount()
|
||||
{
|
||||
return $this->amount;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -30,11 +30,12 @@ use PayPal\Common\PayPalModel;
|
||||
* @property \PayPal\Api\number page
|
||||
* @property \PayPal\Api\number page_size
|
||||
* @property bool total_count_required
|
||||
* @property bool archived
|
||||
*/
|
||||
class Search extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Initial letters of the email address.
|
||||
* The initial letters of the email address.
|
||||
*
|
||||
* @param string $email
|
||||
*
|
||||
@@ -47,7 +48,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the email address.
|
||||
* The initial letters of the email address.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -57,7 +58,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the recipient's first name.
|
||||
* The initial letters of the recipient's first name.
|
||||
*
|
||||
* @param string $recipient_first_name
|
||||
*
|
||||
@@ -70,7 +71,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the recipient's first name.
|
||||
* The initial letters of the recipient's first name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -80,7 +81,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the recipient's last name.
|
||||
* The initial letters of the recipient's last name.
|
||||
*
|
||||
* @param string $recipient_last_name
|
||||
*
|
||||
@@ -93,7 +94,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the recipient's last name.
|
||||
* The initial letters of the recipient's last name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -103,7 +104,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the recipient's business name.
|
||||
* The initial letters of the recipient's business name.
|
||||
*
|
||||
* @param string $recipient_business_name
|
||||
*
|
||||
@@ -116,7 +117,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Initial letters of the recipient's business name.
|
||||
* The initial letters of the recipient's business name.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -126,7 +127,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* The invoice number that appears on the invoice.
|
||||
* The invoice number.
|
||||
*
|
||||
* @param string $number
|
||||
*
|
||||
@@ -139,7 +140,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* The invoice number that appears on the invoice.
|
||||
* The invoice number.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -149,7 +150,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of the invoice.
|
||||
* The invoice status.
|
||||
* Valid Values: ["DRAFT", "SENT", "PAID", "MARKED_AS_PAID", "CANCELLED", "REFUNDED", "PARTIALLY_REFUNDED", "MARKED_AS_REFUNDED"]
|
||||
*
|
||||
* @param string $status
|
||||
@@ -163,7 +164,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Status of the invoice.
|
||||
* The invoice status.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -173,7 +174,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower limit of total amount.
|
||||
* The lower limit of the total amount.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $lower_total_amount
|
||||
*
|
||||
@@ -186,7 +187,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Lower limit of total amount.
|
||||
* The lower limit of the total amount.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
@@ -196,7 +197,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Upper limit of total amount.
|
||||
* The upper limit of total amount.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $upper_total_amount
|
||||
*
|
||||
@@ -209,7 +210,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Upper limit of total amount.
|
||||
* The upper limit of total amount.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
@@ -219,7 +220,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $start_invoice_date
|
||||
*
|
||||
@@ -232,7 +233,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -242,7 +243,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $end_invoice_date
|
||||
*
|
||||
@@ -255,7 +256,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -265,7 +266,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice due date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $start_due_date
|
||||
*
|
||||
@@ -278,7 +279,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice due date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -288,7 +289,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice due date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $end_due_date
|
||||
*
|
||||
@@ -301,7 +302,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice due date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end due date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -311,7 +312,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice payment date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $start_payment_date
|
||||
*
|
||||
@@ -324,7 +325,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice payment date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -334,7 +335,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice payment date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $end_payment_date
|
||||
*
|
||||
@@ -347,7 +348,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice payment date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end payment date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -357,7 +358,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice creation date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $start_creation_date
|
||||
*
|
||||
@@ -370,7 +371,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Start invoice creation date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The start creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -380,7 +381,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice creation date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @param string $end_creation_date
|
||||
*
|
||||
@@ -393,7 +394,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* End invoice creation date. Date format yyyy-MM-dd z, as defined in [ISO8601](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
* The end creation date for the invoice. Date format is *yyyy*-*MM*-*dd* *z*, as defined in [Internet Date/Time Format](http://tools.ietf.org/html/rfc3339#section-5.6).
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -403,7 +404,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset of the search results.
|
||||
* The offset for the search results.
|
||||
*
|
||||
* @param \PayPal\Api\number $page
|
||||
*
|
||||
@@ -416,7 +417,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Offset of the search results.
|
||||
* The offset for the search results.
|
||||
*
|
||||
* @return \PayPal\Api\number
|
||||
*/
|
||||
@@ -426,7 +427,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Page size of the search results.
|
||||
* The page size for the search results.
|
||||
*
|
||||
* @param \PayPal\Api\number $page_size
|
||||
*
|
||||
@@ -439,7 +440,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Page size of the search results.
|
||||
* The page size for the search results.
|
||||
*
|
||||
* @return \PayPal\Api\number
|
||||
*/
|
||||
@@ -449,7 +450,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether total count is required in the response.
|
||||
* Indicates whether the total count appears in the response. Default is `false`.
|
||||
*
|
||||
* @param bool $total_count_required
|
||||
*
|
||||
@@ -462,7 +463,7 @@ class Search extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether total count is required in the response.
|
||||
* Indicates whether the total count appears in the response. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
@@ -471,4 +472,27 @@ class Search extends PayPalModel
|
||||
return $this->total_count_required;
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether search is on invoices archived by merchant. true - returns archived / false returns unarchived / null returns all.
|
||||
*
|
||||
* @param bool $archived
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setArchived($archived)
|
||||
{
|
||||
$this->archived = $archived;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A flag indicating whether search is on invoices archived by merchant. true - returns archived / false returns unarchived / null returns all.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getArchived()
|
||||
{
|
||||
return $this->archived;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ use PayPal\Common\PayPalModel;
|
||||
/**
|
||||
* Class ShippingCost
|
||||
*
|
||||
* Shipping cost in percent or amount.
|
||||
* Shipping cost, as a percent or an amount.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
@@ -17,7 +17,7 @@ use PayPal\Common\PayPalModel;
|
||||
class ShippingCost extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Shipping cost in amount. Range of 0 to 999999.99.
|
||||
* The shipping cost, as an amount. Valid range is from 0 to 999999.99.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
@@ -30,7 +30,7 @@ class ShippingCost extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Shipping cost in amount. Range of 0 to 999999.99.
|
||||
* The shipping cost, as an amount. Valid range is from 0 to 999999.99.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
@@ -40,7 +40,7 @@ class ShippingCost extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax percentage on shipping amount.
|
||||
* The tax percentage on the shipping amount.
|
||||
*
|
||||
* @param \PayPal\Api\Tax $tax
|
||||
*
|
||||
@@ -53,7 +53,7 @@ class ShippingCost extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax percentage on shipping amount.
|
||||
* The tax percentage on the shipping amount.
|
||||
*
|
||||
* @return \PayPal\Api\Tax
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ use PayPal\Common\PayPalModel;
|
||||
class ShippingInfo extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* First name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient first name. Maximum length is 30 characters.
|
||||
*
|
||||
* @param string $first_name
|
||||
*
|
||||
@@ -33,7 +33,7 @@ class ShippingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* First name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient first name. Maximum length is 30 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -43,7 +43,7 @@ class ShippingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Last name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient last name. Maximum length is 30 characters.
|
||||
*
|
||||
* @param string $last_name
|
||||
*
|
||||
@@ -56,7 +56,7 @@ class ShippingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Last name of the invoice recipient. 30 characters max.
|
||||
* The invoice recipient last name. Maximum length is 30 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -66,7 +66,7 @@ class ShippingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Company business name of the invoice recipient. 100 characters max.
|
||||
* The invoice recipient company business name. Maximum length is 100 characters.
|
||||
*
|
||||
* @param string $business_name
|
||||
*
|
||||
@@ -79,7 +79,7 @@ class ShippingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Company business name of the invoice recipient. 100 characters max.
|
||||
* The invoice recipient company business name. Maximum length is 100 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -146,7 +146,7 @@ class ShippingInfo extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Address of the invoice recipient.
|
||||
* The invoice recipient address.
|
||||
*
|
||||
* @return \PayPal\Api\InvoiceAddress
|
||||
*/
|
||||
|
||||
@@ -21,7 +21,7 @@ use PayPal\Validation\NumericValidator;
|
||||
class Tax extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Identifier of the resource.
|
||||
* The resource ID.
|
||||
*
|
||||
* @param string $id
|
||||
*
|
||||
@@ -34,7 +34,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Identifier of the resource.
|
||||
* The resource ID.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the tax. 10 characters max.
|
||||
* The tax name. Maximum length is 20 characters.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
@@ -57,7 +57,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the tax. 10 characters max.
|
||||
* The tax name. Maximum length is 20 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -67,7 +67,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Rate of the specified tax. Range of 0.001 to 99.999.
|
||||
* The rate of the specified tax. Valid range is from 0.001 to 99.999.
|
||||
*
|
||||
* @param string|double $percent
|
||||
*
|
||||
@@ -82,7 +82,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Rate of the specified tax. Range of 0.001 to 99.999.
|
||||
* The rate of the specified tax. Valid range is from 0.001 to 99.999.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -92,7 +92,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax in the form of money. Cannot be specified in a request.
|
||||
* The tax as a monetary amount. Cannot be specified in a request.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $amount
|
||||
*
|
||||
@@ -105,7 +105,7 @@ class Tax extends PayPalModel
|
||||
}
|
||||
|
||||
/**
|
||||
* Tax in the form of money. Cannot be specified in a request.
|
||||
* The tax as a monetary amount. Cannot be specified in a request.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
|
||||
215
lib/PayPal/Api/Template.php
Normal file
215
lib/PayPal/Api/Template.php
Normal file
@@ -0,0 +1,215 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class Template
|
||||
*
|
||||
* Invoicing Template
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string template_id
|
||||
* @property string name
|
||||
* @property bool default
|
||||
* @property \PayPal\Api\TemplateData template_data
|
||||
* @property \PayPal\Api\TemplateSettings[] settings
|
||||
* @property string unit_of_measure
|
||||
* @property bool custom
|
||||
*/
|
||||
class Template extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Unique identifier id of the template.
|
||||
*
|
||||
* @param string $template_id
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTemplateId($template_id)
|
||||
{
|
||||
$this->template_id = $template_id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unique identifier id of the template.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTemplateId()
|
||||
{
|
||||
return $this->template_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the template.
|
||||
*
|
||||
* @param string $name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Name of the template.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that this template is merchant's default. There can be only one template which can be a default.
|
||||
*
|
||||
* @param bool $default
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDefault($default)
|
||||
{
|
||||
$this->default = $default;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates that this template is merchant's default. There can be only one template which can be a default.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getDefault()
|
||||
{
|
||||
return $this->default;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customized invoice data which is saved as template
|
||||
*
|
||||
* @param \PayPal\Api\TemplateData $template_data
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTemplateData($template_data)
|
||||
{
|
||||
$this->template_data = $template_data;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Customized invoice data which is saved as template
|
||||
*
|
||||
* @return \PayPal\Api\TemplateData
|
||||
*/
|
||||
public function getTemplateData()
|
||||
{
|
||||
return $this->template_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for each template
|
||||
*
|
||||
* @param \PayPal\Api\TemplateSettings[] $settings
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setSettings($settings)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings for each template
|
||||
*
|
||||
* @return \PayPal\Api\TemplateSettings[]
|
||||
*/
|
||||
public function getSettings()
|
||||
{
|
||||
return $this->settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Settings to the list.
|
||||
*
|
||||
* @param \PayPal\Api\TemplateSettings $templateSettings
|
||||
* @return $this
|
||||
*/
|
||||
public function addSetting($templateSettings)
|
||||
{
|
||||
if (!$this->getSettings()) {
|
||||
return $this->setSettings(array($templateSettings));
|
||||
} else {
|
||||
return $this->setSettings(
|
||||
array_merge($this->getSettings(), array($templateSettings))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Settings from the list.
|
||||
*
|
||||
* @param \PayPal\Api\TemplateSettings $templateSettings
|
||||
* @return $this
|
||||
*/
|
||||
public function removeSetting($templateSettings)
|
||||
{
|
||||
return $this->setSettings(
|
||||
array_diff($this->getSettings(), array($templateSettings))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit of measure for the template, possible values are Quantity, Hours, Amount.
|
||||
*
|
||||
* @param string $unit_of_measure
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setUnitOfMeasure($unit_of_measure)
|
||||
{
|
||||
$this->unit_of_measure = $unit_of_measure;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Unit of measure for the template, possible values are Quantity, Hours, Amount.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getUnitOfMeasure()
|
||||
{
|
||||
return $this->unit_of_measure;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this is a custom template created by the merchant. Non custom templates are system generated
|
||||
*
|
||||
* @param bool $custom
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustom($custom)
|
||||
{
|
||||
$this->custom = $custom;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this is a custom template created by the merchant. Non custom templates are system generated
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getCustom()
|
||||
{
|
||||
return $this->custom;
|
||||
}
|
||||
|
||||
}
|
||||
619
lib/PayPal/Api/TemplateData.php
Normal file
619
lib/PayPal/Api/TemplateData.php
Normal file
@@ -0,0 +1,619 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Validation\UrlValidator;
|
||||
|
||||
/**
|
||||
* Class TemplateData
|
||||
*
|
||||
* Detailed template information.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\MerchantInfo merchant_info
|
||||
* @property \PayPal\Api\BillingInfo[] billing_info
|
||||
* @property string[] cc_info
|
||||
* @property \PayPal\Api\ShippingInfo shipping_info
|
||||
* @property \PayPal\Api\InvoiceItem[] items
|
||||
* @property \PayPal\Api\PaymentTerm payment_term
|
||||
* @property string reference
|
||||
* @property \PayPal\Api\Cost discount
|
||||
* @property \PayPal\Api\ShippingCost shipping_cost
|
||||
* @property \PayPal\Api\CustomAmount custom
|
||||
* @property bool allow_partial_payment
|
||||
* @property \PayPal\Api\Currency minimum_amount_due
|
||||
* @property bool tax_calculated_after_discount
|
||||
* @property bool tax_inclusive
|
||||
* @property string terms
|
||||
* @property string note
|
||||
* @property string merchant_memo
|
||||
* @property string logo_url
|
||||
* @property \PayPal\Api\Currency total_amount
|
||||
* @property \PayPal\Api\FileAttachment[] attachments
|
||||
*/
|
||||
class TemplateData extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Information about the merchant who is sending the invoice.
|
||||
*
|
||||
* @param \PayPal\Api\MerchantInfo $merchant_info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMerchantInfo($merchant_info)
|
||||
{
|
||||
$this->merchant_info = $merchant_info;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about the merchant who is sending the invoice.
|
||||
*
|
||||
* @return \PayPal\Api\MerchantInfo
|
||||
*/
|
||||
public function getMerchantInfo()
|
||||
{
|
||||
return $this->merchant_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* The required invoice recipient email address and any optional billing information. One recipient is supported.
|
||||
*
|
||||
* @param \PayPal\Api\BillingInfo[] $billing_info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setBillingInfo($billing_info)
|
||||
{
|
||||
$this->billing_info = $billing_info;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The required invoice recipient email address and any optional billing information. One recipient is supported.
|
||||
*
|
||||
* @return \PayPal\Api\BillingInfo[]
|
||||
*/
|
||||
public function getBillingInfo()
|
||||
{
|
||||
return $this->billing_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append BillingInfo to the list.
|
||||
*
|
||||
* @param \PayPal\Api\BillingInfo $billingInfo
|
||||
* @return $this
|
||||
*/
|
||||
public function addBillingInfo($billingInfo)
|
||||
{
|
||||
if (!$this->getBillingInfo()) {
|
||||
return $this->setBillingInfo(array($billingInfo));
|
||||
} else {
|
||||
return $this->setBillingInfo(
|
||||
array_merge($this->getBillingInfo(), array($billingInfo))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove BillingInfo from the list.
|
||||
*
|
||||
* @param \PayPal\Api\BillingInfo $billingInfo
|
||||
* @return $this
|
||||
*/
|
||||
public function removeBillingInfo($billingInfo)
|
||||
{
|
||||
return $this->setBillingInfo(
|
||||
array_diff($this->getBillingInfo(), array($billingInfo))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant.
|
||||
*
|
||||
* @param string $cc_info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCcInfo($cc_info)
|
||||
{
|
||||
$this->cc_info = $cc_info;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* For invoices sent by email, one or more email addresses to which to send a Cc: copy of the notification. Supports only email addresses under participant.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getCcInfo()
|
||||
{
|
||||
return $this->cc_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append CcInfo to the list.
|
||||
*
|
||||
* @param string $email
|
||||
* @return $this
|
||||
*/
|
||||
public function addCcInfo($email)
|
||||
{
|
||||
if (!$this->getCcInfo()) {
|
||||
return $this->setCcInfo(array($email));
|
||||
} else {
|
||||
return $this->setCcInfo(
|
||||
array_merge($this->getCcInfo(), array($email))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove CcInfo from the list.
|
||||
*
|
||||
* @param string $email
|
||||
* @return $this
|
||||
*/
|
||||
public function removeCcInfo($email)
|
||||
{
|
||||
return $this->setCcInfo(
|
||||
array_diff($this->getCcInfo(), array($email))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The shipping information for entities to whom items are being shipped.
|
||||
*
|
||||
* @param \PayPal\Api\ShippingInfo $shipping_info
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShippingInfo($shipping_info)
|
||||
{
|
||||
$this->shipping_info = $shipping_info;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The shipping information for entities to whom items are being shipped.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingInfo
|
||||
*/
|
||||
public function getShippingInfo()
|
||||
{
|
||||
return $this->shipping_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of items to include in the invoice. Maximum value is 100 items per invoice.
|
||||
*
|
||||
* @param \PayPal\Api\InvoiceItem[] $items
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setItems($items)
|
||||
{
|
||||
$this->items = $items;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The list of items to include in the invoice. Maximum value is 100 items per invoice.
|
||||
*
|
||||
* @return \PayPal\Api\InvoiceItem[]
|
||||
*/
|
||||
public function getItems()
|
||||
{
|
||||
return $this->items;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Items to the list.
|
||||
*
|
||||
* @param \PayPal\Api\InvoiceItem $invoiceItem
|
||||
* @return $this
|
||||
*/
|
||||
public function addItem($invoiceItem)
|
||||
{
|
||||
if (!$this->getItems()) {
|
||||
return $this->setItems(array($invoiceItem));
|
||||
} else {
|
||||
return $this->setItems(
|
||||
array_merge($this->getItems(), array($invoiceItem))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Items from the list.
|
||||
*
|
||||
* @param \PayPal\Api\InvoiceItem $invoiceItem
|
||||
* @return $this
|
||||
*/
|
||||
public function removeItem($invoiceItem)
|
||||
{
|
||||
return $this->setItems(
|
||||
array_diff($this->getItems(), array($invoiceItem))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both.
|
||||
*
|
||||
* @param \PayPal\Api\PaymentTerm $payment_term
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPaymentTerm($payment_term)
|
||||
{
|
||||
$this->payment_term = $payment_term;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional. The payment deadline for the invoice. Value is either `term_type` or `due_date` but not both.
|
||||
*
|
||||
* @return \PayPal\Api\PaymentTerm
|
||||
*/
|
||||
public function getPaymentTerm()
|
||||
{
|
||||
return $this->payment_term;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters.
|
||||
*
|
||||
* @param string $reference
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setReference($reference)
|
||||
{
|
||||
$this->reference = $reference;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reference data, such as PO number, to add to the invoice. Maximum length is 60 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getReference()
|
||||
{
|
||||
return $this->reference;
|
||||
}
|
||||
|
||||
/**
|
||||
* The invoice level discount, as a percent or an amount value.
|
||||
*
|
||||
* @param \PayPal\Api\Cost $discount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDiscount($discount)
|
||||
{
|
||||
$this->discount = $discount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The invoice level discount, as a percent or an amount value.
|
||||
*
|
||||
* @return \PayPal\Api\Cost
|
||||
*/
|
||||
public function getDiscount()
|
||||
{
|
||||
return $this->discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* The shipping cost, as a percent or an amount value.
|
||||
*
|
||||
* @param \PayPal\Api\ShippingCost $shipping_cost
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setShippingCost($shipping_cost)
|
||||
{
|
||||
$this->shipping_cost = $shipping_cost;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The shipping cost, as a percent or an amount value.
|
||||
*
|
||||
* @return \PayPal\Api\ShippingCost
|
||||
*/
|
||||
public function getShippingCost()
|
||||
{
|
||||
return $this->shipping_cost;
|
||||
}
|
||||
|
||||
/**
|
||||
* The custom amount to apply on an invoice. If you include a label, the amount cannot be empty.
|
||||
*
|
||||
* @param \PayPal\Api\CustomAmount $custom
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setCustom($custom)
|
||||
{
|
||||
$this->custom = $custom;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The custom amount to apply on an invoice. If you include a label, the amount cannot be empty.
|
||||
*
|
||||
* @return \PayPal\Api\CustomAmount
|
||||
*/
|
||||
public function getCustom()
|
||||
{
|
||||
return $this->custom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`.
|
||||
*
|
||||
* @param bool $allow_partial_payment
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAllowPartialPayment($allow_partial_payment)
|
||||
{
|
||||
$this->allow_partial_payment = $allow_partial_payment;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the invoice allows a partial payment. If set to `false`, invoice must be paid in full. If set to `true`, the invoice allows partial payments. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getAllowPartialPayment()
|
||||
{
|
||||
return $this->allow_partial_payment;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $minimum_amount_due
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMinimumAmountDue($minimum_amount_due)
|
||||
{
|
||||
$this->minimum_amount_due = $minimum_amount_due;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If `allow_partial_payment` is set to `true`, the minimum amount allowed for a partial payment.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getMinimumAmountDue()
|
||||
{
|
||||
return $this->minimum_amount_due;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`.
|
||||
*
|
||||
* @param bool $tax_calculated_after_discount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTaxCalculatedAfterDiscount($tax_calculated_after_discount)
|
||||
{
|
||||
$this->tax_calculated_after_discount = $tax_calculated_after_discount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether tax is calculated before or after a discount. If set to `false`, the tax is calculated before a discount. If set to `true`, the tax is calculated after a discount. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getTaxCalculatedAfterDiscount()
|
||||
{
|
||||
return $this->tax_calculated_after_discount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the unit price includes tax. Default is `false`.
|
||||
*
|
||||
* @param bool $tax_inclusive
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTaxInclusive($tax_inclusive)
|
||||
{
|
||||
$this->tax_inclusive = $tax_inclusive;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether the unit price includes tax. Default is `false`.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getTaxInclusive()
|
||||
{
|
||||
return $this->tax_inclusive;
|
||||
}
|
||||
|
||||
/**
|
||||
* General terms of the invoice. 4000 characters max.
|
||||
*
|
||||
* @param string $terms
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTerms($terms)
|
||||
{
|
||||
$this->terms = $terms;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* General terms of the invoice. 4000 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTerms()
|
||||
{
|
||||
return $this->terms;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to the payer. 4000 characters max.
|
||||
*
|
||||
* @param string $note
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setNote($note)
|
||||
{
|
||||
$this->note = $note;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Note to the payer. 4000 characters max.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getNote()
|
||||
{
|
||||
return $this->note;
|
||||
}
|
||||
|
||||
/**
|
||||
* A private bookkeeping memo for the merchant. Maximum length is 150 characters.
|
||||
*
|
||||
* @param string $merchant_memo
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setMerchantMemo($merchant_memo)
|
||||
{
|
||||
$this->merchant_memo = $merchant_memo;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* A private bookkeeping memo for the merchant. Maximum length is 150 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMerchantMemo()
|
||||
{
|
||||
return $this->merchant_memo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Full URL of an external image to use as the logo. Maximum length is 4000 characters.
|
||||
*
|
||||
* @param string $logo_url
|
||||
* @throws \InvalidArgumentException
|
||||
* @return $this
|
||||
*/
|
||||
public function setLogoUrl($logo_url)
|
||||
{
|
||||
UrlValidator::validate($logo_url, "LogoUrl");
|
||||
$this->logo_url = $logo_url;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Full URL of an external image to use as the logo. Maximum length is 4000 characters.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLogoUrl()
|
||||
{
|
||||
return $this->logo_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* The total amount of the invoice.
|
||||
*
|
||||
* @param \PayPal\Api\Currency $total_amount
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTotalAmount($total_amount)
|
||||
{
|
||||
$this->total_amount = $total_amount;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The total amount of the invoice.
|
||||
*
|
||||
* @return \PayPal\Api\Currency
|
||||
*/
|
||||
public function getTotalAmount()
|
||||
{
|
||||
return $this->total_amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of files attached to the invoice.
|
||||
*
|
||||
* @param \PayPal\Api\FileAttachment[] $attachments
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAttachments($attachments)
|
||||
{
|
||||
$this->attachments = $attachments;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of files attached to the invoice.
|
||||
*
|
||||
* @return \PayPal\Api\FileAttachment[]
|
||||
*/
|
||||
public function getAttachments()
|
||||
{
|
||||
return $this->attachments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Attachments to the list.
|
||||
*
|
||||
* @param \PayPal\Api\FileAttachment $fileAttachment
|
||||
* @return $this
|
||||
*/
|
||||
public function addAttachment($fileAttachment)
|
||||
{
|
||||
if (!$this->getAttachments()) {
|
||||
return $this->setAttachments(array($fileAttachment));
|
||||
} else {
|
||||
return $this->setAttachments(
|
||||
array_merge($this->getAttachments(), array($fileAttachment))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Attachments from the list.
|
||||
*
|
||||
* @param \PayPal\Api\FileAttachment $fileAttachment
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAttachment($fileAttachment)
|
||||
{
|
||||
return $this->setAttachments(
|
||||
array_diff($this->getAttachments(), array($fileAttachment))
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
65
lib/PayPal/Api/TemplateSettings.php
Normal file
65
lib/PayPal/Api/TemplateSettings.php
Normal file
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class TemplateSettings
|
||||
*
|
||||
* Settings per template
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property string field_name
|
||||
* @property \PayPal\Api\TemplateSettingsMetadata display_preference
|
||||
*/
|
||||
class TemplateSettings extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* The field name (for any field in template_data) for which the corresponding display preferences will be mapped to.
|
||||
*
|
||||
* @param string $field_name
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setFieldName($field_name)
|
||||
{
|
||||
$this->field_name = $field_name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The field name (for any field in template_data) for which the corresponding display preferences will be mapped to.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFieldName()
|
||||
{
|
||||
return $this->field_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings metadata for each field.
|
||||
*
|
||||
* @param \PayPal\Api\TemplateSettingsMetadata $display_preference
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setDisplayPreference($display_preference)
|
||||
{
|
||||
$this->display_preference = $display_preference;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Settings metadata for each field.
|
||||
*
|
||||
* @return \PayPal\Api\TemplateSettingsMetadata
|
||||
*/
|
||||
public function getDisplayPreference()
|
||||
{
|
||||
return $this->display_preference;
|
||||
}
|
||||
|
||||
}
|
||||
41
lib/PayPal/Api/TemplateSettingsMetadata.php
Normal file
41
lib/PayPal/Api/TemplateSettingsMetadata.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
|
||||
/**
|
||||
* Class TemplateSettingsMetadata
|
||||
*
|
||||
* Settings Metadata per field in template
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property bool hidden
|
||||
*/
|
||||
class TemplateSettingsMetadata extends PayPalModel
|
||||
{
|
||||
/**
|
||||
* Indicates whether this field should be hidden. default is false
|
||||
*
|
||||
* @param bool $hidden
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setHidden($hidden)
|
||||
{
|
||||
$this->hidden = $hidden;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicates whether this field should be hidden. default is false
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getHidden()
|
||||
{
|
||||
return $this->hidden;
|
||||
}
|
||||
|
||||
}
|
||||
290
lib/PayPal/Api/Templates.php
Normal file
290
lib/PayPal/Api/Templates.php
Normal file
@@ -0,0 +1,290 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Api;
|
||||
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\Template;
|
||||
use PayPal\Rest\ApiContext;
|
||||
|
||||
/**
|
||||
* Class Templates
|
||||
*
|
||||
* List of templates belonging to merchant.
|
||||
*
|
||||
* @package PayPal\Api
|
||||
*
|
||||
* @property \PayPal\Api\Address[] addresses
|
||||
* @property string[] emails
|
||||
* @property \PayPal\Api\Phone[] phones
|
||||
* @property \PayPal\Api\Template[] templates
|
||||
* @property \PayPal\Api\Links[] links
|
||||
*/
|
||||
class Templates extends PayPalResourceModel
|
||||
{
|
||||
/**
|
||||
* List of addresses in merchant's profile.
|
||||
*
|
||||
* @param \PayPal\Api\Address[] $addresses
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setAddresses($addresses)
|
||||
{
|
||||
$this->addresses = $addresses;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of addresses in merchant's profile.
|
||||
*
|
||||
* @return \PayPal\Api\Address[]
|
||||
*/
|
||||
public function getAddresses()
|
||||
{
|
||||
return $this->addresses;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Addresses to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Address $address
|
||||
* @return $this
|
||||
*/
|
||||
public function addAddress($address)
|
||||
{
|
||||
if (!$this->getAddresses()) {
|
||||
return $this->setAddresses(array($address));
|
||||
} else {
|
||||
return $this->setAddresses(
|
||||
array_merge($this->getAddresses(), array($address))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Addresses from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Address $address
|
||||
* @return $this
|
||||
*/
|
||||
public function removeAddress($address)
|
||||
{
|
||||
return $this->setAddresses(
|
||||
array_diff($this->getAddresses(), array($address))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of emails in merchant's profile.
|
||||
*
|
||||
* @param string[] $emails
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setEmails($emails)
|
||||
{
|
||||
$this->emails = $emails;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of emails in merchant's profile.
|
||||
*
|
||||
* @return string[]
|
||||
*/
|
||||
public function getEmails()
|
||||
{
|
||||
return $this->emails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Emails to the list.
|
||||
*
|
||||
* @param string $string
|
||||
* @return $this
|
||||
*/
|
||||
public function addEmail($string)
|
||||
{
|
||||
if (!$this->getEmails()) {
|
||||
return $this->setEmails(array($string));
|
||||
} else {
|
||||
return $this->setEmails(
|
||||
array_merge($this->getEmails(), array($string))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Emails from the list.
|
||||
*
|
||||
* @param string $string
|
||||
* @return $this
|
||||
*/
|
||||
public function removeEmail($string)
|
||||
{
|
||||
return $this->setEmails(
|
||||
array_diff($this->getEmails(), array($string))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of phone numbers in merchant's profile.
|
||||
*
|
||||
* @param \PayPal\Api\Phone[] $phones
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setPhones($phones)
|
||||
{
|
||||
$this->phones = $phones;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* List of phone numbers in merchant's profile.
|
||||
*
|
||||
* @return \PayPal\Api\Phone[]
|
||||
*/
|
||||
public function getPhones()
|
||||
{
|
||||
return $this->phones;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Phones to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Phone $phone
|
||||
* @return $this
|
||||
*/
|
||||
public function addPhone($phone)
|
||||
{
|
||||
if (!$this->getPhones()) {
|
||||
return $this->setPhones(array($phone));
|
||||
} else {
|
||||
return $this->setPhones(
|
||||
array_merge($this->getPhones(), array($phone))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Phones from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Phone $phone
|
||||
* @return $this
|
||||
*/
|
||||
public function removePhone($phone)
|
||||
{
|
||||
return $this->setPhones(
|
||||
array_diff($this->getPhones(), array($phone))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of templates.
|
||||
*
|
||||
* @param \PayPal\Api\Template[] $templates
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function setTemplates($templates)
|
||||
{
|
||||
$this->templates = $templates;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Array of templates.
|
||||
*
|
||||
* @return \PayPal\Api\Template[]
|
||||
*/
|
||||
public function getTemplates()
|
||||
{
|
||||
return $this->templates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Append Templates to the list.
|
||||
*
|
||||
* @param \PayPal\Api\Template $template
|
||||
* @return $this
|
||||
*/
|
||||
public function addTemplate($template)
|
||||
{
|
||||
if (!$this->getTemplates()) {
|
||||
return $this->setTemplates(array($template));
|
||||
} else {
|
||||
return $this->setTemplates(
|
||||
array_merge($this->getTemplates(), array($template))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove Templates from the list.
|
||||
*
|
||||
* @param \PayPal\Api\Template $template
|
||||
* @return $this
|
||||
*/
|
||||
public function removeTemplate($template)
|
||||
{
|
||||
return $this->setTemplates(
|
||||
array_diff($this->getTemplates(), array($template))
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows the details for a template, by ID.
|
||||
*
|
||||
* @param string $templateId
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Template
|
||||
*/
|
||||
public static function get($templateId, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($templateId, 'templateId');
|
||||
$payLoad = "";
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/templates/$templateId",
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Template();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Lists all templates for the merchant.
|
||||
*
|
||||
* @param array $params
|
||||
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
|
||||
* @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
|
||||
* @return Templates
|
||||
*/
|
||||
public static function getAll($params, $apiContext = null, $restCall = null)
|
||||
{
|
||||
ArgumentValidator::validate($params, 'params');
|
||||
$payLoad = "";
|
||||
$allowedParams = array(
|
||||
'fields' => 1,
|
||||
);
|
||||
$json = self::executeCall(
|
||||
"/v1/invoicing/templates/" . "?" . http_build_query(array_intersect_key($params, $allowedParams)),
|
||||
"GET",
|
||||
$payLoad,
|
||||
null,
|
||||
$apiContext,
|
||||
$restCall
|
||||
);
|
||||
$ret = new Templates();
|
||||
$ret->fromJson($json);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
12
sample/doc/invoice/GetNextInvoiceNumber.html
Normal file
12
sample/doc/invoice/GetNextInvoiceNumber.html
Normal file
@@ -0,0 +1,12 @@
|
||||
<!DOCTYPE html><html lang="en"><head><title>invoice/GetNextInvoiceNumber</title></head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0"><meta name="groc-relative-root" content="../"><meta name="groc-document-path" content="invoice/GetNextInvoiceNumber"><meta name="groc-project-path" content="invoice/GetNextInvoiceNumber.php"><link rel="stylesheet" type="text/css" media="all" href="../assets/style.css"><script type="text/javascript" src="../assets/behavior.js"></script><body><div id="meta"><div class="file-path">invoice/GetNextInvoiceNumber.php</div></div><div id="document"><div class="segment"><div class="code"><div class="wrapper"><span class="hljs-preprocessor"><?php</span></div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h1 id="get-next-invoice-number-sample">Get Next Invoice Number Sample</h1>
|
||||
<p>This sample code demonstrate how you can retrieve
|
||||
the next invoice number.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-string">'../bootstrap.php'</span>;
|
||||
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="get-next-invoice-number">Get Next Invoice Number</h3>
|
||||
<p>To generate the successive invoice number for the merchant, use below code.
|
||||
(See bootstrap.php for more on <code>ApiContext</code>)</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">try</span> {
|
||||
<span class="hljs-variable">$number</span> = Invoice::generateNumber(<span class="hljs-variable">$apiContext</span>);
|
||||
} <span class="hljs-keyword">catch</span> (<span class="hljs-keyword">Exception</span> <span class="hljs-variable">$ex</span>) {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printError(<span class="hljs-string">"Get Next Invoice Number"</span>, <span class="hljs-string">"InvoiceNumber"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$ex</span>);
|
||||
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</span>);
|
||||
}</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY</p></div></div><div class="code"><div class="wrapper"> ResultPrinter::printResult(<span class="hljs-string">"Get Next Invoice Number"</span>, <span class="hljs-string">"InvoiceNumber"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$number</span>, <span class="hljs-variable">$number</span>);
|
||||
|
||||
<span class="hljs-keyword">return</span> <span class="hljs-variable">$number</span>;</div></div></div></div></body></html>
|
||||
@@ -1186,6 +1186,17 @@ if (PHP_SAPI == 'cli') {
|
||||
</div>
|
||||
<!-- List group -->
|
||||
<ul class="list-group">
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Generate Next Invoice Number</h5></div>
|
||||
<div class="col-md-4">
|
||||
<a href="invoice/GetNextInvoiceNumber.php" class="btn btn-primary pull-left execute"> Try It <i
|
||||
class="fa fa-play-circle-o"></i></a>
|
||||
<a href="doc/invoice/GetNextInvoiceNumber.html" class="btn btn-default pull-right">Source <i
|
||||
class="fa fa-file-code-o"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item">
|
||||
<div class="row">
|
||||
<div class="col-md-8"><h5>Create an Invoice</h5></div>
|
||||
|
||||
24
sample/invoice/GetNextInvoiceNumber.php
Normal file
24
sample/invoice/GetNextInvoiceNumber.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
// # Get Next Invoice Number Sample
|
||||
// This sample code demonstrate how you can retrieve
|
||||
// the next invoice number.
|
||||
|
||||
require '../bootstrap.php';
|
||||
use PayPal\Api\Invoice;
|
||||
|
||||
// ### Get Next Invoice Number
|
||||
// To generate the successive invoice number for the merchant, use below code.
|
||||
// (See bootstrap.php for more on `ApiContext`)
|
||||
try {
|
||||
$number = Invoice::generateNumber($apiContext);
|
||||
} catch (Exception $ex) {
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printError("Get Next Invoice Number", "InvoiceNumber", null, null, $ex);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY
|
||||
ResultPrinter::printResult("Get Next Invoice Number", "InvoiceNumber", null, $number, $number);
|
||||
|
||||
return $number;
|
||||
68
tests/PayPal/Test/Api/FileAttachmentTest.php
Normal file
68
tests/PayPal/Test/Api/FileAttachmentTest.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\FileAttachment;
|
||||
|
||||
/**
|
||||
* Class FileAttachment
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class FileAttachmentTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object FileAttachment
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"name":"TestSample","url":"http://www.google.com"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return FileAttachment
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new FileAttachment(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return FileAttachment
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new FileAttachment(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getName());
|
||||
$this->assertNotNull($obj->getUrl());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param FileAttachment $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getName(), "TestSample");
|
||||
$this->assertEquals($obj->getUrl(), "http://www.google.com");
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage Url is not a fully qualified URL
|
||||
*/
|
||||
public function testUrlValidationForUrl()
|
||||
{
|
||||
$obj = new FileAttachment();
|
||||
$obj->setUrl(null);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"name":"TestSample","description":"TestSample","quantity":"12.34","unit_price":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . ',"date":"TestSample","discount":' .CostTest::getJson() . '}';
|
||||
return '{"name":"TestSample","description":"TestSample","quantity":"12.34","unit_price":' .CurrencyTest::getJson() . ',"tax":' .TaxTest::getJson() . ',"date":"TestSample","discount":' .CostTest::getJson() . ',"image_url":"http://www.google.com","unit_of_measure":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,6 +45,8 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getTax());
|
||||
$this->assertNotNull($obj->getDate());
|
||||
$this->assertNotNull($obj->getDiscount());
|
||||
$this->assertNotNull($obj->getImageUrl());
|
||||
$this->assertNotNull($obj->getUnitOfMeasure());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -62,6 +64,18 @@ class InvoiceItemTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getTax(), TaxTest::getObject());
|
||||
$this->assertEquals($obj->getDate(), "TestSample");
|
||||
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
|
||||
$this->assertEquals($obj->getImageUrl(), "http://www.google.com");
|
||||
$this->assertEquals($obj->getUnitOfMeasure(), "TestSample");
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage ImageUrl is not a fully qualified URL
|
||||
*/
|
||||
public function testUrlValidationForImageUrl()
|
||||
{
|
||||
$obj = new InvoiceItem();
|
||||
$obj->setImageUrl(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
55
tests/PayPal/Test/Api/InvoiceNumberTest.php
Normal file
55
tests/PayPal/Test/Api/InvoiceNumberTest.php
Normal file
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
use PayPal\Api\InvoiceNumber;
|
||||
|
||||
|
||||
/**
|
||||
* Class Cost
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class InvoiceNumberTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Cost
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"number":"1234"}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return InvoiceNumber
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new InvoiceNumber(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return InvoiceNumber
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new InvoiceNumber(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getNumber());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param InvoiceNumber $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getNumber(), "1234");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Api\Invoice;
|
||||
use PayPal\Api\InvoiceNumber;
|
||||
|
||||
/**
|
||||
* Class Invoice
|
||||
@@ -17,7 +18,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"id":"TestSample","number":"TestSample","uri":"TestSample","status":"TestSample","merchant_info":' .MerchantInfoTest::getJson() . ',"billing_info":' .BillingInfoTest::getJson() . ',"shipping_info":' .ShippingInfoTest::getJson() . ',"items":' .InvoiceItemTest::getJson() . ',"invoice_date":"TestSample","payment_term":' .PaymentTermTest::getJson() . ',"discount":' .CostTest::getJson() . ',"shipping_cost":' .ShippingCostTest::getJson() . ',"custom":' .CustomAmountTest::getJson() . ',"tax_calculated_after_discount":true,"tax_inclusive":true,"terms":"TestSample","note":"TestSample","merchant_memo":"TestSample","logo_url":"http://www.google.com","total_amount":' .CurrencyTest::getJson() . ',"payments":' .PaymentDetailTest::getJson() . ',"refunds":' .RefundDetailTest::getJson() . ',"metadata":' .MetadataTest::getJson() . ',"additional_data":"TestSample"}';
|
||||
return '{"id":"TestSample","number":"TestSample","template_id":"TestSample","uri":"TestSample","status":"TestSample","merchant_info":' .MerchantInfoTest::getJson() . ',"billing_info":' .BillingInfoTest::getJson() . ',"cc_info":' .ParticipantTest::getJson() . ',"shipping_info":' .ShippingInfoTest::getJson() . ',"items":' .InvoiceItemTest::getJson() . ',"invoice_date":"TestSample","payment_term":' .PaymentTermTest::getJson() . ',"reference":"TestSample","discount":' .CostTest::getJson() . ',"shipping_cost":' .ShippingCostTest::getJson() . ',"custom":' .CustomAmountTest::getJson() . ',"allow_partial_payment":true,"minimum_amount_due":' .CurrencyTest::getJson() . ',"tax_calculated_after_discount":true,"tax_inclusive":true,"terms":"TestSample","note":"TestSample","merchant_memo":"TestSample","logo_url":"http://www.google.com","total_amount":' .CurrencyTest::getJson() . ',"payments":' .PaymentDetailTest::getJson() . ',"refunds":' .RefundDetailTest::getJson() . ',"metadata":' .MetadataTest::getJson() . ',"additional_data":"TestSample","gratuity":' .CurrencyTest::getJson() . ',"paid_amount":' .PaymentSummaryTest::getJson() . ',"refunded_amount":' .PaymentSummaryTest::getJson() . ',"attachments":' .FileAttachmentTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,17 +41,22 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getId());
|
||||
$this->assertNotNull($obj->getNumber());
|
||||
$this->assertNotNull($obj->getTemplateId());
|
||||
$this->assertNotNull($obj->getUri());
|
||||
$this->assertNotNull($obj->getStatus());
|
||||
$this->assertNotNull($obj->getMerchantInfo());
|
||||
$this->assertNotNull($obj->getBillingInfo());
|
||||
$this->assertNotNull($obj->getCcInfo());
|
||||
$this->assertNotNull($obj->getShippingInfo());
|
||||
$this->assertNotNull($obj->getItems());
|
||||
$this->assertNotNull($obj->getInvoiceDate());
|
||||
$this->assertNotNull($obj->getPaymentTerm());
|
||||
$this->assertNotNull($obj->getReference());
|
||||
$this->assertNotNull($obj->getDiscount());
|
||||
$this->assertNotNull($obj->getShippingCost());
|
||||
$this->assertNotNull($obj->getCustom());
|
||||
$this->assertNotNull($obj->getAllowPartialPayment());
|
||||
$this->assertNotNull($obj->getMinimumAmountDue());
|
||||
$this->assertNotNull($obj->getTaxCalculatedAfterDiscount());
|
||||
$this->assertNotNull($obj->getTaxInclusive());
|
||||
$this->assertNotNull($obj->getTerms());
|
||||
@@ -62,6 +68,9 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getRefunds());
|
||||
$this->assertNotNull($obj->getMetadata());
|
||||
$this->assertNotNull($obj->getAdditionalData());
|
||||
$this->assertNotNull($obj->getPaidAmount());
|
||||
$this->assertNotNull($obj->getRefundedAmount());
|
||||
$this->assertNotNull($obj->getAttachments());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -74,17 +83,22 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$this->assertEquals($obj->getId(), "TestSample");
|
||||
$this->assertEquals($obj->getNumber(), "TestSample");
|
||||
$this->assertEquals($obj->getTemplateId(), "TestSample");
|
||||
$this->assertEquals($obj->getUri(), "TestSample");
|
||||
$this->assertEquals($obj->getStatus(), "TestSample");
|
||||
$this->assertEquals($obj->getMerchantInfo(), MerchantInfoTest::getObject());
|
||||
$this->assertEquals($obj->getBillingInfo(), BillingInfoTest::getObject());
|
||||
$this->assertEquals($obj->getCcInfo(), ParticipantTest::getObject());
|
||||
$this->assertEquals($obj->getShippingInfo(), ShippingInfoTest::getObject());
|
||||
$this->assertEquals($obj->getItems(), InvoiceItemTest::getObject());
|
||||
$this->assertEquals($obj->getInvoiceDate(), "TestSample");
|
||||
$this->assertEquals($obj->getPaymentTerm(), PaymentTermTest::getObject());
|
||||
$this->assertEquals($obj->getReference(), "TestSample");
|
||||
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
|
||||
$this->assertEquals($obj->getShippingCost(), ShippingCostTest::getObject());
|
||||
$this->assertEquals($obj->getCustom(), CustomAmountTest::getObject());
|
||||
$this->assertEquals($obj->getAllowPartialPayment(), true);
|
||||
$this->assertEquals($obj->getMinimumAmountDue(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getTaxCalculatedAfterDiscount(), true);
|
||||
$this->assertEquals($obj->getTaxInclusive(), true);
|
||||
$this->assertEquals($obj->getTerms(), "TestSample");
|
||||
@@ -96,6 +110,9 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getRefunds(), RefundDetailTest::getObject());
|
||||
$this->assertEquals($obj->getMetadata(), MetadataTest::getObject());
|
||||
$this->assertEquals($obj->getAdditionalData(), "TestSample");
|
||||
$this->assertEquals($obj->getPaidAmount(), PaymentSummaryTest::getObject());
|
||||
$this->assertEquals($obj->getRefundedAmount(), PaymentSummaryTest::getObject());
|
||||
$this->assertEquals($obj->getAttachments(), FileAttachmentTest::getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -107,7 +124,6 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$obj = new Invoice();
|
||||
$obj->setLogoUrl(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Invoice $obj
|
||||
@@ -297,7 +313,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
self::getJson()
|
||||
self::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->update($mockApiContext, $mockPayPalRestCall);
|
||||
@@ -316,7 +332,7 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
true
|
||||
true
|
||||
));
|
||||
|
||||
$result = $obj->delete($mockApiContext, $mockPayPalRestCall);
|
||||
@@ -335,12 +351,31 @@ class InvoiceTest extends \PHPUnit_Framework_TestCase
|
||||
$mockPayPalRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
ImageTest::getJson()
|
||||
ImageTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->qrCode("invoiceId", array(), $mockApiContext, $mockPayPalRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Invoice $obj
|
||||
*/
|
||||
public function testGenerateNumber($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
InvoiceNumberTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->generateNumber($mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
public function mockProvider()
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@ class MerchantInfoTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","address":' .AddressTest::getJson() . ',"business_name":"TestSample","phone":' .PhoneTest::getJson() . ',"fax":' .PhoneTest::getJson() . ',"website":"TestSample","tax_id":"TestSample","additional_info":"TestSample"}';
|
||||
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","address":' .AddressTest::getJson() . ',"business_name":"TestSample","phone":' .PhoneTest::getJson() . ',"fax":' .PhoneTest::getJson() . ',"website":"TestSample","tax_id":"TestSample","additional_info_label":"TestSample","additional_info":"TestSample"}';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,6 +47,7 @@ class MerchantInfoTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getFax());
|
||||
$this->assertNotNull($obj->getWebsite());
|
||||
$this->assertNotNull($obj->getTaxId());
|
||||
$this->assertNotNull($obj->getAdditionalInfoLabel());
|
||||
$this->assertNotNull($obj->getAdditionalInfo());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
@@ -67,6 +68,7 @@ class MerchantInfoTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getFax(), PhoneTest::getObject());
|
||||
$this->assertEquals($obj->getWebsite(), "TestSample");
|
||||
$this->assertEquals($obj->getTaxId(), "TestSample");
|
||||
$this->assertEquals($obj->getAdditionalInfoLabel(), "TestSample");
|
||||
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
|
||||
}
|
||||
|
||||
|
||||
73
tests/PayPal/Test/Api/ParticipantTest.php
Normal file
73
tests/PayPal/Test/Api/ParticipantTest.php
Normal file
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Participant;
|
||||
|
||||
/**
|
||||
* Class Participant
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class ParticipantTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Participant
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"email":"TestSample","first_name":"TestSample","last_name":"TestSample","business_name":"TestSample","phone":' .PhoneTest::getJson() . ',"fax":' .PhoneTest::getJson() . ',"website":"TestSample","additional_info":"TestSample","address":' .AddressTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return Participant
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new Participant(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return Participant
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new Participant(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getEmail());
|
||||
$this->assertNotNull($obj->getFirstName());
|
||||
$this->assertNotNull($obj->getLastName());
|
||||
$this->assertNotNull($obj->getBusinessName());
|
||||
$this->assertNotNull($obj->getPhone());
|
||||
$this->assertNotNull($obj->getFax());
|
||||
$this->assertNotNull($obj->getWebsite());
|
||||
$this->assertNotNull($obj->getAdditionalInfo());
|
||||
$this->assertNotNull($obj->getAddress());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param Participant $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getEmail(), "TestSample");
|
||||
$this->assertEquals($obj->getFirstName(), "TestSample");
|
||||
$this->assertEquals($obj->getLastName(), "TestSample");
|
||||
$this->assertEquals($obj->getBusinessName(), "TestSample");
|
||||
$this->assertEquals($obj->getPhone(), PhoneTest::getObject());
|
||||
$this->assertEquals($obj->getFax(), PhoneTest::getObject());
|
||||
$this->assertEquals($obj->getWebsite(), "TestSample");
|
||||
$this->assertEquals($obj->getAdditionalInfo(), "TestSample");
|
||||
$this->assertEquals($obj->getAddress(), AddressTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class PaymentDetailTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"type":"TestSample","transaction_id":"TestSample","transaction_type":"TestSample","date":"TestSample","method":"TestSample","note":"TestSample"}';
|
||||
return '{"type":"TestSample","transaction_id":"TestSample","transaction_type":"TestSample","date":"TestSample","method":"TestSample","note":"TestSample","amount":' .CurrencyTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -44,6 +44,7 @@ class PaymentDetailTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getDate());
|
||||
$this->assertNotNull($obj->getMethod());
|
||||
$this->assertNotNull($obj->getNote());
|
||||
$this->assertNotNull($obj->getAmount());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -60,6 +61,7 @@ class PaymentDetailTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getDate(), "TestSample");
|
||||
$this->assertEquals($obj->getMethod(), "TestSample");
|
||||
$this->assertEquals($obj->getNote(), "TestSample");
|
||||
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
59
tests/PayPal/Test/Api/PaymentSummaryTest.php
Normal file
59
tests/PayPal/Test/Api/PaymentSummaryTest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\PaymentSummary;
|
||||
|
||||
/**
|
||||
* Class PaymentSummary
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class PaymentSummaryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object PaymentSummary
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"paypal":' .CurrencyTest::getJson() . ',"other":' .CurrencyTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return PaymentSummary
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new PaymentSummary(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return PaymentSummary
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new PaymentSummary(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getPaypal());
|
||||
$this->assertNotNull($obj->getOther());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param PaymentSummary $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getPaypal(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getOther(), CurrencyTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ class RefundDetailTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"type":"TestSample","date":"TestSample","note":"TestSample"}';
|
||||
return '{"type":"TestSample","date":"TestSample","note":"TestSample","amount":' .CurrencyTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,6 +41,7 @@ class RefundDetailTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getType());
|
||||
$this->assertNotNull($obj->getDate());
|
||||
$this->assertNotNull($obj->getNote());
|
||||
$this->assertNotNull($obj->getAmount());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -54,6 +55,8 @@ class RefundDetailTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getType(), "TestSample");
|
||||
$this->assertEquals($obj->getDate(), "TestSample");
|
||||
$this->assertEquals($obj->getNote(), "TestSample");
|
||||
$this->assertEquals($obj->getAmount(), CurrencyTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"email":"TestSample","recipient_first_name":"TestSample","recipient_last_name":"TestSample","recipient_business_name":"TestSample","number":"TestSample","status":"TestSample","lower_total_amount":' .CurrencyTest::getJson() . ',"upper_total_amount":' .CurrencyTest::getJson() . ',"start_invoice_date":"TestSample","end_invoice_date":"TestSample","start_due_date":"TestSample","end_due_date":"TestSample","start_payment_date":"TestSample","end_payment_date":"TestSample","start_creation_date":"TestSample","end_creation_date":"TestSample","page":"12.34","page_size":"12.34","total_count_required":true}';
|
||||
return '{"email":"TestSample","recipient_first_name":"TestSample","recipient_last_name":"TestSample","recipient_business_name":"TestSample","number":"TestSample","status":"TestSample","lower_total_amount":' .CurrencyTest::getJson() . ',"upper_total_amount":' .CurrencyTest::getJson() . ',"start_invoice_date":"TestSample","end_invoice_date":"TestSample","start_due_date":"TestSample","end_due_date":"TestSample","start_payment_date":"TestSample","end_payment_date":"TestSample","start_creation_date":"TestSample","end_creation_date":"TestSample","page":"12.34","page_size":"12.34","total_count_required":true,"archived":true}';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -57,6 +57,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertNotNull($obj->getPage());
|
||||
$this->assertNotNull($obj->getPageSize());
|
||||
$this->assertNotNull($obj->getTotalCountRequired());
|
||||
$this->assertNotNull($obj->getArchived());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
@@ -86,6 +87,7 @@ class SearchTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($obj->getPage(), "12.34");
|
||||
$this->assertEquals($obj->getPageSize(), "12.34");
|
||||
$this->assertEquals($obj->getTotalCountRequired(), true);
|
||||
$this->assertEquals($obj->getArchived(), true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
102
tests/PayPal/Test/Api/TemplateDataTest.php
Normal file
102
tests/PayPal/Test/Api/TemplateDataTest.php
Normal file
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\TemplateData;
|
||||
|
||||
/**
|
||||
* Class TemplateData
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class TemplateDataTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object TemplateData
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"merchant_info":' .MerchantInfoTest::getJson() . ',"billing_info":' .BillingInfoTest::getJson() . ',"shipping_info":' .ShippingInfoTest::getJson() . ',"items":' .InvoiceItemTest::getJson() . ',"payment_term":' .PaymentTermTest::getJson() . ',"reference":"TestSample","discount":' .CostTest::getJson() . ',"shipping_cost":' .ShippingCostTest::getJson() . ',"custom":' .CustomAmountTest::getJson() . ',"allow_partial_payment":true,"minimum_amount_due":' .CurrencyTest::getJson() . ',"tax_calculated_after_discount":true,"tax_inclusive":true,"terms":"TestSample","note":"TestSample","merchant_memo":"TestSample","logo_url":"http://www.google.com","total_amount":' .CurrencyTest::getJson() . ',"attachments":' .FileAttachmentTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return TemplateData
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new TemplateData(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return TemplateData
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new TemplateData(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getMerchantInfo());
|
||||
$this->assertNotNull($obj->getBillingInfo());
|
||||
$this->assertNotNull($obj->getShippingInfo());
|
||||
$this->assertNotNull($obj->getItems());
|
||||
$this->assertNotNull($obj->getPaymentTerm());
|
||||
$this->assertNotNull($obj->getReference());
|
||||
$this->assertNotNull($obj->getDiscount());
|
||||
$this->assertNotNull($obj->getShippingCost());
|
||||
$this->assertNotNull($obj->getCustom());
|
||||
$this->assertNotNull($obj->getAllowPartialPayment());
|
||||
$this->assertNotNull($obj->getMinimumAmountDue());
|
||||
$this->assertNotNull($obj->getTaxCalculatedAfterDiscount());
|
||||
$this->assertNotNull($obj->getTaxInclusive());
|
||||
$this->assertNotNull($obj->getTerms());
|
||||
$this->assertNotNull($obj->getNote());
|
||||
$this->assertNotNull($obj->getMerchantMemo());
|
||||
$this->assertNotNull($obj->getLogoUrl());
|
||||
$this->assertNotNull($obj->getTotalAmount());
|
||||
$this->assertNotNull($obj->getAttachments());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param TemplateData $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getMerchantInfo(), MerchantInfoTest::getObject());
|
||||
$this->assertEquals($obj->getBillingInfo(), BillingInfoTest::getObject());
|
||||
$this->assertEquals($obj->getShippingInfo(), ShippingInfoTest::getObject());
|
||||
$this->assertEquals($obj->getItems(), InvoiceItemTest::getObject());
|
||||
$this->assertEquals($obj->getPaymentTerm(), PaymentTermTest::getObject());
|
||||
$this->assertEquals($obj->getReference(), "TestSample");
|
||||
$this->assertEquals($obj->getDiscount(), CostTest::getObject());
|
||||
$this->assertEquals($obj->getShippingCost(), ShippingCostTest::getObject());
|
||||
$this->assertEquals($obj->getCustom(), CustomAmountTest::getObject());
|
||||
$this->assertEquals($obj->getAllowPartialPayment(), true);
|
||||
$this->assertEquals($obj->getMinimumAmountDue(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getTaxCalculatedAfterDiscount(), true);
|
||||
$this->assertEquals($obj->getTaxInclusive(), true);
|
||||
$this->assertEquals($obj->getTerms(), "TestSample");
|
||||
$this->assertEquals($obj->getNote(), "TestSample");
|
||||
$this->assertEquals($obj->getMerchantMemo(), "TestSample");
|
||||
$this->assertEquals($obj->getLogoUrl(), "http://www.google.com");
|
||||
$this->assertEquals($obj->getTotalAmount(), CurrencyTest::getObject());
|
||||
$this->assertEquals($obj->getAttachments(), FileAttachmentTest::getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \InvalidArgumentException
|
||||
* @expectedExceptionMessage LogoUrl is not a fully qualified URL
|
||||
*/
|
||||
public function testUrlValidationForLogoUrl()
|
||||
{
|
||||
$obj = new TemplateData();
|
||||
$obj->setLogoUrl(null);
|
||||
}
|
||||
|
||||
}
|
||||
57
tests/PayPal/Test/Api/TemplateSettingsMetadataTest.php
Normal file
57
tests/PayPal/Test/Api/TemplateSettingsMetadataTest.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\TemplateSettingsMetadata;
|
||||
|
||||
/**
|
||||
* Class TemplateSettingsMetadata
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class TemplateSettingsMetadataTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object TemplateSettingsMetadata
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"hidden":true}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return TemplateSettingsMetadata
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new TemplateSettingsMetadata(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return TemplateSettingsMetadata
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new TemplateSettingsMetadata(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getHidden());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param TemplateSettingsMetadata $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getHidden(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
59
tests/PayPal/Test/Api/TemplateSettingsTest.php
Normal file
59
tests/PayPal/Test/Api/TemplateSettingsTest.php
Normal file
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\TemplateSettings;
|
||||
|
||||
/**
|
||||
* Class TemplateSettings
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class TemplateSettingsTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object TemplateSettings
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"field_name":"TestSample","display_preference":' .TemplateSettingsMetadataTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return TemplateSettings
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new TemplateSettings(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return TemplateSettings
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new TemplateSettings(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getFieldName());
|
||||
$this->assertNotNull($obj->getDisplayPreference());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param TemplateSettings $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getFieldName(), "TestSample");
|
||||
$this->assertEquals($obj->getDisplayPreference(), TemplateSettingsMetadataTest::getObject());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
69
tests/PayPal/Test/Api/TemplateTest.php
Normal file
69
tests/PayPal/Test/Api/TemplateTest.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalModel;
|
||||
use PayPal\Api\Template;
|
||||
|
||||
/**
|
||||
* Class Template
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class TemplateTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Template
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"template_id":"TestSample","name":"TestSample","default":true,"template_data":' .TemplateDataTest::getJson() . ',"settings":' .TemplateSettingsTest::getJson() . ',"unit_of_measure":"TestSample","custom":true}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return Template
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new Template(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return Template
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new Template(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getTemplateId());
|
||||
$this->assertNotNull($obj->getName());
|
||||
$this->assertNotNull($obj->getDefault());
|
||||
$this->assertNotNull($obj->getTemplateData());
|
||||
$this->assertNotNull($obj->getSettings());
|
||||
$this->assertNotNull($obj->getUnitOfMeasure());
|
||||
$this->assertNotNull($obj->getCustom());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param Template $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getTemplateId(), "TestSample");
|
||||
$this->assertEquals($obj->getName(), "TestSample");
|
||||
$this->assertEquals($obj->getDefault(), true);
|
||||
$this->assertEquals($obj->getTemplateData(), TemplateDataTest::getObject());
|
||||
$this->assertEquals($obj->getSettings(), TemplateSettingsTest::getObject());
|
||||
$this->assertEquals($obj->getUnitOfMeasure(), "TestSample");
|
||||
$this->assertEquals($obj->getCustom(), true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
118
tests/PayPal/Test/Api/TemplatesTest.php
Normal file
118
tests/PayPal/Test/Api/TemplatesTest.php
Normal file
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
namespace PayPal\Test\Api;
|
||||
|
||||
use PayPal\Common\PayPalResourceModel;
|
||||
use PayPal\Validation\ArgumentValidator;
|
||||
use PayPal\Api\Template;
|
||||
use PayPal\Rest\ApiContext;
|
||||
use PayPal\Api\Templates;
|
||||
|
||||
/**
|
||||
* Class Templates
|
||||
*
|
||||
* @package PayPal\Test\Api
|
||||
*/
|
||||
class TemplatesTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
/**
|
||||
* Gets Json String of Object Templates
|
||||
* @return string
|
||||
*/
|
||||
public static function getJson()
|
||||
{
|
||||
return '{"addresses":' .AddressTest::getJson() . ',"emails":"TestSample","phones":' .PhoneTest::getJson() . ',"templates":' .TemplateTest::getJson() . ',"links":' .LinksTest::getJson() . '}';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets Object Instance with Json data filled in
|
||||
* @return Templates
|
||||
*/
|
||||
public static function getObject()
|
||||
{
|
||||
return new Templates(self::getJson());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Tests for Serialization and Deserialization Issues
|
||||
* @return Templates
|
||||
*/
|
||||
public function testSerializationDeserialization()
|
||||
{
|
||||
$obj = new Templates(self::getJson());
|
||||
$this->assertNotNull($obj);
|
||||
$this->assertNotNull($obj->getAddresses());
|
||||
$this->assertNotNull($obj->getEmails());
|
||||
$this->assertNotNull($obj->getPhones());
|
||||
$this->assertNotNull($obj->getTemplates());
|
||||
$this->assertNotNull($obj->getLinks());
|
||||
$this->assertEquals(self::getJson(), $obj->toJson());
|
||||
return $obj;
|
||||
}
|
||||
|
||||
/**
|
||||
* @depends testSerializationDeserialization
|
||||
* @param Templates $obj
|
||||
*/
|
||||
public function testGetters($obj)
|
||||
{
|
||||
$this->assertEquals($obj->getAddresses(), AddressTest::getObject());
|
||||
$this->assertEquals($obj->getEmails(), "TestSample");
|
||||
$this->assertEquals($obj->getPhones(), PhoneTest::getObject());
|
||||
$this->assertEquals($obj->getTemplates(), TemplateTest::getObject());
|
||||
$this->assertEquals($obj->getLinks(), LinksTest::getObject());
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Templates $obj
|
||||
*/
|
||||
public function testGet($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
TemplateTest::getJson()
|
||||
));
|
||||
|
||||
$result = $obj->get("templateId", $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
/**
|
||||
* @dataProvider mockProvider
|
||||
* @param Templates $obj
|
||||
*/
|
||||
public function testGetAll($obj, $mockApiContext)
|
||||
{
|
||||
$mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$mockPPRestCall->expects($this->any())
|
||||
->method('execute')
|
||||
->will($this->returnValue(
|
||||
TemplatesTest::getJson()
|
||||
));
|
||||
$params = array();
|
||||
|
||||
$result = $obj->getAll($params, $mockApiContext, $mockPPRestCall);
|
||||
$this->assertNotNull($result);
|
||||
}
|
||||
|
||||
public function mockProvider()
|
||||
{
|
||||
$obj = self::getObject();
|
||||
$mockApiContext = $this->getMockBuilder('ApiContext')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
return array(
|
||||
array($obj, $mockApiContext),
|
||||
array($obj, null)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user