Skip to content
This repository has been archived by the owner on Sep 29, 2023. It is now read-only.

Commit

Permalink
Proper changes to samples for Credit Card
Browse files Browse the repository at this point in the history
  • Loading branch information
mrak and sdcoffey committed Oct 25, 2016
1 parent 7b380a1 commit 7c5ea8b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 11 deletions.
2 changes: 0 additions & 2 deletions lib/PayPal/Api/FundingInstrument.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class FundingInstrument extends PayPalModel
* Credit Card instrument.
*
* @param \PayPal\Api\CreditCard $credit_card
* @deprecated Please use #setPaymentCard instead
*
* @return $this
*/
Expand All @@ -35,7 +34,6 @@ public function setCreditCard($credit_card)
* Credit Card instrument.
*
* @return \PayPal\Api\CreditCard
* @deprecated Please use #setPaymentCard instead
*
*/
public function getCreditCard()
Expand Down
8 changes: 4 additions & 4 deletions sample/billing/CreateBillingAgreementWithCreditCard.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
$createdPlan = require 'UpdatePlan.php';

use PayPal\Api\Agreement;
use PayPal\Api\CreditCard;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Payer;
use PayPal\Api\PayerInfo;
use PayPal\Api\PaymentCard;
use PayPal\Api\Plan;
use PayPal\Api\ShippingAddress;

Expand Down Expand Up @@ -70,15 +70,15 @@
->setPayerInfo(new PayerInfo(array('email' => '[email protected]')));

// Add Credit Card to Funding Instruments
$paymentCard = new PaymentCard();
$paymentCard->setType('visa')
$card = new CreditCard();
$card->setType('visa')
->setNumber('4491759698858890')
->setExpireMonth('12')
->setExpireYear('2017')
->setCvv2('128');

$fundingInstrument = new FundingInstrument();
$fundingInstrument->setPaymentCard($paymentCard);
$fundingInstrument->setCreditCard($card);
$payer->setFundingInstruments(array($fundingInstrument));
//Add Payer to Agreement
$agreement->setPayer($payer);
Expand Down
7 changes: 4 additions & 3 deletions sample/doc/billing/CreateBillingAgreementWithCreditCard.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<span class="hljs-variable">$createdPlan</span> = <span class="hljs-keyword">require</span> <span class="hljs-string">'UpdatePlan.php'</span>;

<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Agreement</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">CreditCard</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">FundingInstrument</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Payer</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PayerInfo</span>;
Expand Down Expand Up @@ -55,15 +56,15 @@
<span class="hljs-variable">$plan</span>-&gt;setId(<span class="hljs-variable">$createdPlan</span>-&gt;getId());
<span class="hljs-variable">$agreement</span>-&gt;setPlan(<span class="hljs-variable">$plan</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Payer</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
<span class="hljs-variable">$payer</span>-&gt;setPaymentMethod(<span class="hljs-string">'credit_card'</span>)
-&gt;setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo(<span class="hljs-keyword">array</span>(<span class="hljs-string">'email'</span> =&gt; <span class="hljs-string">'[email protected]'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$paymentCard</span> = <span class="hljs-keyword">new</span> PaymentCard();
<span class="hljs-variable">$paymentCard</span>-&gt;setType(<span class="hljs-string">'visa'</span>)
-&gt;setPayerInfo(<span class="hljs-keyword">new</span> PayerInfo(<span class="hljs-keyword">array</span>(<span class="hljs-string">'email'</span> =&gt; <span class="hljs-string">'[email protected]'</span>)));</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Credit Card to Funding Instruments</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> CreditCard();
<span class="hljs-variable">$card</span>-&gt;setType(<span class="hljs-string">'visa'</span>)
-&gt;setNumber(<span class="hljs-string">'4491759698858890'</span>)
-&gt;setExpireMonth(<span class="hljs-string">'12'</span>)
-&gt;setExpireYear(<span class="hljs-string">'2017'</span>)
-&gt;setCvv2(<span class="hljs-string">'128'</span>);

<span class="hljs-variable">$fundingInstrument</span> = <span class="hljs-keyword">new</span> FundingInstrument();
<span class="hljs-variable">$fundingInstrument</span>-&gt;setPaymentCard(<span class="hljs-variable">$paymentCard</span>);
<span class="hljs-variable">$fundingInstrument</span>-&gt;setCreditCard(<span class="hljs-variable">$card</span>);
<span class="hljs-variable">$payer</span>-&gt;setFundingInstruments(<span class="hljs-keyword">array</span>(<span class="hljs-variable">$fundingInstrument</span>));
<span class="hljs-comment">//Add Payer to Agreement</span>
<span class="hljs-variable">$agreement</span>-&gt;setPayer(<span class="hljs-variable">$payer</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>Add Shipping Address</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$shippingAddress</span> = <span class="hljs-keyword">new</span> ShippingAddress();
Expand Down
1 change: 1 addition & 0 deletions sample/doc/payments/AuthorizePayment.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
-&gt;setCvv2(<span class="hljs-string">"012"</span>)
-&gt;setFirstName(<span class="hljs-string">"Joe"</span>)
-&gt;setLastName(<span class="hljs-string">"Shopper"</span>)
-&gt;setBillingCountry(<span class="hljs-string">"US"</span>)
-&gt;setBillingAddress(<span class="hljs-variable">$addr</span>);

<span class="hljs-variable">$fi</span> = <span class="hljs-keyword">new</span> FundingInstrument();
Expand Down
3 changes: 2 additions & 1 deletion sample/doc/payments/CreatePayment.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
-&gt;setExpireYear(<span class="hljs-string">"2019"</span>)
-&gt;setCvv2(<span class="hljs-string">"012"</span>)
-&gt;setFirstName(<span class="hljs-string">"Joe"</span>)
-&gt;setLastName(<span class="hljs-string">"Shopper"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="fundinginstrument">FundingInstrument</h3>
-&gt;setLastName(<span class="hljs-string">"Shopper"</span>)
-&gt;setBillingCountry(<span class="hljs-string">"US"</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="fundinginstrument">FundingInstrument</h3>
<p>A resource representing a Payer&#39;s funding instrument.
For direct credit card payments, set the CreditCard
field on this object.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$fi</span> = <span class="hljs-keyword">new</span> FundingInstrument();
Expand Down
1 change: 1 addition & 0 deletions sample/payments/AuthorizePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper")
->setBillingCountry("US")
->setBillingAddress($addr);

$fi = new FundingInstrument();
Expand Down
3 changes: 2 additions & 1 deletion sample/payments/CreatePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
->setExpireYear("2019")
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper");
->setLastName("Shopper")
->setBillingCountry("US");

// ### FundingInstrument
// A resource representing a Payer's funding instrument.
Expand Down

0 comments on commit 7c5ea8b

Please sign in to comment.