Merge pull request #682 from paypal/payments-experience-v1.3

Payments experience v1.3
This commit is contained in:
Steve Coffey
2016-10-18 13:49:17 -07:00
committed by GitHub
14 changed files with 505 additions and 3164 deletions

View File

@@ -14,12 +14,13 @@ use PayPal\Validation\UrlValidator;
* *
* @property string landing_page_type * @property string landing_page_type
* @property string bank_txn_pending_url * @property string bank_txn_pending_url
* @property string user_action
* @property string return_uri_http_method
*/ */
class FlowConfig extends PayPalModel class FlowConfig extends PayPalModel
{ {
/** /**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used. * The type of landing page to display on the PayPal site for user checkout. Set to `Billing` to use the non-PayPal account landing page. Set to `Login` to use the PayPal account login landing page.
*
* *
* @param string $landing_page_type * @param string $landing_page_type
* *
@@ -32,7 +33,7 @@ class FlowConfig extends PayPalModel
} }
/** /**
* Type of PayPal page to be displayed when a user lands on the PayPal site for checkout. Allowed values: `Billing` or `Login`. When set to `Billing`, the Non-PayPal account landing page is used. When set to `Login`, the PayPal account login landing page is used. * The type of landing page to display on the PayPal site for user checkout. Set to `Billing` to use the non-PayPal account landing page. Set to `Login` to use the PayPal account login landing page.
* *
* @return string * @return string
*/ */
@@ -42,8 +43,7 @@ class FlowConfig extends PayPalModel
} }
/** /**
* The URL on the merchant site for transferring to after a bank transfer payment. * The merchant site URL to display after a bank transfer payment. Valid for only the Giropay or bank transfer payment method in Germany.
*
* *
* @param string $bank_txn_pending_url * @param string $bank_txn_pending_url
* @throws \InvalidArgumentException * @throws \InvalidArgumentException
@@ -57,7 +57,7 @@ class FlowConfig extends PayPalModel
} }
/** /**
* The URL on the merchant site for transferring to after a bank transfer payment. * The merchant site URL to display after a bank transfer payment. Valid for only the Giropay or bank transfer payment method in Germany.
* *
* @return string * @return string
*/ */
@@ -66,4 +66,50 @@ class FlowConfig extends PayPalModel
return $this->bank_txn_pending_url; return $this->bank_txn_pending_url;
} }
/**
* Defines whether buyers can complete purchases on the PayPal or merchant website.
*
* @param string $user_action
*
* @return $this
*/
public function setUserAction($user_action)
{
$this->user_action = $user_action;
return $this;
}
/**
* Defines whether buyers can complete purchases on the PayPal or merchant website.
*
* @return string
*/
public function getUserAction()
{
return $this->user_action;
}
/**
* Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`.
*
* @param string $return_uri_http_method
*
* @return $this
*/
public function setReturnUriHttpMethod($return_uri_http_method)
{
$this->return_uri_http_method = $return_uri_http_method;
return $this;
}
/**
* Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`.
*
* @return string
*/
public function getReturnUriHttpMethod()
{
return $this->return_uri_http_method;
}
} }

View File

