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

Use PaymentCard instead of CreditCard #696

Merged
merged 1 commit into from
Oct 17, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/PayPal/Api/FundingInstrument.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class FundingInstrument extends PayPalModel
* Credit Card instrument.
*
* @param \PayPal\Api\CreditCard $credit_card
* @deprecated Please use #setPaymentCard instead
*
* @return $this
*/
Expand All @@ -34,6 +35,8 @@ public function setCreditCard($credit_card)
* Credit Card instrument.
*
* @return \PayPal\Api\CreditCard
* @deprecated Please use #setPaymentCard instead
*
*/
public function getCreditCard()
{
Expand Down Expand Up @@ -66,7 +69,6 @@ public function getCreditCardToken()
/**
* Payment Card information.
*
* @deprecated Not publicly available
* @param \PayPal\Api\PaymentCard $payment_card
*
* @return $this
Expand All @@ -80,7 +82,6 @@ public function setPaymentCard($payment_card)
/**
* Payment Card information.
*
* @deprecated Not publicly available
* @return \PayPal\Api\PaymentCard
*/
public function getPaymentCard()
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
$creditCard = new CreditCard();
$creditCard->setType('visa')
$paymentCard = new PaymentCard();
$paymentCard->setType('visa')
->setNumber('4491759698858890')
->setExpireMonth('12')
->setExpireYear('2017')
->setCvv2('128');

$fundingInstrument = new FundingInstrument();
$fundingInstrument->setCreditCard($creditCard);
$fundingInstrument->setPaymentCard($paymentCard);
$payer->setFundingInstruments(array($fundingInstrument));
//Add Payer to Agreement
$agreement->setPayer($payer);
Expand Down
8 changes: 4 additions & 4 deletions sample/doc/billing/CreateBillingAgreementWithCreditCard.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<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>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PaymentCard</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Plan</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ShippingAddress</span>;

Expand Down Expand Up @@ -55,15 +55,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">$creditCard</span> = <span class="hljs-keyword">new</span> CreditCard();
<span class="hljs-variable">$creditCard</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">$paymentCard</span> = <span class="hljs-keyword">new</span> PaymentCard();
<span class="hljs-variable">$paymentCard</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;setCreditCard(<span class="hljs-variable">$creditCard</span>);
<span class="hljs-variable">$fundingInstrument</span>-&gt;setPaymentCard(<span class="hljs-variable">$paymentCard</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
8 changes: 4 additions & 4 deletions sample/doc/payments/AuthorizePayment.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@

<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Address</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Amount</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">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PaymentCard</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><p>The biggest difference between creating a payment, and authorizing a payment is to set the intent of payment
to correct setting. In this case, it would be &#39;authorize&#39;</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$addr</span> = <span class="hljs-keyword">new</span> Address();
<span class="hljs-variable">$addr</span>-&gt;setLine1(<span class="hljs-string">"3909 Witmer Road"</span>)
Expand All @@ -19,8 +19,8 @@
-&gt;setCountryCode(<span class="hljs-string">"US"</span>)
-&gt;setPhone(<span class="hljs-string">"716-298-1822"</span>);

<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>)
<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;setNumber(<span class="hljs-string">"4417119669820331"</span>)
-&gt;setExpireMonth(<span class="hljs-string">"11"</span>)
-&gt;setExpireYear(<span class="hljs-string">"2019"</span>)
Expand All @@ -30,7 +30,7 @@
-&gt;setBillingAddress(<span class="hljs-variable">$addr</span>);

<span class="hljs-variable">$fi</span> = <span class="hljs-keyword">new</span> FundingInstrument();
<span class="hljs-variable">$fi</span>-&gt;setCreditCard(<span class="hljs-variable">$card</span>);
<span class="hljs-variable">$fi</span>-&gt;setPaymentCard(<span class="hljs-variable">$paymentCard</span>);

<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>)
Expand Down
10 changes: 5 additions & 5 deletions sample/doc/payments/CreatePayment.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
REST API is restricted in some countries.
API used: /v1/payments/payment</p></div></div><div class="code"><div class="wrapper"><span class="hljs-keyword">require</span> <span class="hljs-keyword">__DIR__</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">Amount</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">Details</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">Item</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">ItemList</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">Payment</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="creditcard">CreditCard</h3>
<p>A resource representing a credit card that can be
used to fund a payment.</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-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">PaymentCard</span>;
<span class="hljs-keyword">use</span> <span class="hljs-title">PayPal</span>\<span class="hljs-title">Api</span>\<span class="hljs-title">Transaction</span>;</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="paymentcard">PaymentCard</h3>
<p>A resource representing a payment card that can be
used to fund a payment.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$card</span> = <span class="hljs-keyword">new</span> PaymentCard();
<span class="hljs-variable">$card</span>-&gt;setType(<span class="hljs-string">"visa"</span>)
-&gt;setNumber(<span class="hljs-string">"4669424246660779"</span>)
-&gt;setExpireMonth(<span class="hljs-string">"11"</span>)
Expand All @@ -25,7 +25,7 @@
<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();
<span class="hljs-variable">$fi</span>-&gt;setCreditCard(<span class="hljs-variable">$card</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payer">Payer</h3>
<span class="hljs-variable">$fi</span>-&gt;setPaymentCard(<span class="hljs-variable">$card</span>);</div></div></div><div class="segment"><div class="comments "><div class="wrapper"><h3 id="payer">Payer</h3>
<p>A resource representing a Payer that funds a payment
For direct credit card payments, set payment method
to &#39;credit_card&#39; and add an array of funding instruments.</p></div></div><div class="code"><div class="wrapper"><span class="hljs-variable">$payer</span> = <span class="hljs-keyword">new</span> Payer();
Expand Down
8 changes: 4 additions & 4 deletions sample/payments/AuthorizePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@

use PayPal\Api\Address;
use PayPal\Api\Amount;
use PayPal\Api\CreditCard;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\PaymentCard;
use PayPal\Api\Transaction;

// The biggest difference between creating a payment, and authorizing a payment is to set the intent of payment
Expand All @@ -25,8 +25,8 @@
->setCountryCode("US")
->setPhone("716-298-1822");

$card = new CreditCard();
$card->setType("visa")
$paymentCard = new PaymentCard();
$paymentCard->setType("visa")
->setNumber("4417119669820331")
->setExpireMonth("11")
->setExpireYear("2019")
Expand All @@ -36,7 +36,7 @@
->setBillingAddress($addr);

$fi = new FundingInstrument();
$fi->setCreditCard($card);
$fi->setPaymentCard($paymentCard);

$payer = new Payer();
$payer->setPaymentMethod("credit_card")
Expand Down
10 changes: 5 additions & 5 deletions sample/payments/CreatePayment.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@

require __DIR__ . '/../bootstrap.php';
use PayPal\Api\Amount;
use PayPal\Api\CreditCard;
use PayPal\Api\Details;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Item;
use PayPal\Api\ItemList;
use PayPal\Api\Payer;
use PayPal\Api\Payment;
use PayPal\Api\PaymentCard;
use PayPal\Api\Transaction;

// ### CreditCard
// A resource representing a credit card that can be
// ### PaymentCard
// A resource representing a payment card that can be
// used to fund a payment.
$card = new CreditCard();
$card = new PaymentCard();
$card->setType("visa")
->setNumber("4669424246660779")
->setExpireMonth("11")
Expand All @@ -36,7 +36,7 @@
// For direct credit card payments, set the CreditCard
// field on this object.
$fi = new FundingInstrument();
$fi->setCreditCard($card);
$fi->setPaymentCard($card);

// ### Payer
// A resource representing a Payer that funds a payment
Expand Down