From 14b9a13f8a07b22884659683e8af3c726fa97005 Mon Sep 17 00:00:00 2001
From: aydiv
Date: Wed, 21 Aug 2013 21:37:42 +0530
Subject: [PATCH] Changing test case and samples to use newer camelcase setters
---
sample/payments/AuthorizationCapture.php | 20 ++++++++---------
sample/payments/CreatePayment.php | 20 ++++++++---------
sample/payments/CreatePaymentUsingPayPal.php | 8 +++----
.../payments/CreatePaymentUsingSavedCard.php | 10 ++++-----
sample/payments/ExecutePayment.php | 4 ++--
sample/payments/GetAuthorization.php | 20 ++++++++---------
sample/payments/GetCapture.php | 20 ++++++++---------
sample/payments/RefundCapture.php | 20 ++++++++---------
sample/payments/VoidAuthorization.php | 20 ++++++++---------
sample/source/AuthorizationCapture.html | 20 ++++++++---------
sample/source/CreateCreditCard.html | 10 ++++-----
sample/source/CreatePayment.html | 20 ++++++++---------
sample/source/CreatePaymentUsingPayPal.html | 8 +++----
.../source/CreatePaymentUsingSavedCard.html | 10 ++++-----
sample/source/DeleteCreditCard.html | 12 +++++-----
sample/source/ExecutePayment.html | 2 +-
sample/source/GetAuthorization.html | 20 ++++++++---------
sample/source/GetCapture.html | 20 ++++++++---------
sample/source/GetCreditCard.html | 4 ++--
sample/source/RefundCapture.html | 20 ++++++++---------
sample/source/VoidAuthorization.html | 20 ++++++++---------
sample/vault/CreateCreditCard.php | 12 +++++-----
sample/vault/DeleteCreditCard.php | 14 ++++++------
sample/vault/GetCreditCard.php | 6 ++---
tests/PayPal/Test/Api/AddressTest.php | 2 +-
tests/PayPal/Test/Api/AuthorizationTest.php | 22 +++++++++----------
tests/PayPal/Test/Api/TransactionTest.php | 2 +-
27 files changed, 183 insertions(+), 183 deletions(-)
diff --git a/sample/payments/AuthorizationCapture.php b/sample/payments/AuthorizationCapture.php
index 6b064b9..d39e607 100644
--- a/sample/payments/AuthorizationCapture.php
+++ b/sample/payments/AuthorizationCapture.php
@@ -62,26 +62,26 @@ function createAuthorization($apiContext)
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/payments/CreatePayment.php b/sample/payments/CreatePayment.php
index 7c34bb8..257226a 100644
--- a/sample/payments/CreatePayment.php
+++ b/sample/payments/CreatePayment.php
@@ -22,8 +22,8 @@ $addr->setLine1("3909 Witmer Road");
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
-$addr->setPostal_code("14305");
-$addr->setCountry_code("US");
+$addr->setPostalCode("14305");
+$addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
// ### CreditCard
@@ -32,12 +32,12 @@ $addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
-$card->setExpire_month("11");
-$card->setExpire_year("2019");
+$card->setExpireMonth("11");
+$card->setExpireYear("2019");
$card->setCvv2("012");
-$card->setFirst_name("Joe");
-$card->setLast_name("Shopper");
-$card->setBilling_address($addr);
+$card->setFirstName("Joe");
+$card->setLastName("Shopper");
+$card->setBillingAddress($addr);
// ### FundingInstrument
// A resource representing a Payer's funding instrument.
@@ -46,15 +46,15 @@ $card->setBilling_address($addr);
// creating or using a tokenized funding instrument)
// and the `CreditCardDetails`
$fi = new FundingInstrument();
-$fi->setCredit_card($card);
+$fi->setCreditCard($card);
// ### Payer
// A resource representing a Payer that funds a payment
// Use the List of `FundingInstrument` and the Payment Method
// as 'credit_card'
$payer = new Payer();
-$payer->setPayment_method("credit_card");
-$payer->setFunding_instruments(array($fi));
+$payer->setPaymentMethod("credit_card");
+$payer->setFundingInstruments(array($fi));
// ### Amount
// Let's you specify a payment amount.
diff --git a/sample/payments/CreatePaymentUsingPayPal.php b/sample/payments/CreatePaymentUsingPayPal.php
index 0f4163c..ea116e1 100644
--- a/sample/payments/CreatePaymentUsingPayPal.php
+++ b/sample/payments/CreatePaymentUsingPayPal.php
@@ -20,7 +20,7 @@ session_start();
// Use the List of `FundingInstrument` and the Payment Method
// as 'credit_card'
$payer = new Payer();
-$payer->setPayment_method("paypal");
+$payer->setPaymentMethod("paypal");
// ### Amount
// Let's you specify a payment amount.
@@ -42,8 +42,8 @@ $transaction->setDescription("This is the payment description.");
// payment approval/ cancellation.
$baseUrl = getBaseUrl();
$redirectUrls = new RedirectUrls();
-$redirectUrls->setReturn_url("$baseUrl/ExecutePayment.php?success=true");
-$redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false");
+$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true");
+$redirectUrls->setCancelUrl("$baseUrl/ExecutePayment.php?success=false");
// ### Payment
// A Payment Resource; create one using
@@ -51,7 +51,7 @@ $redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false");
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
-$payment->setRedirect_urls($redirectUrls);
+$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
// ### Create Payment
diff --git a/sample/payments/CreatePaymentUsingSavedCard.php b/sample/payments/CreatePaymentUsingSavedCard.php
index 18fa312..dc93e4e 100644
--- a/sample/payments/CreatePaymentUsingSavedCard.php
+++ b/sample/payments/CreatePaymentUsingSavedCard.php
@@ -22,7 +22,7 @@ use PayPal\Auth\OAuthTokenCredential;
// CreateCreditCard.php
$creditCardId = 'CARD-5BT058015C739554AKE2GCEI';
$creditCardToken = new CreditCardToken();
-$creditCardToken->setCredit_card_id($creditCardId);
+$creditCardToken->setCreditCardId($creditCardId);
// ### FundingInstrument
// A resource representing a Payer's funding instrument.
@@ -31,15 +31,15 @@ $creditCardToken->setCredit_card_id($creditCardId);
// creating or using a tokenized funding instrument)
// and the `CreditCardDetails`
$fi = new FundingInstrument();
-$fi->setCredit_card_token($creditCardToken);
+$fi->setCreditCardToken($creditCardToken);
// ### Payer
// A resource representing a Payer that funds a payment
// Use the List of `FundingInstrument` and the Payment Method
// as 'credit_card'
$payer = new Payer();
-$payer->setPayment_method("credit_card");
-$payer->setFunding_instruments(array($fi));
+$payer->setPaymentMethod("credit_card");
+$payer->setFundingInstruments(array($fi));
// ### Amount
// Let's you specify a payment amount.
@@ -70,7 +70,7 @@ $payment->setTransactions(array($transaction));
// The return object contains the status;
try {
$payment->create($apiContext);
-} catch (PayPal\ExceptionPayPal\Exception\PPConnectionException $ex) {
+} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
diff --git a/sample/payments/ExecutePayment.php b/sample/payments/ExecutePayment.php
index 6827c99..ca87360 100644
--- a/sample/payments/ExecutePayment.php
+++ b/sample/payments/ExecutePayment.php
@@ -25,7 +25,7 @@ if(isset($_GET['success']) && $_GET['success'] == 'true') {
// The payer_id is added to the request query parameters
// when the user is redirected from paypal back to your site
$execution = new PaymentExecution();
- $execution->setPayer_id($_GET['PayerID']);
+ $execution->setPayerId($_GET['PayerID']);
//Execute the payment
// (See bootstrap.php for more on `ApiContext`)
@@ -37,4 +37,4 @@ if(isset($_GET['success']) && $_GET['success'] == 'true') {
} else {
echo "User cancelled payment.";
-}
\ No newline at end of file
+}
diff --git a/sample/payments/GetAuthorization.php b/sample/payments/GetAuthorization.php
index 18a8a88..d57da8e 100644
--- a/sample/payments/GetAuthorization.php
+++ b/sample/payments/GetAuthorization.php
@@ -48,26 +48,26 @@ function createAuthorization($apiContext)
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/payments/GetCapture.php b/sample/payments/GetCapture.php
index 194de6c..8db26af 100644
--- a/sample/payments/GetCapture.php
+++ b/sample/payments/GetCapture.php
@@ -71,26 +71,26 @@ function createAuthorization($apiContext)
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/payments/RefundCapture.php b/sample/payments/RefundCapture.php
index 7988a5f..2d8ec26 100644
--- a/sample/payments/RefundCapture.php
+++ b/sample/payments/RefundCapture.php
@@ -83,26 +83,26 @@ function createAuthorization($apiContext)
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/payments/VoidAuthorization.php b/sample/payments/VoidAuthorization.php
index c5e07e3..ddddc76 100644
--- a/sample/payments/VoidAuthorization.php
+++ b/sample/payments/VoidAuthorization.php
@@ -49,26 +49,26 @@ function createAuthorization($apiContext)
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/source/AuthorizationCapture.html b/sample/source/AuthorizationCapture.html
index 5042253..3bc228e 100644
--- a/sample/source/AuthorizationCapture.html
+++ b/sample/source/AuthorizationCapture.html
@@ -52,26 +52,26 @@ The return object contains the status;
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/source/CreateCreditCard.html b/sample/source/CreateCreditCard.html
index 23b4c92..4e4dc69 100644
--- a/sample/source/CreateCreditCard.html
+++ b/sample/source/CreateCreditCard.html
@@ -15,11 +15,11 @@ API used: POST /v1/vault/credit-card
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
-$card->setExpire_month("11");
-$card->setExpire_year("2019");
+$card->setExpireMonth("11");
+$card->setExpireYear("2019");
$card->setCvv2("012");
-$card->setFirst_name("Joe");
-$card->setLast_name("Shopper");
try {
$card->create($apiContext);
-} catch (\PPConnectionException $ex) {
+} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
diff --git a/sample/source/CreatePayment.html b/sample/source/CreatePayment.html
index 89b6e93..b3cd52e 100644
--- a/sample/source/CreatePayment.html
+++ b/sample/source/CreatePayment.html
@@ -17,33 +17,33 @@ address in a payment. [Optional]
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
-$addr->setPostal_code("14305");
-$addr->setCountry_code("US");
+$addr->setPostalCode("14305");
+$addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
-$card->setExpire_month("11");
-$card->setExpire_year("2019");
+$card->setExpireMonth("11");
+$card->setExpireYear("2019");
$card->setCvv2("012");
-$card->setFirst_name("Joe");
-$card->setLast_name("Shopper");
-$card->setBilling_address($addr);
$fi = new FundingInstrument();
-$fi->setCredit_card($card);
$payer = new Payer();
-$payer->setPayment_method("credit_card");
-$payer->setFunding_instruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/source/CreatePaymentUsingPayPal.html b/sample/source/CreatePaymentUsingPayPal.html
index de7b031..28122f5 100644
--- a/sample/source/CreatePaymentUsingPayPal.html
+++ b/sample/source/CreatePaymentUsingPayPal.html
@@ -15,7 +15,7 @@ API used: /v1/payments/payment
$payer = new Payer();
-$payer->setPayment_method("paypal");
$amount = new Amount();
$amount->setCurrency("USD");
@@ -31,14 +31,14 @@ a Payee and Amount types
$baseUrl = getBaseUrl();
$redirectUrls = new RedirectUrls();
-$redirectUrls->setReturn_url("$baseUrl/ExecutePayment.php?success=true");
-$redirectUrls->setCancel_url("$baseUrl/ExecutePayment.php?success=false");
$payment = new Payment();
$payment->setIntent("sale");
$payment->setPayer($payer);
-$payment->setRedirect_urls($redirectUrls);
+$payment->setRedirectUrls($redirectUrls);
$payment->setTransactions(array($transaction));
$creditCardId = 'CARD-5BT058015C739554AKE2GCEI';
$creditCardToken = new CreditCardToken();
-$creditCardToken->setCredit_card_id($creditCardId);
$fi = new FundingInstrument();
-$fi->setCredit_card_token($creditCardToken);
$payer = new Payer();
-$payer->setPayment_method("credit_card");
-$payer->setFunding_instruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
@@ -53,7 +53,7 @@ the above types and intent as 'sale'
ApiContext)
The return object contains the status;
try {
$payment->create($apiContext);
-} catch (PayPal\ExceptionPayPal\Exception\PPConnectionException $ex) {
+} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
diff --git a/sample/source/DeleteCreditCard.html b/sample/source/DeleteCreditCard.html
index f8e45ed..2988d11 100644
--- a/sample/source/DeleteCreditCard.html
+++ b/sample/source/DeleteCreditCard.html
@@ -12,11 +12,11 @@ NOTE: HTTP method used here is DELETE
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
-$card->setExpire_month("11");
-$card->setExpire_year("2019");
+$card->setExpireMonth("11");
+$card->setExpireYear("2019");
$card->setCvv2("012");
-$card->setFirst_name("Joe");
-$card->setLast_name("Shopper");
try {
$res = $card->create($apiContext);
-
} catch (\PPConnectionException $ex) {
+
} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
@@ -35,7 +35,7 @@ in the future payments.
deletes saved credit card
(See bootstrap.php for more on ApiContext)
$creditCard->delete($apiContext);
-} catch (\PPConnectionException $ex) {
+} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
exit(1);
}
diff --git a/sample/source/ExecutePayment.html b/sample/source/ExecutePayment.html
index ab77e3d..8a6a6c0 100644
--- a/sample/source/ExecutePayment.html
+++ b/sample/source/ExecutePayment.html
@@ -19,7 +19,7 @@ CreatePaymentUsingPayPal.php
$execution = new PaymentExecution();
- $execution->setPayer_id($_GET['PayerID']);
+ $execution->setPayerId($_GET['PayerID']);
//Execute the payment
$payment->execute($execution, $apiContext);
diff --git a/sample/source/GetAuthorization.html b/sample/source/GetAuthorization.html
index 0648f9c..e690427 100644
--- a/sample/source/GetAuthorization.html
+++ b/sample/source/GetAuthorization.html
@@ -41,26 +41,26 @@ The return object contains the status;
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/source/GetCapture.html b/sample/source/GetCapture.html
index 50302d9..7fe202b 100644
--- a/sample/source/GetCapture.html
+++ b/sample/source/GetCapture.html
@@ -59,26 +59,26 @@ The return object contains the status;
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/source/GetCreditCard.html b/sample/source/GetCreditCard.html
index a46eaae..1455817 100644
--- a/sample/source/GetCreditCard.html
+++ b/sample/source/GetCreditCard.html
@@ -7,11 +7,11 @@ by sending a GET request to the URI
The following code takes you through
the process of retrieving a saved CreditCard
require __DIR__ . '/../bootstrap.php';
use PayPal\Api\CreditCard;
$cardId = "CARD-5BT058015C739554AKE2GCEI";
+card operation. Use $card->getId()
$cardId = "CARD-5AR29593TC404090HKIKN77Q";
/// ### Retrieve card
try {
$card = CreditCard::get($cardId, $apiContext);
-} catch (\PPConnectionException $ex) {
+} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception: " . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
diff --git a/sample/source/RefundCapture.html b/sample/source/RefundCapture.html
index c53b095..30ee488 100644
--- a/sample/source/RefundCapture.html
+++ b/sample/source/RefundCapture.html
@@ -67,26 +67,26 @@ PayPal-Request-Id (idempotency) header for this resource
$addr->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
- $addr->setPostal_code("14305");
- $addr->setCountry_code("US");
+ $addr->setPostalCode("14305");
+ $addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
- $card->setExpire_month("11");
- $card->setExpire_year("2019");
+ $card->setExpireMonth("11");
+ $card->setExpireYear("2019");
$card->setCvv2("012");
- $card->setFirst_name("Joe");
- $card->setLast_name("Shopper");
- $card->setBilling_address($addr);
+ $card->setFirstName("Joe");
+ $card->setLastName("Shopper");
+ $card->setBillingAddress($addr);
$fi = new FundingInstrument();
- $fi->setCredit_card($card);
+ $fi->setCreditCard($card);
$payer = new Payer();
- $payer->setPayment_method("credit_card");
- $payer->setFunding_instruments(array($fi));
+ $payer->setPaymentMethod("credit_card");
+ $payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/source/VoidAuthorization.html b/sample/source/VoidAuthorization.html
index bf9b900..1351f16 100644
--- a/sample/source/VoidAuthorization.html
+++ b/sample/source/VoidAuthorization.html
@@ -41,26 +41,26 @@ The return object contains the status;
$addr
->setLine2("Niagara Falls");
$addr->setCity("Niagara Falls");
$addr->setState("NY");
-
$addr->setPostal_code("14305");
-
$addr->setCountry_code("US");
+
$addr->setPostalCode("14305");
+
$addr->setCountryCode("US");
$addr->setPhone("716-298-1822");
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
-
$card->setExpire_month("11");
-
$card->setExpire_year("2019");
+
$card->setExpireMonth("11");
+
$card->setExpireYear("2019");
$card->setCvv2("012");
-
$card->setFirst_name("Joe");
-
$card->setLast_name("Shopper");
-
$card->setBilling_address($addr);
+
$card->setFirstName("Joe");
+
$card->setLastName("Shopper");
+
$card->setBillingAddress($addr);
$fi = new FundingInstrument();
-
$fi->setCredit_card($card);
+
$fi->setCreditCard($card);
$payer = new Payer();
-
$payer->setPayment_method("credit_card");
-
$payer->setFunding_instruments(array($fi));
+
$payer->setPaymentMethod("credit_card");
+
$payer->setFundingInstruments(array($fi));
$amount = new Amount();
$amount->setCurrency("USD");
diff --git a/sample/vault/CreateCreditCard.php b/sample/vault/CreateCreditCard.php
index bf50d4c..04bda56 100644
--- a/sample/vault/CreateCreditCard.php
+++ b/sample/vault/CreateCreditCard.php
@@ -21,11 +21,11 @@ use PayPal\Api\Address;
$card = new CreditCard();
$card->setType("visa");
$card->setNumber("4417119669820331");
-$card->setExpire_month("11");
-$card->setExpire_year("2019");
+$card->setExpireMonth("11");
+$card->setExpireYear("2019");
$card->setCvv2("012");
-$card->setFirst_name("Joe");
-$card->setLast_name("Shopper");
+$card->setFirstName("Joe");
+$card->setLastName("Shopper");
// ### Save card
// Creates the credit card as a resource
@@ -35,7 +35,7 @@ $card->setLast_name("Shopper");
// (See bootstrap.php for more on `ApiContext`)
try {
$card->create($apiContext);
-} catch (\PPConnectionException $ex) {
+} catch (PayPal\Exception\PPConnectionException $ex) {
echo "Exception:" . $ex->getMessage() . PHP_EOL;
var_dump($ex->getData());
exit(1);
@@ -47,4 +47,4 @@ try {
Back
Save card
+$card->setFirstName("Joe"); +$card->setLastName("Shopper");