@@ -18,8 +18,7 @@ use PayPal\Common\PayPalModel;
class InputFields extends PayPalModel class InputFields extends PayPalModel
{ {
/** /**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout. * Indicates whether the buyer can enter a note to the merchant on the PayPal page during checkout.
*
* *
* @param bool $allow_note * @param bool $allow_note
* *
@@ -32,7 +31,7 @@ class InputFields extends PayPalModel
} }
/** /**
* Enables the buyer to enter a note to the merchant on the PayPal page during checkout. * Indicates whether the buyer can enter a note to the merchant on the PayPal page during checkout.
* *
* @return bool * @return bool
*/ */
@@ -42,8 +41,7 @@ class InputFields extends PayPalModel
} }
/** /**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`. * Indicates whether PayPal displays shipping address fields on the experience pages. Valid value is `0`, `1`, or `2`. Set to `0` to display the shipping address on the PayPal pages. Set to `1` to redact shipping address fields from the PayPal pages. Set to `2` to not pass the shipping address but instead get it from the buyer's account profile. For digital goods, this field is required and value must be `1`.
*
* *
* @param int $no_shipping * @param int $no_shipping
* *
@@ -56,7 +54,7 @@ class InputFields extends PayPalModel
} }
/** /**
* Determines whether or not PayPal displays shipping address fields on the experience pages. Allowed values: `0`, `1`, or `2`. When set to `0`, PayPal displays the shipping address on the PayPal pages. When set to `1`, PayPal does not display shipping address fields whatsoever. When set to `2`, if you do not pass the shipping address, PayPal obtains it from the buyer's account profile. For digital goods, this field is required, and you must set it to `1`. * Indicates whether PayPal displays shipping address fields on the experience pages. Valid value is `0`, `1`, or `2`. Set to `0` to display the shipping address on the PayPal pages. Set to `1` to redact shipping address fields from the PayPal pages. Set to `2` to not pass the shipping address but instead get it from the buyer's account profile. For digital goods, this field is required and value must be `1`.
* *
* @return int * @return int
*/ */
@@ -66,8 +64,7 @@ class InputFields extends PayPalModel
} }
/** /**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address. * Indicates whether to display the shipping address that is passed to this call rather than the one on file with PayPal for this buyer on the PayPal experience pages. Valid value is `0` or `1`. Set to `0` to display the shipping address on file. Set to `1` to display the shipping address supplied to this call; the buyer cannot edit this shipping address.
*
* *
* @param int $address_override * @param int $address_override
* *
@@ -80,7 +77,7 @@ class InputFields extends PayPalModel
} }
/** /**
* Determines whether or not the PayPal pages should display the shipping address and not the shipping address on file with PayPal for this buyer. Displaying the PayPal street address on file does not allow the buyer to edit that address. Allowed values: `0` or `1`. When set to `0`, the PayPal pages should not display the shipping address. When set to `1`, the PayPal pages should display the shipping address. * Indicates whether to display the shipping address that is passed to this call rather than the one on file with PayPal for this buyer on the PayPal experience pages. Valid value is `0` or `1`. Set to `0` to display the shipping address on file. Set to `1` to display the shipping address supplied to this call; the buyer cannot edit this shipping address.
* *
* @return int * @return int
*/ */

View File

