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 b898a248..8fbe0ac5 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 @@ public function setCreditCard($credit_card) * 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 935cb287..0eadee1a 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 @@ ->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 c9e52a62..e833cd26 100644 --- a/sample/doc/billing/CreateBillingAgreementWithCreditCard.html +++ b/sample/doc/billing/CreateBillingAgreementWithCreditCard.html @@ -6,6 +6,7 @@ $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 @@ $plan->setId($createdPlan->getId()); $agreement->setPlan($plan);

Add Payer

$payer = new Payer(); $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') + ->setPayerInfo(new PayerInfo(array('email' => 'jaypatel512-facilitator@hotmail.com')));

Add Credit Card to Funding Instruments

$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);

Add Shipping Address

$shippingAddress = new ShippingAddress(); diff --git a/sample/doc/payments/AuthorizePayment.html b/sample/doc/payments/AuthorizePayment.html index 4f23b152..13a70988 100644 --- a/sample/doc/payments/AuthorizePayment.html +++ b/sample/doc/payments/AuthorizePayment.html @@ -27,6 +27,7 @@ ->setCvv2("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 b9a35903..1ba9d669 100644 --- a/sample/doc/payments/CreatePayment.html +++ b/sample/doc/payments/CreatePayment.html @@ -21,7 +21,8 @@ ->setExpireYear("2019") ->setCvv2("012") ->setFirstName("Joe") - ->setLastName("Shopper");

FundingInstrument

+ ->setLastName("Shopper") + ->setBillingCountry("US");

FundingInstrument

A resource representing a Payer's funding instrument. For direct credit card payments, set the CreditCard field on this object.

$fi = new FundingInstrument(); diff --git a/sample/payments/AuthorizePayment.php b/sample/payments/AuthorizePayment.php index 205b50ae..61c06b5c 100644 --- a/sample/payments/AuthorizePayment.php +++ b/sample/payments/AuthorizePayment.php @@ -33,6 +33,7 @@ ->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 a8a0d1dc..45913479 100644 --- a/sample/payments/CreatePayment.php +++ b/sample/payments/CreatePayment.php @@ -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.