From 7c5ea8b99717e2af25fda7af12c1b58e89a10613 Mon Sep 17 00:00:00 2001
From: mrak and sdcoffey
Date: Tue, 25 Oct 2016 17:40:37 -0500
Subject: [PATCH] Proper changes to samples for Credit Card
---
lib/PayPal/Api/FundingInstrument.php | 2 --
sample/billing/CreateBillingAgreementWithCreditCard.php | 8 ++++----
.../doc/billing/CreateBillingAgreementWithCreditCard.html | 7 ++++---
sample/doc/payments/AuthorizePayment.html | 1 +
sample/doc/payments/CreatePayment.html | 3 ++-
sample/payments/AuthorizePayment.php | 1 +
sample/payments/CreatePayment.php | 3 ++-
7 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/lib/PayPal/Api/FundingInstrument.php b/lib/PayPal/Api/FundingInstrument.php
index b898a24..8fbe0ac 100644
--- a/lib/PayPal/Api/FundingInstrument.php
+++ b/lib/PayPal/Api/FundingInstrument.php
@@ -21,7 +21,6 @@ class FundingInstrument extends PayPalModel
* Credit Card instrument.
*
* @param \PayPal\Api\CreditCard $credit_card
- * @deprecated Please use #setPaymentCard instead
*
* @return $this
*/
@@ -35,7 +34,6 @@ class FundingInstrument extends PayPalModel
* Credit Card instrument.
*
* @return \PayPal\Api\CreditCard
- * @deprecated Please use #setPaymentCard instead
*
*/
public function getCreditCard()
diff --git a/sample/billing/CreateBillingAgreementWithCreditCard.php b/sample/billing/CreateBillingAgreementWithCreditCard.php
index 935cb28..0eadee1 100644
--- a/sample/billing/CreateBillingAgreementWithCreditCard.php
+++ b/sample/billing/CreateBillingAgreementWithCreditCard.php
@@ -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;
@@ -70,15 +70,15 @@ $payer->setPaymentMethod('credit_card')
->setPayerInfo(new PayerInfo(array('email' => 'jaypatel512-facilitator@hotmail.com')));
// 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);
diff --git a/sample/doc/billing/CreateBillingAgreementWithCreditCard.html b/sample/doc/billing/CreateBillingAgreementWithCreditCard.html
index c9e52a6..e833cd2 100644
--- a/sample/doc/billing/CreateBillingAgreementWithCreditCard.html
+++ b/sample/doc/billing/CreateBillingAgreementWithCreditCard.html
@@ -6,6 +6,7 @@ define Plan information to create an agreement. Make sure the plan you are using
$createdPlan = require 'UpdatePlan.php';
use PayPal\Api\Agreement;
+use PayPal\Api\CreditCard;
use PayPal\Api\FundingInstrument;
use PayPal\Api\Payer;
use PayPal\Api\PayerInfo;
@@ -55,15 +56,15 @@ Please note that the plan Id should be only set in this case.
$plan->setId($createdPlan->getId());
$agreement->setPlan($plan);$payer = new Payer();
$payer->setPaymentMethod('credit_card')
- ->setPayerInfo(new PayerInfo(array('email' => 'jaypatel512-facilitator@hotmail.com')));
$paymentCard = new PaymentCard();
-$paymentCard->setType('visa')
+ ->setPayerInfo(new PayerInfo(array('email' => 'jaypatel512-facilitator@hotmail.com')));
$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));
$agreement->setPayer($payer);
$shippingAddress = new ShippingAddress();
diff --git a/sample/doc/payments/AuthorizePayment.html b/sample/doc/payments/AuthorizePayment.html
index 4f23b15..13a7098 100644
--- a/sample/doc/payments/AuthorizePayment.html
+++ b/sample/doc/payments/AuthorizePayment.html
@@ -27,6 +27,7 @@ to correct setting. In this case, it would be 'authorize'
"012")
->setFirstName(
"Joe")
->setLastName(
"Shopper")
+ ->setBillingCountry(
"US")
->setBillingAddress(
$addr);
$fi =
new FundingInstrument();
diff --git a/sample/doc/payments/CreatePayment.html b/sample/doc/payments/CreatePayment.html
index b9a3590..1ba9d66 100644
--- a/sample/doc/payments/CreatePayment.html
+++ b/sample/doc/payments/CreatePayment.html
@@ -21,7 +21,8 @@ used to fund a payment.
"2019")
->setCvv2("012")
->setFirstName("Joe")
- ->setLastName("Shopper");
$fi = new FundingInstrument();
diff --git a/sample/payments/AuthorizePayment.php b/sample/payments/AuthorizePayment.php
index 205b50a..61c06b5 100644
--- a/sample/payments/AuthorizePayment.php
+++ b/sample/payments/AuthorizePayment.php
@@ -33,6 +33,7 @@ $paymentCard->setType("visa")
->setCvv2("012")
->setFirstName("Joe")
->setLastName("Shopper")
+ ->setBillingCountry("US")
->setBillingAddress($addr);
$fi = new FundingInstrument();
diff --git a/sample/payments/CreatePayment.php b/sample/payments/CreatePayment.php
index a8a0d1d..4591347 100644
--- a/sample/payments/CreatePayment.php
+++ b/sample/payments/CreatePayment.php
@@ -29,7 +29,8 @@ $card->setType("visa")
->setExpireYear("2019")
->setCvv2("012")
->setFirstName("Joe")
- ->setLastName("Shopper");
+ ->setLastName("Shopper")
+ ->setBillingCountry("US");
// ### FundingInstrument
// A resource representing a Payer's funding instrument.
Add Payer