@@ -14,12 +14,13 @@ use PayPal\Common\PayPalModel;
* @property string brand_name * @property string brand_name
* @property string logo_image * @property string logo_image
* @property string locale_code * @property string locale_code
* @property string return_url_label
* @property string note_to_seller_label
*/ */
class Presentation extends PayPalModel class Presentation extends PayPalModel
{ {
/** /**
* A label that overrides the business name in the PayPal account on the PayPal pages. * A label that overrides the business name in the PayPal account on the PayPal pages. Character length and limitations: 127 single-byte alphanumeric characters.
*
* *
* @param string $brand_name * @param string $brand_name
* *
@@ -32,7 +33,7 @@ class Presentation extends PayPalModel
} }
/** /**
* A label that overrides the business name in the PayPal account on the PayPal pages. * A label that overrides the business name in the PayPal account on the PayPal pages. Character length and limitations: 127 single-byte alphanumeric characters.
* *
* @return string * @return string
*/ */
@@ -42,8 +43,7 @@ class Presentation extends PayPalModel
} }
/** /**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`. * A URL to the logo image. A valid media type is `.gif`, `.jpg`, or `.png`. The maximum width of the image is 190 pixels. The maximum height of the image is 60 pixels. PayPal crops images that are larger. PayPal places your logo image at the top of the cart review area. PayPal recommends that you store the image on a secure (HTTPS) server. Otherwise, web browsers display a message that checkout pages contain non-secure items. Character length and limit: 127 single-byte alphanumeric characters.
*
* *
* @param string $logo_image * @param string $logo_image
* *
@@ -56,7 +56,7 @@ class Presentation extends PayPalModel
} }
/** /**
* A URL to logo image. Allowed vaues: `.gif`, `.jpg`, or `.png`. * A URL to the logo image. A valid media type is `.gif`, `.jpg`, or `.png`. The maximum width of the image is 190 pixels. The maximum height of the image is 60 pixels. PayPal crops images that are larger. PayPal places your logo image at the top of the cart review area. PayPal recommends that you store the image on a secure (HTTPS) server. Otherwise, web browsers display a message that checkout pages contain non-secure items. Character length and limit: 127 single-byte alphanumeric characters.
* *
* @return string * @return string
*/ */
@@ -66,8 +66,7 @@ class Presentation extends PayPalModel
} }
/** /**
* Locale of pages displayed by PayPal payment experience. * The locale of pages displayed by PayPal payment experience. A valid value is `AU`, `AT`, `BE`, `BR`, `CA`, `CH`, `CN`, `DE`, `ES`, `GB`, `FR`, `IT`, `NL`, `PL`, `PT`, `RU`, or `US`. A 5-character code is also valid for languages in specific countries: `da_DK`, `he_IL`, `id_ID`, `ja_JP`, `no_NO`, `pt_BR`, `ru_RU`, `sv_SE`, `th_TH`, `zh_CN`, `zh_HK`, or `zh_TW`.
*
* *
* @param string $locale_code * @param string $locale_code
* *
@@ -80,7 +79,7 @@ class Presentation extends PayPalModel
} }
/** /**
* Locale of pages displayed by PayPal payment experience. * The locale of pages displayed by PayPal payment experience. A valid value is `AU`, `AT`, `BE`, `BR`, `CA`, `CH`, `CN`, `DE`, `ES`, `GB`, `FR`, `IT`, `NL`, `PL`, `PT`, `RU`, or `US`. A 5-character code is also valid for languages in specific countries: `da_DK`, `he_IL`, `id_ID`, `ja_JP`, `no_NO`, `pt_BR`, `ru_RU`, `sv_SE`, `th_TH`, `zh_CN`, `zh_HK`, or `zh_TW`.
* *
* @return string * @return string
*/ */
@@ -89,4 +88,50 @@ class Presentation extends PayPalModel
return $this->locale_code; return $this->locale_code;
} }
/**
* A label to use as hypertext for the return to merchant link.
*
* @param string $return_url_label
*
* @return $this
*/
public function setReturnUrlLabel($return_url_label)
{
$this->return_url_label = $return_url_label;
return $this;
}
/**
* A label to use as hypertext for the return to merchant link.
*
* @return string
*/
public function getReturnUrlLabel()
{
return $this->return_url_label;
}
/**
* A label to use as the title for the note to seller field. Used only when `allow_note` is `1`.
*
* @param string $note_to_seller_label
*
* @return $this
*/
public function setNoteToSellerLabel($note_to_seller_label)
{
$this->note_to_seller_label = $note_to_seller_label;
return $this;
}
/**
* A label to use as the title for the note to seller field. Used only when `allow_note` is `1`.
*
* @return string
*/
public function getNoteToSellerLabel()
{
return $this->note_to_seller_label;
}
} }

View File

