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

Save card

+$card->setFirstName("Joe"); +$card->setLastName("Shopper");

Save card

Creates the credit card as a resource in the PayPal vault. The response contains @@ -27,7 +27,7 @@ an 'id' that you can use to refer to it in the future payments. (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); 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");

CreditCard

A resource representing a credit card that can be used to fund a payment.

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

FundingInstrument

+$card->setFirstName("Joe"); +$card->setLastName("Shopper"); +$card->setBillingAddress($addr);

FundingInstrument

A resource representing a Payer's funding instrument. Use a Payer ID (A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument) and the CreditCardDetails

$fi = new FundingInstrument(); -$fi->setCredit_card($card);

Payer

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

Amount

+$payer->setPaymentMethod("credit_card"); +$payer->setFundingInstruments(array($fi));

Amount

Let's you specify a payment amount.

$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

+$payer->setPaymentMethod("paypal");

Amount

Let's you specify a payment amount.

$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

+$redirectUrls->setReturnUrl("$baseUrl/ExecutePayment.php?success=true"); +$redirectUrls->setCancelUrl("$baseUrl/ExecutePayment.php?success=false");

Payment

A Payment Resource; create one using the above types and intent as 'sale'

$payment = new Payment(); $payment->setIntent("sale"); $payment->setPayer($payer); -$payment->setRedirect_urls($redirectUrls); +$payment->setRedirectUrls($redirectUrls); $payment->setTransactions(array($transaction));

Create Payment

Create a payment by posting to the APIService diff --git a/sample/source/CreatePaymentUsingSavedCard.html b/sample/source/CreatePaymentUsingSavedCard.html index 07417ff..fa4aeec 100644 --- a/sample/source/CreatePaymentUsingSavedCard.html +++ b/sample/source/CreatePaymentUsingSavedCard.html @@ -17,20 +17,20 @@ API used: /v1/payments/payment

FundingInstrument

+$creditCardToken->setCreditCardId($creditCardId);

FundingInstrument

A resource representing a Payer's funding instrument. Use a Payer ID (A unique identifier of the payer generated and provided by the facilitator. This is required when creating or using a tokenized funding instrument) and the CreditCardDetails

$fi = new FundingInstrument(); -$fi->setCredit_card_token($creditCardToken);

Payer

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

Amount

+$payer->setPaymentMethod("credit_card"); +$payer->setFundingInstruments(array($fi));

Amount

Let's you specify a payment amount.

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

Save card

+$card->setFirstName("Joe"); +$card->setLastName("Shopper");

Save card

Creates the credit card as a resource in the PayPal vault. The response contains @@ -24,7 +24,7 @@ an 'id' that you can use to refer to it in the future payments. (See bootstrap.php for more on ApiContext)

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

(See bootstrap.php for more on ApiContext)

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

The cardId can be obtained from a previous save credit -card operation. Use $card->getId()

$cardId = "CARD-5BT058015C739554AKE2GCEI"; +card operation. Use $card->getId()

$cardId = "CARD-5AR29593TC404090HKIKN77Q"; /// ### Retrieve card

(See bootstrap.php for more on ApiContext)

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 - \ No newline at end of file + diff --git a/sample/vault/DeleteCreditCard.php b/sample/vault/DeleteCreditCard.php index 29d25e0..0e409ab 100644 --- a/sample/vault/DeleteCreditCard.php +++ b/sample/vault/DeleteCreditCard.php @@ -16,11 +16,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 @@ -30,7 +30,7 @@ $card->setLast_name("Shopper"); // (See bootstrap.php for more on `ApiContext`) 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); @@ -42,7 +42,7 @@ try { // 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); } @@ -54,4 +54,4 @@ try {

Credit Card deleted Successfully

Back - \ No newline at end of file + diff --git a/sample/vault/GetCreditCard.php b/sample/vault/GetCreditCard.php index 815bfaf..c8781a4 100644 --- a/sample/vault/GetCreditCard.php +++ b/sample/vault/GetCreditCard.php @@ -12,13 +12,13 @@ use PayPal\Api\CreditCard; // The cardId can be obtained from a previous save credit // card operation. Use $card->getId() -$cardId = "CARD-5BT058015C739554AKE2GCEI"; +$cardId = "CARD-5AR29593TC404090HKIKN77Q"; /// ### Retrieve card // (See bootstrap.php for more on `ApiContext`) 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); @@ -30,4 +30,4 @@ try {
Back - \ No newline at end of file + diff --git a/tests/PayPal/Test/Api/AddressTest.php b/tests/PayPal/Test/Api/AddressTest.php index ec271c9..b02dd07 100644 --- a/tests/PayPal/Test/Api/AddressTest.php +++ b/tests/PayPal/Test/Api/AddressTest.php @@ -51,4 +51,4 @@ class AddressTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($a1, $a2); } -} \ No newline at end of file +} diff --git a/tests/PayPal/Test/Api/AuthorizationTest.php b/tests/PayPal/Test/Api/AuthorizationTest.php index 63ba8cb..73b2f25 100644 --- a/tests/PayPal/Test/Api/AuthorizationTest.php +++ b/tests/PayPal/Test/Api/AuthorizationTest.php @@ -47,26 +47,26 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase { $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"); @@ -153,4 +153,4 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase { $this->assertEquals(strpos($ex->getMessage(),"500"), false); } } -} \ No newline at end of file +} diff --git a/tests/PayPal/Test/Api/TransactionTest.php b/tests/PayPal/Test/Api/TransactionTest.php index f2e0ba3..4659f0d 100644 --- a/tests/PayPal/Test/Api/TransactionTest.php +++ b/tests/PayPal/Test/Api/TransactionTest.php @@ -46,4 +46,4 @@ class TransactionTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($t1, $t2); } -} \ No newline at end of file +}