@@ -10,12 +10,13 @@ use PayPal\Validation\ArgumentValidator;
/** /**
* Class WebProfile * Class WebProfile
* *
* Payment Web experience profile resource * Payment web experience profile resource
* *
* @package PayPal\Api * @package PayPal\Api
* *
* @property string id * @property string id
* @property string name * @property string name
* @property bool temporary
* @property \PayPal\Api\FlowConfig flow_config * @property \PayPal\Api\FlowConfig flow_config
* @property \PayPal\Api\InputFields input_fields * @property \PayPal\Api\InputFields input_fields
* @property \PayPal\Api\Presentation presentation * @property \PayPal\Api\Presentation presentation
@@ -23,8 +24,7 @@ use PayPal\Validation\ArgumentValidator;
class WebProfile extends PayPalResourceModel class WebProfile extends PayPalResourceModel
{ {
/** /**
* ID of the web experience profile. * The unique ID of the web experience profile.
*
* *
* @param string $id * @param string $id
* *
@@ -37,7 +37,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* ID of the web experience profile. * The unique ID of the web experience profile.
* *
* @return string * @return string
*/ */
@@ -47,8 +47,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Name of the web experience profile. * The web experience profile name. Unique for a specified merchant's profiles.
*
* *
* @param string $name * @param string $name
* *
@@ -61,7 +60,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Name of the web experience profile. * The web experience profile name. Unique for a specified merchant's profiles.
* *
* @return string * @return string
*/ */
@@ -71,8 +70,30 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Parameters for flow configuration. * Indicates whether the profile persists for three hours or permanently. Set to `false` to persist the profile permanently. Set to `true` to persist the profile for three hours.
*
* @param bool $temporary
* *
* @return $this
*/
public function setTemporary($temporary)
{
$this->temporary = $temporary;
return $this;
}
/**
* Indicates whether the profile persists for three hours or permanently. Set to `false` to persist the profile permanently. Set to `true` to persist the profile for three hours.
*
* @return bool
*/
public function getTemporary()
{
return $this->temporary;
}
/**
* Parameters for flow configuration.
* *
* @param \PayPal\Api\FlowConfig $flow_config * @param \PayPal\Api\FlowConfig $flow_config
* *
@@ -96,7 +117,6 @@ class WebProfile extends PayPalResourceModel
/** /**
* Parameters for input fields customization. * Parameters for input fields customization.
*
* *
* @param \PayPal\Api\InputFields $input_fields * @param \PayPal\Api\InputFields $input_fields
* *
@@ -120,7 +140,6 @@ class WebProfile extends PayPalResourceModel
/** /**
* Parameters for style and presentation. * Parameters for style and presentation.
*
* *
* @param \PayPal\Api\Presentation $presentation * @param \PayPal\Api\Presentation $presentation
* *
@@ -143,7 +162,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Create a web experience profile by passing the name of the profile and other profile details in the request JSON to the request URI. * Creates a web experience profile. Pass the profile name and details in the JSON request body.
* *
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @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 * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
@@ -166,7 +185,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Update a web experience profile by passing the ID of the profile to the request URI. In addition, pass the profile details in the request JSON. If your request does not include values for all profile detail fields, the previously set values for the omitted fields are removed by this operation. * Updates a web experience profile. Pass the ID of the profile to the request URI and pass the profile details in the JSON request body. If your request omits any profile detail fields, the operation removes the previously set values for those fields.
* *
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @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 * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
@@ -188,7 +207,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Partially update an existing web experience profile by passing the ID of the profile to the request URI. In addition, pass a patch object in the request JSON that specifies the operation to perform, path of the profile location to update, and a new value if needed to complete the operation. * Partially-updates a web experience profile. Pass the profile ID to the request URI. Pass a patch object with the operation, path of the profile location to update, and, if needed, a new value to complete the operation in the JSON request body.
* *
* @param Patch[] $patch * @param Patch[] $patch
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
@@ -216,7 +235,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Retrieve the details of a particular web experience profile by passing the ID of the profile to the request URI. * Shows details for a web experience profile, by ID.
* *
* @param string $profileId * @param string $profileId
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
@@ -241,7 +260,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Lists all web experience profiles that exist for a merchant (or subject). * Lists all web experience profiles for a merchant or subject.
* *
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @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 * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls
@@ -262,7 +281,7 @@ class WebProfile extends PayPalResourceModel
} }
/** /**
* Delete an existing web experience profile by passing the profile ID to the request URI. * Deletes a web experience profile, by ID.
* *
* @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @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 * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls

File diff suppressed because it is too large Load Diff

View File

@@ -10,4 +10,4 @@
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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 all Templates"</span>, <span class="hljs-string">"Templates"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$templates</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 all Templates"</span>, <span class="hljs-string">"Templates"</span>, <span class="hljs-keyword">null</span>, <span class="hljs-keyword">null</span>, <span class="hljs-variable">$templates</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$templates</span>;</div></div></div></div></body></html> <span class="hljs-keyword">return</span> <span class="hljs-variable">$templates</span>;</div></div></div></div></body></html>

View File

@@ -16,4 +16,4 @@ Template ID
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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 Invoice Template"</span>, <span class="hljs-string">"Template"</span>, <span class="hljs-variable">$template</span>-&gt;getTemplateId(), <span class="hljs-variable">$templateId</span>, <span class="hljs-variable">$template</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 Invoice Template"</span>, <span class="hljs-string">"Template"</span>, <span class="hljs-variable">$template</span>-&gt;getTemplateId(), <span class="hljs-variable">$templateId</span>, <span class="hljs-variable">$template</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$template</span>;</div></div></div></div></body></html> <span class="hljs-keyword">return</span> <span class="hljs-variable">$template</span>;</div></div></div></div></body></html>

View File

@@ -4,11 +4,8 @@ an invoice.</p></div></div><div class="code"><div class="wrapper"><span class="h
<span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.php'</span>; <span class="hljs-variable">$invoice</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'CreateInvoice.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"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3> <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"><p>For Sample Purposes Only.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$request</span> = <span class="hljs-keyword">clone</span> <span class="hljs-variable">$invoice</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
<p>Lets update some information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setInvoiceDate(<span class="hljs-string">"2014-12-16 PST"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="note-these-are-the-work-around-added-to-the">NOTE: These are the work-around added to the</h3> <p>Lets update some information</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setInvoiceDate(<span class="hljs-string">"2014-12-16 PST"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="note-these-are-the-work-around-added-to-the">NOTE: These are the work-around added to the</h3>
<p>sample, to get past the bug in PayPal APIs. <p>sample, to get past the bug in PayPal APIs.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setDiscount(<span class="hljs-keyword">null</span>);
There is already an internal ticket #PPTIPS-1932 created for it.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$invoice</span>-&gt;setDiscount(<span class="hljs-keyword">null</span>); <span class="hljs-variable">$invoice</span>-&gt;getItems()[<span class="hljs-number">1</span>]-&gt;setDiscount(<span class="hljs-keyword">null</span>);
<span class="hljs-variable">$billingInfo</span> = <span class="hljs-variable">$invoice</span>-&gt;getBillingInfo()[<span class="hljs-number">0</span>];
<span class="hljs-variable">$billingInfo</span>-&gt;setAddress(<span class="hljs-keyword">null</span>);
<span class="hljs-variable">$invoice</span>-&gt;getPaymentTerm()-&gt;setDueDate(<span class="hljs-keyword">null</span>);
<span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3> <span class="hljs-keyword">try</span> {</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="update-invoice">Update Invoice</h3>
<p>Update an invoice by calling the invoice-&gt;update() method <p>Update an invoice by calling the invoice-&gt;update() method
@@ -26,4 +23,4 @@ Invoice ID
<span class="hljs-keyword">exit</span>(<span class="hljs-number">1</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 Invoice (Not Required - For Sample Only)"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoice</span>-&gt;getId(), <span class="hljs-variable">$invoice</span>-&gt;getId(), <span class="hljs-variable">$invoice</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 Invoice (Not Required - For Sample Only)"</span>, <span class="hljs-string">"Invoice"</span>, <span class="hljs-variable">$invoice</span>-&gt;getId(), <span class="hljs-variable">$invoice</span>-&gt;getId(), <span class="hljs-variable">$invoice</span>);
<span class="hljs-keyword">return</span> <span class="hljs-variable">$invoice</span>;</div></div></div></div></body></html> <span class="hljs-keyword">return</span> <span class="hljs-variable">$invoice</span>;</div></div></div></div></body></html>

File diff suppressed because one or more lines are too long

View File

@@ -13,6 +13,10 @@ $flowConfig = new \PayPal\Api\FlowConfig();
$flowConfig->setLandingPageType("Billing"); $flowConfig->setLandingPageType("Billing");
// The URL on the merchant site for transferring to after a bank transfer payment. // The URL on the merchant site for transferring to after a bank transfer payment.
$flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/"); $flowConfig->setBankTxnPendingUrl("http://www.yeowza.com/");
// When set to "commit", the buyer is shown an amount, and the button text will read "Pay Now" on the checkout page.
$flowConfig->setUserAction("commit");
// Defines the HTTP method to use to redirect the user to a return URL. A valid value is `GET` or `POST`.
$flowConfig->setReturnUriHttpMethod("GET");
// Parameters for style and presentation. // Parameters for style and presentation.
$presentation = new \PayPal\Api\Presentation(); $presentation = new \PayPal\Api\Presentation();
@@ -22,7 +26,11 @@ $presentation->setLogoImage("http://www.yeowza.com/favico.ico")
// A label that overrides the business name in the PayPal account on the PayPal pages. // A label that overrides the business name in the PayPal account on the PayPal pages.
->setBrandName("YeowZa! Paypal") ->setBrandName("YeowZa! Paypal")
// Locale of pages displayed by PayPal payment experience. // Locale of pages displayed by PayPal payment experience.
->setLocaleCode("US"); ->setLocaleCode("US")
// A label to use as hypertext for the return to merchant link.
->setReturnUrlLabel("Return")
// A label to use as the title for the note to seller field. Used only when `allow_note` is `1`.
->setNoteToSellerLabel("Thanks!");
// Parameters for input fields customization. // Parameters for input fields customization.
$inputFields = new \PayPal\Api\InputFields(); $inputFields = new \PayPal\Api\InputFields();
@@ -43,7 +51,9 @@ $webProfile->setName("YeowZa! T-Shirt Shop" . uniqid())
// Parameters for style and presentation. // Parameters for style and presentation.
->setPresentation($presentation) ->setPresentation($presentation)
// Parameters for input field customization. // Parameters for input field customization.
->setInputFields($inputFields); ->setInputFields($inputFields)
// Indicates whether the profile persists for three hours or permanently. Set to `false` to persist the profile permanently. Set to `true` to persist the profile for three hours.
->setTemporary(true);
// For Sample Purposes Only. // For Sample Purposes Only.
$request = clone $webProfile; $request = clone $webProfile;

View File

@@ -2,6 +2,7 @@
namespace PayPal\Test\Api; namespace PayPal\Test\Api;
use PayPal\Common\PayPalModel;
use PayPal\Api\FlowConfig; use PayPal\Api\FlowConfig;
/** /**
@@ -17,7 +18,7 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
*/ */
public static function getJson() public static function getJson()
{ {
return '{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com"}'; return '{"landing_page_type":"TestSample","bank_txn_pending_url":"http://www.google.com","user_action":"TestSample","return_uri_http_method":"TestSample"}';
} }
/** /**
@@ -40,6 +41,8 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj); $this->assertNotNull($obj);
$this->assertNotNull($obj->getLandingPageType()); $this->assertNotNull($obj->getLandingPageType());
$this->assertNotNull($obj->getBankTxnPendingUrl()); $this->assertNotNull($obj->getBankTxnPendingUrl());
$this->assertNotNull($obj->getUserAction());
$this->assertNotNull($obj->getReturnUriHttpMethod());
$this->assertEquals(self::getJson(), $obj->toJson()); $this->assertEquals(self::getJson(), $obj->toJson());
return $obj; return $obj;
} }
@@ -52,6 +55,8 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertEquals($obj->getLandingPageType(), "TestSample"); $this->assertEquals($obj->getLandingPageType(), "TestSample");
$this->assertEquals($obj->getBankTxnPendingUrl(), "http://www.google.com"); $this->assertEquals($obj->getBankTxnPendingUrl(), "http://www.google.com");
$this->assertEquals($obj->getUserAction(), "TestSample");
$this->assertEquals($obj->getReturnUriHttpMethod(), "TestSample");
} }
/** /**
@@ -63,4 +68,5 @@ class FlowConfigTest extends \PHPUnit_Framework_TestCase
$obj = new FlowConfig(); $obj = new FlowConfig();
$obj->setBankTxnPendingUrl(null); $obj->setBankTxnPendingUrl(null);
} }
} }

View File

@@ -17,7 +17,7 @@ class InputFieldsTest extends \PHPUnit_Framework_TestCase
*/ */
public static function getJson() public static function getJson()
{ {
return json_encode(json_decode('{"allow_note":true,"no_shipping":123,"address_override":123}')); return '{"allow_note":true,"no_shipping":123,"address_override":123}';
} }
/** /**
@@ -55,4 +55,6 @@ class InputFieldsTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getNoShipping(), 123); $this->assertEquals($obj->getNoShipping(), 123);
$this->assertEquals($obj->getAddressOverride(), 123); $this->assertEquals($obj->getAddressOverride(), 123);
} }
} }

View File

@@ -17,7 +17,7 @@ class PresentationTest extends \PHPUnit_Framework_TestCase
*/ */
public static function getJson() public static function getJson()
{ {
return json_encode(json_decode('{"brand_name":"TestSample","logo_image":"TestSample","locale_code":"TestSample"}')); return '{"brand_name":"TestSample","logo_image":"TestSample","locale_code":"TestSample","return_url_label":"TestSample","note_to_seller_label":"TestSample"}';
} }
/** /**
@@ -41,6 +41,8 @@ class PresentationTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj->getBrandName()); $this->assertNotNull($obj->getBrandName());
$this->assertNotNull($obj->getLogoImage()); $this->assertNotNull($obj->getLogoImage());
$this->assertNotNull($obj->getLocaleCode()); $this->assertNotNull($obj->getLocaleCode());
$this->assertNotNull($obj->getReturnUrlLabel());
$this->assertNotNull($obj->getNoteToSellerLabel());
$this->assertEquals(self::getJson(), $obj->toJson()); $this->assertEquals(self::getJson(), $obj->toJson());
return $obj; return $obj;
} }
@@ -54,5 +56,9 @@ class PresentationTest extends \PHPUnit_Framework_TestCase
$this->assertEquals($obj->getBrandName(), "TestSample"); $this->assertEquals($obj->getBrandName(), "TestSample");
$this->assertEquals($obj->getLogoImage(), "TestSample"); $this->assertEquals($obj->getLogoImage(), "TestSample");
$this->assertEquals($obj->getLocaleCode(), "TestSample"); $this->assertEquals($obj->getLocaleCode(), "TestSample");
$this->assertEquals($obj->getReturnUrlLabel(), "TestSample");
$this->assertEquals($obj->getNoteToSellerLabel(), "TestSample");
} }
} }

View File

@@ -17,7 +17,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public static function getJson() public static function getJson()
{ {
return '{"id":"TestSample","name":"TestSample","flow_config":' .FlowConfigTest::getJson() . ',"input_fields":' .InputFieldsTest::getJson() . ',"presentation":' .PresentationTest::getJson() . '}'; return '{"id":"TestSample","name":"TestSample","temporary":true,"flow_config":' .FlowConfigTest::getJson() . ',"input_fields":' .InputFieldsTest::getJson() . ',"presentation":' .PresentationTest::getJson() . '}';
} }
/** /**
@@ -40,6 +40,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
$this->assertNotNull($obj); $this->assertNotNull($obj);
$this->assertNotNull($obj->getId()); $this->assertNotNull($obj->getId());
$this->assertNotNull($obj->getName()); $this->assertNotNull($obj->getName());
$this->assertNotNull($obj->getTemporary());
$this->assertNotNull($obj->getFlowConfig()); $this->assertNotNull($obj->getFlowConfig());
$this->assertNotNull($obj->getInputFields()); $this->assertNotNull($obj->getInputFields());
$this->assertNotNull($obj->getPresentation()); $this->assertNotNull($obj->getPresentation());
@@ -55,6 +56,7 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
{ {
$this->assertEquals($obj->getId(), "TestSample"); $this->assertEquals($obj->getId(), "TestSample");
$this->assertEquals($obj->getName(), "TestSample"); $this->assertEquals($obj->getName(), "TestSample");
$this->assertEquals($obj->getTemporary(), true);
$this->assertEquals($obj->getFlowConfig(), FlowConfigTest::getObject()); $this->assertEquals($obj->getFlowConfig(), FlowConfigTest::getObject());
$this->assertEquals($obj->getInputFields(), InputFieldsTest::getObject()); $this->assertEquals($obj->getInputFields(), InputFieldsTest::getObject());
$this->assertEquals($obj->getPresentation(), PresentationTest::getObject()); $this->assertEquals($obj->getPresentation(), PresentationTest::getObject());
@@ -66,17 +68,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testCreate($obj, $mockApiContext) public function testCreate($obj, $mockApiContext)
{ {
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockPayPalRestCall->expects($this->any()) $mockPPRestCall->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue( ->will($this->returnValue(
CreateProfileResponseTest::getJson() self::getJson()
)); ));
$result = $obj->create($mockApiContext, $mockPayPalRestCall); $result = $obj->create($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
} }
/** /**
@@ -85,17 +87,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testUpdate($obj, $mockApiContext) public function testUpdate($obj, $mockApiContext)
{ {
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockPayPalRestCall->expects($this->any()) $mockPPRestCall->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue( ->will($this->returnValue(
true true
)); ));
$result = $obj->update($mockApiContext, $mockPayPalRestCall); $result = $obj->update($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
} }
/** /**
@@ -104,18 +106,18 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testPartialUpdate($obj, $mockApiContext) public function testPartialUpdate($obj, $mockApiContext)
{ {
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockPayPalRestCall->expects($this->any()) $mockPPRestCall->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue( ->will($this->returnValue(
true true
)); ));
$patch = array(PatchTest::getObject()); $patch = array(PatchTest::getObject());
$result = $obj->partial_update($patch, $mockApiContext, $mockPayPalRestCall); $result = $obj->partial_update($patch, $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
} }
/** /**
@@ -124,17 +126,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGet($obj, $mockApiContext) public function testGet($obj, $mockApiContext)
{ {
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockPayPalRestCall->expects($this->any()) $mockPPRestCall->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue( ->will($this->returnValue(
WebProfileTest::getJson() WebProfileTest::getJson()
)); ));
$result = $obj->get("profileId", $mockApiContext, $mockPayPalRestCall); $result = $obj->get("profileId", $mockApiContext, $mockPPRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
} }
/** /**
@@ -143,17 +145,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testGetList($obj, $mockApiContext) public function testGetList($obj, $mockApiContext)
{ {
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockPayPalRestCall->expects($this->any()) $mockPPRestCall->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue( ->will($this->returnValue(
json_encode(array(json_decode(WebProfileTest::getJson()))) json_encode(array(json_decode(WebProfileTest::getJson())))
)); ));
$result = $obj->get_list($mockApiContext, $mockPayPalRestCall); $result = $obj->get_list($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
} }
/** /**
@@ -162,17 +164,17 @@ class WebProfileTest extends \PHPUnit_Framework_TestCase
*/ */
public function testDelete($obj, $mockApiContext) public function testDelete($obj, $mockApiContext)
{ {
$mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall')
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$mockPayPalRestCall->expects($this->any()) $mockPPRestCall->expects($this->any())
->method('execute') ->method('execute')
->will($this->returnValue( ->will($this->returnValue(
true true
)); ));
$result = $obj->delete($mockApiContext, $mockPayPalRestCall); $result = $obj->delete($mockApiContext, $mockPPRestCall);
$this->assertNotNull($result); $this->assertNotNull($result);
} }