From c2947ff409ba98953f9ad41ea70eec4344d1158f Mon Sep 17 00:00:00 2001 From: mrak and sdcoffey Date: Tue, 25 Oct 2016 17:29:48 -0500 Subject: [PATCH 1/2] Update payments API to v1.9 --- lib/PayPal/Api/Address.php | 27 ++- lib/PayPal/Api/AlternatePayment.php | 2 + lib/PayPal/Api/Amount.php | 10 +- lib/PayPal/Api/Authorization.php | 130 +++++++++----- lib/PayPal/Api/BankAccount.php | 96 +++++------ lib/PayPal/Api/Billing.php | 2 + lib/PayPal/Api/Capture.php | 151 ++++++++++++---- lib/PayPal/Api/CarrierAccount.php | 22 +-- lib/PayPal/Api/CarrierAccountToken.php | 4 +- lib/PayPal/Api/CartBase.php | 67 ++++---- lib/PayPal/Api/CountryCode.php | 4 +- lib/PayPal/Api/Credit.php | 4 +- lib/PayPal/Api/CreditCard.php | 2 +- lib/PayPal/Api/CreditCardToken.php | 16 +- lib/PayPal/Api/Currency.php | 8 +- lib/PayPal/Api/CurrencyConversion.php | 36 ++-- lib/PayPal/Api/DetailedRefund.php | 160 +++++++++++++++++ lib/PayPal/Api/Details.php | 16 +- lib/PayPal/Api/Error.php | 10 +- lib/PayPal/Api/ErrorDetails.php | 8 +- lib/PayPal/Api/ExtendedBankAccount.php | 4 +- lib/PayPal/Api/ExternalFunding.php | 24 +++ lib/PayPal/Api/FmfDetails.php | 8 +- lib/PayPal/Api/FundingDetail.php | 10 +- lib/PayPal/Api/FundingInstrument.php | 21 +-- lib/PayPal/Api/FundingSource.php | 59 ++++--- lib/PayPal/Api/Incentive.php | 32 ++-- lib/PayPal/Api/InstallmentOption.php | 14 +- lib/PayPal/Api/Item.php | 49 ++---- lib/PayPal/Api/ItemList.php | 20 +-- lib/PayPal/Api/Order.php | 116 ++++++++----- lib/PayPal/Api/Patch.php | 10 +- lib/PayPal/Api/PatchRequest.php | 2 +- lib/PayPal/Api/Payee.php | 28 ++- lib/PayPal/Api/Payer.php | 70 +++++--- lib/PayPal/Api/PayerInfo.php | 95 ++++++---- lib/PayPal/Api/Payment.php | 162 ++++++++---------- lib/PayPal/Api/PaymentCard.php | 155 ++++++++++------- lib/PayPal/Api/PaymentExecution.php | 13 +- lib/PayPal/Api/PaymentHistory.php | 4 +- lib/PayPal/Api/PaymentOptions.php | 14 +- lib/PayPal/Api/Phone.php | 12 +- lib/PayPal/Api/PotentialPayerInfo.php | 15 +- lib/PayPal/Api/Refund.php | 103 ++++++++--- lib/PayPal/Api/RefundRequest.php | 162 ++++++++++++++++++ lib/PayPal/Api/RelatedResources.php | 18 +- lib/PayPal/Api/Sale.php | 150 +++++++++------- lib/PayPal/Api/ShippingAddress.php | 23 ++- lib/PayPal/Api/Transaction.php | 3 +- sample/payments/CreatePayment.php | 10 +- tests/PayPal/Test/Api/AddressTest.php | 7 +- tests/PayPal/Test/Api/AmountTest.php | 3 - tests/PayPal/Test/Api/AuthorizationTest.php | 24 ++- tests/PayPal/Test/Api/BankAccountTest.php | 5 +- tests/PayPal/Test/Api/BankTokenTest.php | 3 - tests/PayPal/Test/Api/CaptureTest.php | 16 +- tests/PayPal/Test/Api/CartBaseTest.php | 6 +- tests/PayPal/Test/Api/CreditCardTest.php | 1 - tests/PayPal/Test/Api/DetailedRefundTest.php | 68 ++++++++ tests/PayPal/Test/Api/ErrorTest.php | 2 - .../Test/Api/ExtendedBankAccountTest.php | 3 - tests/PayPal/Test/Api/FmfDetailsTest.php | 3 - tests/PayPal/Test/Api/FundingDetailTest.php | 3 - .../PayPal/Test/Api/FundingInstrumentTest.php | 5 - tests/PayPal/Test/Api/FundingOptionTest.php | 3 - tests/PayPal/Test/Api/FundingSourceTest.php | 9 +- tests/PayPal/Test/Api/IncentiveTest.php | 3 - tests/PayPal/Test/Api/InstallmentInfoTest.php | 3 - .../PayPal/Test/Api/InstallmentOptionTest.php | 3 - tests/PayPal/Test/Api/ItemListTest.php | 3 - tests/PayPal/Test/Api/ItemTest.php | 3 - tests/PayPal/Test/Api/MeasurementTest.php | 3 - tests/PayPal/Test/Api/NameValuePairTest.php | 3 - tests/PayPal/Test/Api/OrderTest.php | 24 +-- tests/PayPal/Test/Api/PayeeTest.php | 5 +- tests/PayPal/Test/Api/PayerInfoTest.php | 9 +- tests/PayPal/Test/Api/PayerTest.php | 7 +- tests/PayPal/Test/Api/PaymentCardTest.php | 11 +- .../PayPal/Test/Api/PaymentExecutionTest.php | 3 - tests/PayPal/Test/Api/PaymentHistoryTest.php | 3 - tests/PayPal/Test/Api/PaymentOptionsTest.php | 3 - tests/PayPal/Test/Api/PaymentTest.php | 20 +-- tests/PayPal/Test/Api/PhoneTest.php | 3 - .../Api/RecipientBankingInstructionTest.php | 3 - tests/PayPal/Test/Api/RedirectUrlsTest.php | 4 - tests/PayPal/Test/Api/RefundRequestTest.php | 66 +++++++ tests/PayPal/Test/Api/RefundTest.php | 15 +- .../PayPal/Test/Api/RelatedResourcesTest.php | 3 - tests/PayPal/Test/Api/SaleTest.php | 6 +- tests/PayPal/Test/Api/ShippingAddressTest.php | 3 - tests/PayPal/Test/Api/TransactionTest.php | 2 - .../PaymentsFunctionalTest/testCreate.json | 3 +- 92 files changed, 1583 insertions(+), 973 deletions(-) create mode 100644 lib/PayPal/Api/DetailedRefund.php create mode 100644 lib/PayPal/Api/RefundRequest.php create mode 100644 tests/PayPal/Test/Api/DetailedRefundTest.php create mode 100644 tests/PayPal/Test/Api/RefundRequestTest.php diff --git a/lib/PayPal/Api/Address.php b/lib/PayPal/Api/Address.php index aba5a706..56d95e85 100644 --- a/lib/PayPal/Api/Address.php +++ b/lib/PayPal/Api/Address.php @@ -10,11 +10,12 @@ * @package PayPal\Api * * @property string phone + * @property string type */ class Address extends BaseAddress { /** - * Phone number in E.123 format. + * Phone number in E.123 format. 50 characters max. * * @param string $phone * @@ -27,7 +28,7 @@ public function setPhone($phone) } /** - * Phone number in E.123 format. + * Phone number in E.123 format. 50 characters max. * * @return string */ @@ -36,4 +37,26 @@ public function getPhone() return $this->phone; } + /** + * Type of address (e.g., HOME_OR_WORK, GIFT etc). + * + * @param string $type + * + * @return $this + */ + public function setType($type) + { + $this->type = $type; + return $this; + } + + /** + * Type of address (e.g., HOME_OR_WORK, GIFT etc). + * + * @return string + */ + public function getType() + { + return $this->type; + } } diff --git a/lib/PayPal/Api/AlternatePayment.php b/lib/PayPal/Api/AlternatePayment.php index 0af3226e..7999c5f5 100644 --- a/lib/PayPal/Api/AlternatePayment.php +++ b/lib/PayPal/Api/AlternatePayment.php @@ -11,6 +11,8 @@ * * @package PayPal\Api * + * @deprecated Used for limited release only. + * * @property string alternate_payment_account_id * @property string external_customer_id * @property string alternate_payment_provider_id diff --git a/lib/PayPal/Api/Amount.php b/lib/PayPal/Api/Amount.php index 72217300..82fd6c8e 100644 --- a/lib/PayPal/Api/Amount.php +++ b/lib/PayPal/Api/Amount.php @@ -13,8 +13,8 @@ * * @package PayPal\Api * - * @property string currency - * @property string total + * @property string currency + * @property string total * @property \PayPal\Api\Details details */ class Amount extends PayPalModel @@ -23,7 +23,7 @@ class Amount extends PayPalModel * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies. * * @param string $currency - * + * * @return $this */ public function setCurrency($currency) @@ -46,7 +46,7 @@ public function getCurrency() * Total amount charged from the payer to the payee. In case of a refund, this is the refunded amount to the original payer from the payee. 10 characters max with support for 2 decimal places. * * @param string|double $total - * + * * @return $this */ public function setTotal($total) @@ -71,7 +71,7 @@ public function getTotal() * Additional details of the payment amount. * * @param \PayPal\Api\Details $details - * + * * @return $this */ public function setDetails($details) diff --git a/lib/PayPal/Api/Authorization.php b/lib/PayPal/Api/Authorization.php index 142d0604..5da9d458 100644 --- a/lib/PayPal/Api/Authorization.php +++ b/lib/PayPal/Api/Authorization.php @@ -3,8 +3,8 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; -use PayPal\Rest\ApiContext; use PayPal\Validation\ArgumentValidator; +use PayPal\Rest\ApiContext; /** * Class Authorization @@ -13,21 +13,23 @@ * * @package PayPal\Api * - * @property string id - * @property \PayPal\Api\Amount amount - * @property string payment_mode - * @property string state - * @property string reason_code - * @property string pending_reason - * @property string protection_eligibility - * @property string protection_eligibility_type + * @property string id + * @property \PayPal\Api\Amount amount + * @property string payment_mode + * @property string state + * @property string reason_code + * @property string pending_reason + * @property string protection_eligibility + * @property string protection_eligibility_type * @property \PayPal\Api\FmfDetails fmf_details - * @property string parent_payment + * @property string parent_payment * @property \PayPal\Api\ProcessorResponse processor_response - * @property string valid_until - * @property string create_time - * @property string update_time - * @property \PayPal\Api\Links[] links + * @property string valid_until + * @property string create_time + * @property string update_time + * @property string reference_id + * @property string receipt_id + * @property \PayPal\Api\Links[] links */ class Authorization extends PayPalResourceModel { @@ -35,7 +37,7 @@ class Authorization extends PayPalResourceModel * ID of the authorization transaction. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -58,7 +60,7 @@ public function getId() * Amount being authorized. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -82,7 +84,7 @@ public function getAmount() * Valid Values: ["INSTANT_TRANSFER"] * * @param string $payment_mode - * + * * @return $this */ public function setPaymentMode($payment_mode) @@ -106,7 +108,7 @@ public function getPaymentMode() * Valid Values: ["pending", "authorized", "partially_captured", "captured", "expired", "voided"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -130,7 +132,7 @@ public function getState() * Valid Values: ["AUTHORIZATION"] * * @param string $reason_code - * + * * @return $this */ public function setReasonCode($reason_code) @@ -154,7 +156,7 @@ public function getReasonCode() * Valid Values: ["AUTHORIZATION"] * * @param string $pending_reason - * + * * @return $this */ public function setPendingReason($pending_reason) @@ -178,7 +180,7 @@ public function getPendingReason() * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility - * + * * @return $this */ public function setProtectionEligibility($protection_eligibility) @@ -202,7 +204,7 @@ public function getProtectionEligibility() * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"] * * @param string $protection_eligibility_type - * + * * @return $this */ public function setProtectionEligibilityType($protection_eligibility_type) @@ -225,7 +227,7 @@ public function getProtectionEligibilityType() * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](https://developer.paypal.com/docs/classic/fmf/integration-guide/FMFSummary/) for more information. * * @param \PayPal\Api\FmfDetails $fmf_details - * + * * @return $this */ public function setFmfDetails($fmf_details) @@ -248,7 +250,7 @@ public function getFmfDetails() * ID of the Payment resource that this transaction is based on. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -294,7 +296,7 @@ public function getProcessorResponse() * Authorization expiration time and date as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $valid_until - * + * * @return $this */ public function setValidUntil($valid_until) @@ -317,7 +319,7 @@ public function getValidUntil() * Time of authorization as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -340,7 +342,7 @@ public function getCreateTime() * Time that the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -360,11 +362,57 @@ public function getUpdateTime() } /** - * Retrieve details about a previously created authorization by passing the authorization_id in the request URI. + * Identifier to the purchase or transaction unit corresponding to this authorization transaction. + * + * @param string $reference_id + * + * @return $this + */ + public function setReferenceId($reference_id) + { + $this->reference_id = $reference_id; + return $this; + } + + /** + * Identifier to the purchase or transaction unit corresponding to this authorization transaction. + * + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + + /** + * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment. + * + * @param string $receipt_id + * + * @return $this + */ + public function setReceiptId($receipt_id) + { + $this->receipt_id = $receipt_id; + return $this; + } + + /** + * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment. + * + * @return string + */ + public function getReceiptId() + { + return $this->receipt_id; + } + + /** + * Shows details for an authorization, by ID. * - * @param string $authorizationId - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param string $authorizationId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public static function get($authorizationId, $apiContext = null, $restCall = null) @@ -385,11 +433,11 @@ public static function get($authorizationId, $apiContext = null, $restCall = nul } /** - * Capture and process a previously created authorization by passing the authorization_id in the request URI. To use this request, the original payment call must have the intent set to authorize. + * Captures and processes an authorization, by ID. To use this call, the original payment call must specify an intent of `authorize`. * - * @param Capture $capture - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param Capture $capture + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Capture */ public function capture($capture, $apiContext = null, $restCall = null) @@ -411,10 +459,10 @@ public function capture($capture, $apiContext = null, $restCall = null) } /** - * Void (cancel) a previously authorized payment by passing the authorization_id in the request URI. Note that a fully captured authorization cannot be voided. + * Voids, or cancels, an authorization, by ID. You cannot void a fully captured authorization. * - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public function void($apiContext = null, $restCall = null) @@ -434,10 +482,10 @@ public function void($apiContext = null, $restCall = null) } /** - * Reauthorize a PayPal account payment by passing the authorization_id in the request URI. You should reauthorize a payment after the initial 3-day honor period to ensure that funds are still available. Request supports only amount field + * Reauthorizes a PayPal account payment, by authorization ID. To ensure that funds are still available, reauthorize a payment after the initial three-day honor period. Supports only the `amount` request parameter. * - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public function reauthorize($apiContext = null, $restCall = null) diff --git a/lib/PayPal/Api/BankAccount.php b/lib/PayPal/Api/BankAccount.php index 4a45f8d1..79803f7f 100644 --- a/lib/PayPal/Api/BankAccount.php +++ b/lib/PayPal/Api/BankAccount.php @@ -11,38 +11,37 @@ * * @package PayPal\Api * - * @property string account_number - * @property string account_number_type - * @property string routing_number - * @property string account_type - * @property string account_name - * @property string check_type - * @property string auth_type - * @property string auth_capture_timestamp - * @property string bank_name - * @property string country_code - * @property string first_name - * @property string last_name - * @property string birth_date + * @property string account_number + * @property string account_number_type + * @property string routing_number + * @property string account_type + * @property string account_name + * @property string check_type + * @property string auth_type + * @property string auth_capture_timestamp + * @property string bank_name + * @property string country_code + * @property string first_name + * @property string last_name + * @property string birth_date * @property \PayPal\Api\Address billing_address - * @property string state - * @property string confirmation_status - * @property string payer_id - * @property string external_customer_id - * @property string merchant_id - * @property string create_time - * @property string update_time - * @property string valid_until + * @property string state + * @property string confirmation_status + * @property string payer_id + * @property string external_customer_id + * @property string merchant_id + * @property string create_time + * @property string update_time + * @property string valid_until * @property \PayPal\Api\Links[] links */ class BankAccount extends PayPalModel { /** * ID of the bank account being saved for later use. - * * @deprecated Not publicly available * @param string $id - * + * * @return $this */ public function setId($id) @@ -53,7 +52,6 @@ public function setId($id) /** * ID of the bank account being saved for later use. - * * @deprecated Not publicly available * @return string */ @@ -66,7 +64,7 @@ public function getId() * Account number in either IBAN (max length 34) or BBAN (max length 17) format. * * @param string $account_number - * + * * @return $this */ public function setAccountNumber($account_number) @@ -90,7 +88,7 @@ public function getAccountNumber() * Valid Values: ["BBAN", "IBAN"] * * @param string $account_number_type - * + * * @return $this */ public function setAccountNumberType($account_number_type) @@ -113,7 +111,7 @@ public function getAccountNumberType() * Routing transit number (aka Bank Code) of the bank (typically for domestic use only - for international use, IBAN includes bank code). For more information refer to http://en.wikipedia.org/wiki/Bank_code. * * @param string $routing_number - * + * * @return $this */ public function setRoutingNumber($routing_number) @@ -137,7 +135,7 @@ public function getRoutingNumber() * Valid Values: ["CHECKING", "SAVINGS"] * * @param string $account_type - * + * * @return $this */ public function setAccountType($account_type) @@ -160,7 +158,7 @@ public function getAccountType() * A customer designated name. * * @param string $account_name - * + * * @return $this */ public function setAccountName($account_name) @@ -184,7 +182,7 @@ public function getAccountName() * Valid Values: ["PERSONAL", "COMPANY"] * * @param string $check_type - * + * * @return $this */ public function setCheckType($check_type) @@ -208,7 +206,7 @@ public function getCheckType() * Valid Values: ["CCD", "PPD", "TEL", "POP", "ARC", "RCK", "WEB"] * * @param string $auth_type - * + * * @return $this */ public function setAuthType($auth_type) @@ -231,7 +229,7 @@ public function getAuthType() * Time at which the authorization (or check) was captured. Use this field if the user authorization needs to be captured due to any privacy requirements. * * @param string $auth_capture_timestamp - * + * * @return $this */ public function setAuthCaptureTimestamp($auth_capture_timestamp) @@ -254,7 +252,7 @@ public function getAuthCaptureTimestamp() * Name of the bank. * * @param string $bank_name - * + * * @return $this */ public function setBankName($bank_name) @@ -277,7 +275,7 @@ public function getBankName() * 2 letter country code of the Bank. * * @param string $country_code - * + * * @return $this */ public function setCountryCode($country_code) @@ -300,7 +298,7 @@ public function getCountryCode() * Account holder's first name. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -323,7 +321,7 @@ public function getFirstName() * Account holder's last name. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -346,7 +344,7 @@ public function getLastName() * Birth date of the bank account holder. * * @param string $birth_date - * + * * @return $this */ public function setBirthDate($birth_date) @@ -369,7 +367,7 @@ public function getBirthDate() * Billing address. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -393,7 +391,7 @@ public function getBillingAddress() * Valid Values: ["ACTIVE", "INACTIVE", "DELETED"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -417,7 +415,7 @@ public function getState() * Valid Values: ["UNCONFIRMED", "CONFIRMED"] * * @param string $confirmation_status - * + * * @return $this */ public function setConfirmationStatus($confirmation_status) @@ -440,7 +438,7 @@ public function getConfirmationStatus() * [DEPRECATED] Use external_customer_id instead. * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -463,7 +461,7 @@ public function getPayerId() * A unique identifier of the customer to whom this bank account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault. * * @param string $external_customer_id - * + * * @return $this */ public function setExternalCustomerId($external_customer_id) @@ -483,10 +481,10 @@ public function getExternalCustomerId() } /** - * A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchnt. + * A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchant. * * @param string $merchant_id - * + * * @return $this */ public function setMerchantId($merchant_id) @@ -496,7 +494,7 @@ public function setMerchantId($merchant_id) } /** - * A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchnt. + * A unique identifier of the merchant for which this bank account has been stored for. Generated and provided by the facilitator so it can be used to restrict the usage of the bank account to the specific merchant. * * @return string */ @@ -509,7 +507,7 @@ public function getMerchantId() * Time the resource was created. * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -532,7 +530,7 @@ public function getCreateTime() * Time the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -555,7 +553,7 @@ public function getUpdateTime() * Date/Time until this resource can be used to fund a payment. * * @param string $valid_until - * + * * @return $this */ public function setValidUntil($valid_until) @@ -578,7 +576,7 @@ public function getValidUntil() * Sets Links * * @param \PayPal\Api\Links[] $links - * + * * @return $this */ public function setLinks($links) diff --git a/lib/PayPal/Api/Billing.php b/lib/PayPal/Api/Billing.php index 7b1bad69..727f907f 100644 --- a/lib/PayPal/Api/Billing.php +++ b/lib/PayPal/Api/Billing.php @@ -11,6 +11,8 @@ * * @package PayPal\Api * + * @deprecated Used internally only. + * * @property string billing_agreement_id */ class Billing extends PayPalModel diff --git a/lib/PayPal/Api/Capture.php b/lib/PayPal/Api/Capture.php index b3580a72..8358bfd7 100644 --- a/lib/PayPal/Api/Capture.php +++ b/lib/PayPal/Api/Capture.php @@ -3,8 +3,9 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; -use PayPal\Rest\ApiContext; +use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; +use PayPal\Rest\ApiContext; /** * Class Capture @@ -13,23 +14,25 @@ * * @package PayPal\Api * - * @property string id - * @property \PayPal\Api\Amount amount - * @property bool is_final_capture - * @property string state - * @property string parent_payment + * @property string id + * @property \PayPal\Api\Amount amount + * @property bool is_final_capture + * @property string state + * @property string reason_code + * @property string parent_payment + * @property string invoice_number * @property \PayPal\Api\Currency transaction_fee - * @property string create_time - * @property string update_time - * @property \PayPal\Api\Links[] links + * @property string create_time + * @property string update_time + * @property \PayPal\Api\Links[] links */ class Capture extends PayPalResourceModel { /** - * ID of the capture transaction. + * The ID of the capture transaction. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -39,7 +42,7 @@ public function setId($id) } /** - * ID of the capture transaction. + * The ID of the capture transaction. * * @return string */ @@ -49,10 +52,10 @@ public function getId() } /** - * Amount being captured. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`. + * The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -62,7 +65,7 @@ public function setAmount($amount) } /** - * Amount being captured. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`. + * The amount to capture. If the amount matches the orginally authorized amount, the state of the authorization changes to `captured`. If not, the state of the authorization changes to `partially_captured`. * * @return \PayPal\Api\Amount */ @@ -72,10 +75,10 @@ public function getAmount() } /** - * If set to `true`, all remaining funds held by the authorization will be released in the funding instrument. + * Indicates whether to release all remaining funds that the authorization holds in the funding instrument. Default is `false`. * * @param bool $is_final_capture - * + * * @return $this */ public function setIsFinalCapture($is_final_capture) @@ -85,7 +88,7 @@ public function setIsFinalCapture($is_final_capture) } /** - * If set to `true`, all remaining funds held by the authorization will be released in the funding instrument. + * Indicates whether to release all remaining funds that the authorization holds in the funding instrument. Default is `false`. * * @return bool */ @@ -95,11 +98,11 @@ public function getIsFinalCapture() } /** - * State of the capture. + * The state of the capture. * Valid Values: ["pending", "completed", "refunded", "partially_refunded"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -109,7 +112,7 @@ public function setState($state) } /** - * State of the capture. + * The state of the capture. * * @return string */ @@ -119,10 +122,34 @@ public function getState() } /** - * ID of the payment resource on which this transaction is based. + * The reason code that describes why the transaction state is pending or reversed. + * Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED", "TRANSACTION_APPROVED_AWAITING_FUNDING"] * - * @param string $parent_payment + * @param string $reason_code + * + * @return $this + */ + public function setReasonCode($reason_code) + { + $this->reason_code = $reason_code; + return $this; + } + + /** + * The reason code that describes why the transaction state is pending or reversed. + * + * @return string + */ + public function getReasonCode() + { + return $this->reason_code; + } + + /** + * The ID of the payment on which this transaction is based. * + * @param string $parent_payment + * * @return $this */ public function setParentPayment($parent_payment) @@ -132,7 +159,7 @@ public function setParentPayment($parent_payment) } /** - * ID of the payment resource on which this transaction is based. + * The ID of the payment on which this transaction is based. * * @return string */ @@ -142,10 +169,33 @@ public function getParentPayment() } /** - * Transaction fee applicable for this payment. + * The invoice number to track this payment. * - * @param \PayPal\Api\Currency $transaction_fee + * @param string $invoice_number + * + * @return $this + */ + public function setInvoiceNumber($invoice_number) + { + $this->invoice_number = $invoice_number; + return $this; + } + + /** + * The invoice number to track this payment. * + * @return string + */ + public function getInvoiceNumber() + { + return $this->invoice_number; + } + + /** + * The transaction fee for this payment. + * + * @param \PayPal\Api\Currency $transaction_fee + * * @return $this */ public function setTransactionFee($transaction_fee) @@ -155,7 +205,7 @@ public function setTransactionFee($transaction_fee) } /** - * Transaction fee applicable for this payment. + * The transaction fee for this payment. * * @return \PayPal\Api\Currency */ @@ -165,10 +215,10 @@ public function getTransactionFee() } /** - * Time of capture as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). + * The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -178,7 +228,7 @@ public function setCreateTime($create_time) } /** - * Time of capture as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). + * The date and time of capture, as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ @@ -188,10 +238,10 @@ public function getCreateTime() } /** - * Time that the resource was last updated. + * The date and time when the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -201,7 +251,7 @@ public function setUpdateTime($update_time) } /** - * Time that the resource was last updated. + * The date and time when the resource was last updated. * * @return string */ @@ -211,11 +261,11 @@ public function getUpdateTime() } /** - * Retrieve details about a captured payment by passing the capture_id in the request URI. + * Shows details for a captured payment, by ID. * - * @param string $captureId - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param string $captureId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Capture */ public static function get($captureId, $apiContext = null, $restCall = null) @@ -238,6 +288,7 @@ public static function get($captureId, $apiContext = null, $restCall = null) /** * Refund a captured payment by passing the capture_id in the request URI. In addition, include an amount object in the body of the request JSON. * + * @deprecated Please use #refundCapturedPayment instead. * @param Refund $refund * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls @@ -261,4 +312,30 @@ public function refund($refund, $apiContext = null, $restCall = null) return $ret; } + /** + * Refunds a captured payment, by ID. Include an `amount` object in the JSON request body. + * + * @param RefundRequest $refundRequest + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @return DetailedRefund + */ + public function refundCapturedPayment($refundRequest, $apiContext = null, $restCall = null) + { + ArgumentValidator::validate($this->getId(), "Id"); + ArgumentValidator::validate($refundRequest, 'refundRequest'); + $payLoad = $refundRequest->toJSON(); + $json = self::executeCall( + "/v1/payments/capture/{$this->getId()}/refund", + "POST", + $payLoad, + null, + $apiContext, + $restCall + ); + $ret = new DetailedRefund(); + $ret->fromJson($json); + return $ret; + } + } diff --git a/lib/PayPal/Api/CarrierAccount.php b/lib/PayPal/Api/CarrierAccount.php index 2e7c8d79..7f245b04 100644 --- a/lib/PayPal/Api/CarrierAccount.php +++ b/lib/PayPal/Api/CarrierAccount.php @@ -7,7 +7,7 @@ /** * Class CarrierAccount * - * Payment Instrument that facilitates carrier billing + * Payment instrument that enables carrier billing. * * @package PayPal\Api * @@ -20,7 +20,7 @@ class CarrierAccount extends PayPalModel { /** - * ID that identifies the payer�s carrier account. Can be used in subsequent REST API calls, e.g. for making payments. + * The ID of the carrier account of the payer. Use in subsequent REST API calls. For example, to make payments. * * @param string $id * @@ -33,7 +33,7 @@ public function setId($id) } /** - * ID that identifies the payer�s carrier account. Can be used in subsequent REST API calls, e.g. for making payments. + * The ID of the carrier account of the payer. Use in subsequent REST API calls. For example, to make payments. * * @return string */ @@ -43,7 +43,7 @@ public function getId() } /** - * The payer�s phone number in E.164 format. + * The phone number of the payer, in E.164 format. * * @param string $phone_number * @@ -56,7 +56,7 @@ public function setPhoneNumber($phone_number) } /** - * The payer�s phone number in E.164 format. + * The phone number of the payer, in E.164 format. * * @return string */ @@ -66,7 +66,7 @@ public function getPhoneNumber() } /** - * User identifier as created by the merchant. + * The ID of the customer, as created by the merchant. * * @param string $external_customer_id * @@ -79,7 +79,7 @@ public function setExternalCustomerId($external_customer_id) } /** - * User identifier as created by the merchant. + * The ID of the customer, as created by the merchant. * * @return string */ @@ -89,7 +89,7 @@ public function getExternalCustomerId() } /** - * The method of obtaining the phone number (USER_PROVIDED or READ_FROM_DEVICE). + * The method used to obtain the phone number. Value is `READ_FROM_DEVICE` or `USER_PROVIDED`. * Valid Values: ["READ_FROM_DEVICE", "USER_PROVIDED"] * * @param string $phone_source @@ -103,7 +103,7 @@ public function setPhoneSource($phone_source) } /** - * The method of obtaining the phone number (USER_PROVIDED or READ_FROM_DEVICE). + * The method used to obtain the phone number. Value is `READ_FROM_DEVICE` or `USER_PROVIDED`. * * @return string */ @@ -113,7 +113,7 @@ public function getPhoneSource() } /** - * The country where the phone number is registered. Specified in 2-character IS0-3166-1 format. + * The ISO 3166-1 alpha-2 country code where the phone number is registered. * * @param \PayPal\Api\CountryCode $country_code * @@ -126,7 +126,7 @@ public function setCountryCode($country_code) } /** - * The country where the phone number is registered. Specified in 2-character IS0-3166-1 format. + * The ISO 3166-1 alpha-2 country code where the phone number is registered. * * @return \PayPal\Api\CountryCode */ diff --git a/lib/PayPal/Api/CarrierAccountToken.php b/lib/PayPal/Api/CarrierAccountToken.php index 1313f65c..9fc987b3 100644 --- a/lib/PayPal/Api/CarrierAccountToken.php +++ b/lib/PayPal/Api/CarrierAccountToken.php @@ -20,7 +20,7 @@ class CarrierAccountToken extends PayPalModel * ID of a previously saved carrier account resource. * * @param string $carrier_account_id - * + * * @return $this */ public function setCarrierAccountId($carrier_account_id) @@ -43,7 +43,7 @@ public function getCarrierAccountId() * The unique identifier of the payer used when saving this carrier account instrument. * * @param string $external_customer_id - * + * * @return $this */ public function setExternalCustomerId($external_customer_id) diff --git a/lib/PayPal/Api/CartBase.php b/lib/PayPal/Api/CartBase.php index 32aa8a59..eebd8305 100644 --- a/lib/PayPal/Api/CartBase.php +++ b/lib/PayPal/Api/CartBase.php @@ -12,17 +12,18 @@ * * @package PayPal\Api * - * @property string reference_id - * @property \PayPal\Api\Amount amount - * @property string description - * @property string note_to_payee - * @property string custom - * @property string invoice_number - * @property string soft_descriptor + * @property string reference_id + * @property \PayPal\Api\Amount amount + * @property \PayPal\Api\Payee payee + * @property string description + * @property string note_to_payee + * @property string custom + * @property string invoice_number + * @property string soft_descriptor * @property \PayPal\Api\PaymentOptions payment_options - * @property \PayPal\Api\ItemList item_list - * @property string notify_url - * @property string order_url + * @property \PayPal\Api\ItemList item_list + * @property string notify_url + * @property string order_url */ class CartBase extends PayPalModel { @@ -30,7 +31,7 @@ class CartBase extends PayPalModel * Merchant identifier to the purchase unit. Optional parameter * * @param string $reference_id - * + * * @return $this */ public function setReferenceId($reference_id) @@ -53,7 +54,7 @@ public function getReferenceId() * Amount being collected. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -75,9 +76,8 @@ public function getAmount() /** * Recipient of the funds in this transaction. * - * @deprecated Not publicly available * @param \PayPal\Api\Payee $payee - * + * * @return $this */ public function setPayee($payee) @@ -89,7 +89,6 @@ public function setPayee($payee) /** * Recipient of the funds in this transaction. * - * @deprecated Not publicly available * @return \PayPal\Api\Payee */ public function getPayee() @@ -98,10 +97,10 @@ public function getPayee() } /** - * Description of transaction. + * Description of what is being paid for. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -111,7 +110,7 @@ public function setDescription($description) } /** - * Description of transaction. + * Description of what is being paid for. * * @return string */ @@ -124,7 +123,7 @@ public function getDescription() * Note to the recipient of the funds in this transaction. * * @param string $note_to_payee - * + * * @return $this */ public function setNoteToPayee($note_to_payee) @@ -144,10 +143,10 @@ public function getNoteToPayee() } /** - * Free-form field for the use of clients. Only supported when the `payment_method` is set to `paypal`. + * free-form field for the use of clients * * @param string $custom - * + * * @return $this */ public function setCustom($custom) @@ -157,7 +156,7 @@ public function setCustom($custom) } /** - * Free-form field for the use of clients. Only supported when the `payment_method` is set to `paypal`. + * free-form field for the use of clients * * @return string */ @@ -167,10 +166,10 @@ public function getCustom() } /** - * Invoice number used to track the payment. Only supported when the `payment_method` is set to `paypal`. + * invoice number to track this payment * * @param string $invoice_number - * + * * @return $this */ public function setInvoiceNumber($invoice_number) @@ -180,7 +179,7 @@ public function setInvoiceNumber($invoice_number) } /** - * Invoice number used to track the payment. Only supported when the `payment_method` is set to `paypal`. + * invoice number to track this payment * * @return string */ @@ -193,7 +192,7 @@ public function getInvoiceNumber() * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated * * @param string $soft_descriptor - * + * * @return $this */ public function setSoftDescriptor($soft_descriptor) @@ -214,10 +213,9 @@ public function getSoftDescriptor() /** * Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card` - * * @deprecated Not publicly available * @param string $soft_descriptor_city - * + * * @return $this */ public function setSoftDescriptorCity($soft_descriptor_city) @@ -228,7 +226,6 @@ public function setSoftDescriptorCity($soft_descriptor_city) /** * Soft descriptor city used when charging this funding source. If length exceeds max length, the value will be truncated. Only supported when the `payment_method` is set to `credit_card` - * * @deprecated Not publicly available * @return string */ @@ -241,7 +238,7 @@ public function getSoftDescriptorCity() * Payment options requested for this purchase unit * * @param \PayPal\Api\PaymentOptions $payment_options - * + * * @return $this */ public function setPaymentOptions($payment_options) @@ -261,10 +258,10 @@ public function getPaymentOptions() } /** - * Items and related shipping address within a transaction. + * List of items being paid for. * * @param \PayPal\Api\ItemList $item_list - * + * * @return $this */ public function setItemList($item_list) @@ -274,7 +271,7 @@ public function setItemList($item_list) } /** - * Items and related shipping address within a transaction. + * List of items being paid for. * * @return \PayPal\Api\ItemList */ @@ -333,7 +330,6 @@ public function getOrderUrl() /** * List of external funding being applied to the purchase unit. Each external_funding unit should have a unique reference_id - * * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding[] $external_funding * @@ -347,7 +343,6 @@ public function setExternalFunding($external_funding) /** * List of external funding being applied to the purchase unit. Each external_funding unit should have a unique reference_id - * * @deprecated Not publicly available * @return \PayPal\Api\ExternalFunding[] */ @@ -358,7 +353,6 @@ public function getExternalFunding() /** * Append ExternalFunding to the list. - * * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding $externalFunding * @return $this @@ -376,7 +370,6 @@ public function addExternalFunding($externalFunding) /** * Remove ExternalFunding from the list. - * * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding $externalFunding * @return $this diff --git a/lib/PayPal/Api/CountryCode.php b/lib/PayPal/Api/CountryCode.php index 18b45ace..48ef51db 100644 --- a/lib/PayPal/Api/CountryCode.php +++ b/lib/PayPal/Api/CountryCode.php @@ -7,7 +7,7 @@ /** * Class CountryCode * - * Representation of a country code. + * The ISO 3166-1 alpha-2 country code. A complete list of valid codes is available at Wikipedia: https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 In particular, note that the country code for Great Britain is GB, not UK as used in that country's top-level domain names. * * @package PayPal\Api * @@ -19,7 +19,7 @@ class CountryCode extends PayPalModel * ISO country code based on 2-character IS0-3166-1 codes. * * @param string $country_code - * + * * @return $this */ public function setCountryCode($country_code) diff --git a/lib/PayPal/Api/Credit.php b/lib/PayPal/Api/Credit.php index a37370d7..14fca8df 100644 --- a/lib/PayPal/Api/Credit.php +++ b/lib/PayPal/Api/Credit.php @@ -20,7 +20,7 @@ class Credit extends PayPalModel * Unique identifier of credit resource. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -44,7 +44,7 @@ public function getId() * Valid Values: ["BILL_ME_LATER", "PAYPAL_EXTRAS_MASTERCARD", "EBAY_MASTERCARD", "PAYPAL_SMART_CONNECT"] * * @param string $type - * + * * @return $this */ public function setType($type) diff --git a/lib/PayPal/Api/CreditCard.php b/lib/PayPal/Api/CreditCard.php index 74e73fe4..ad00bb0b 100644 --- a/lib/PayPal/Api/CreditCard.php +++ b/lib/PayPal/Api/CreditCard.php @@ -331,7 +331,7 @@ public function getExternalCardId() } /** - * State of the funding instrument. + * State of the credit card funding instrument. * Valid Values: ["expired", "ok"] * * @param string $state diff --git a/lib/PayPal/Api/CreditCardToken.php b/lib/PayPal/Api/CreditCardToken.php index b43e1961..301e9ddf 100644 --- a/lib/PayPal/Api/CreditCardToken.php +++ b/lib/PayPal/Api/CreditCardToken.php @@ -15,8 +15,8 @@ * @property string payer_id * @property string last4 * @property string type - * @property int expire_month - * @property int expire_year + * @property int expire_month + * @property int expire_year */ class CreditCardToken extends PayPalModel { @@ -24,7 +24,7 @@ class CreditCardToken extends PayPalModel * ID of credit card previously stored using `/vault/credit-card`. * * @param string $credit_card_id - * + * * @return $this */ public function setCreditCardId($credit_card_id) @@ -47,7 +47,7 @@ public function getCreditCardId() * A unique identifier that you can assign and track when storing a credit card or using a stored credit card. This ID can help to avoid unintentional use or misuse of credit cards. This ID can be any value you would like to associate with the saved card, such as a UUID, username, or email address. **Required when using a stored credit card if a payer_id was originally provided when storing the credit card in vault.** * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -70,7 +70,7 @@ public function getPayerId() * Last four digits of the stored credit card number. * * @param string $last4 - * + * * @return $this */ public function setLast4($last4) @@ -93,7 +93,7 @@ public function getLast4() * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex`. Values are presented in lowercase and not should not be used for display. * * @param string $type - * + * * @return $this */ public function setType($type) @@ -116,7 +116,7 @@ public function getType() * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @param int $expire_month - * + * * @return $this */ public function setExpireMonth($expire_month) @@ -139,7 +139,7 @@ public function getExpireMonth() * 4-digit expiration year. * * @param int $expire_year - * + * * @return $this */ public function setExpireYear($expire_year) diff --git a/lib/PayPal/Api/Currency.php b/lib/PayPal/Api/Currency.php index d50fc666..eb53eb9b 100644 --- a/lib/PayPal/Api/Currency.php +++ b/lib/PayPal/Api/Currency.php @@ -19,7 +19,7 @@ class Currency extends PayPalModel { /** - * 3 letter currency code + * 3 letter currency code as defined by ISO 4217. * * @param string $currency * @@ -32,7 +32,7 @@ public function setCurrency($currency) } /** - * 3 letter currency code + * 3 letter currency code as defined by ISO 4217. * * @return string */ @@ -42,7 +42,7 @@ public function getCurrency() } /** - * amount upto 2 decimals represented as string + * amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code. * * @param string|double $value * @@ -57,7 +57,7 @@ public function setValue($value) } /** - * amount upto 2 decimals represented as string + * amount up to N digit after the decimals separator as defined in ISO 4217 for the appropriate currency code. * * @return string */ diff --git a/lib/PayPal/Api/CurrencyConversion.php b/lib/PayPal/Api/CurrencyConversion.php index 3811277d..53479862 100644 --- a/lib/PayPal/Api/CurrencyConversion.php +++ b/lib/PayPal/Api/CurrencyConversion.php @@ -12,13 +12,13 @@ * * @package PayPal\Api * - * @property string conversion_date - * @property string from_currency - * @property string from_amount - * @property string to_currency - * @property string to_amount - * @property string conversion_type - * @property bool conversion_type_changeable + * @property string conversion_date + * @property string from_currency + * @property string from_amount + * @property string to_currency + * @property string to_amount + * @property string conversion_type + * @property bool conversion_type_changeable * @property \PayPal\Api\Links[] links */ class CurrencyConversion extends PayPalModel @@ -27,7 +27,7 @@ class CurrencyConversion extends PayPalModel * Date of validity for the conversion rate. * * @param string $conversion_date - * + * * @return $this */ public function setConversionDate($conversion_date) @@ -50,7 +50,7 @@ public function getConversionDate() * 3 letter currency code * * @param string $from_currency - * + * * @return $this */ public function setFromCurrency($from_currency) @@ -70,10 +70,10 @@ public function getFromCurrency() } /** - * Amount participating in currency conversion, set to 1 as default + * Amount participating in currency conversion, set to 1 as default * * @param string $from_amount - * + * * @return $this */ public function setFromAmount($from_amount) @@ -83,7 +83,7 @@ public function setFromAmount($from_amount) } /** - * Amount participating in currency conversion, set to 1 as default + * Amount participating in currency conversion, set to 1 as default * * @return string */ @@ -96,7 +96,7 @@ public function getFromAmount() * 3 letter currency code * * @param string $to_currency - * + * * @return $this */ public function setToCurrency($to_currency) @@ -119,7 +119,7 @@ public function getToCurrency() * Amount resulting from currency conversion. * * @param string $to_amount - * + * * @return $this */ public function setToAmount($to_amount) @@ -143,7 +143,7 @@ public function getToAmount() * Valid Values: ["PAYPAL", "VENDOR"] * * @param string $conversion_type - * + * * @return $this */ public function setConversionType($conversion_type) @@ -166,7 +166,7 @@ public function getConversionType() * Allow Payer to change conversion type. * * @param bool $conversion_type_changeable - * + * * @return $this */ public function setConversionTypeChangeable($conversion_type_changeable) @@ -188,7 +188,6 @@ public function getConversionTypeChangeable() /** * Base URL to web applications endpoint * Valid Values: ["https://www.paypal.com/{country_code}/webapps/xocspartaweb/webflow/sparta/proxwebflow", "https://www.paypal.com/{country_code}/proxflow"] - * * @deprecated Not publicly available * @param string $web_url * @throws \InvalidArgumentException @@ -203,7 +202,6 @@ public function setWebUrl($web_url) /** * Base URL to web applications endpoint - * * @deprecated Not publicly available * @return string */ @@ -216,7 +214,7 @@ public function getWebUrl() * Sets Links * * @param \PayPal\Api\Links[] $links - * + * * @return $this */ public function setLinks($links) diff --git a/lib/PayPal/Api/DetailedRefund.php b/lib/PayPal/Api/DetailedRefund.php new file mode 100644 index 00000000..e010a1db --- /dev/null +++ b/lib/PayPal/Api/DetailedRefund.php @@ -0,0 +1,160 @@ +custom = $custom; + return $this; + } + + /** + * free-form field for the use of clients + * + * @return string + */ + public function getCustom() + { + return $this->custom; + } + + /** + * Amount refunded to payer of the original transaction, in the current Refund call + * + * @param \PayPal\Api\Currency $refund_to_payer + * + * @return $this + */ + public function setRefundToPayer($refund_to_payer) + { + $this->refund_to_payer = $refund_to_payer; + return $this; + } + + /** + * Amount refunded to payer of the original transaction, in the current Refund call + * + * @return \PayPal\Api\Currency + */ + public function getRefundToPayer() + { + return $this->refund_to_payer; + } + + /** + * List of external funding that were refunded by the Refund call. Each external_funding unit should have a unique reference_id + * + * @param \PayPal\Api\ExternalFunding[] $refund_to_external_funding + * + * @return $this + */ + public function setRefundToExternalFunding($refund_to_external_funding) + { + $this->refund_to_external_funding = $refund_to_external_funding; + return $this; + } + + /** + * List of external funding that were refunded by the Refund call. Each external_funding unit should have a unique reference_id + * + * @return \PayPal\Api\ExternalFunding[] + */ + public function getRefundToExternalFunding() + { + return $this->refund_to_external_funding; + } + + /** + * Transaction fee refunded to original recipient of payment. + * + * @param \PayPal\Api\Currency $refund_from_transaction_fee + * + * @return $this + */ + public function setRefundFromTransactionFee($refund_from_transaction_fee) + { + $this->refund_from_transaction_fee = $refund_from_transaction_fee; + return $this; + } + + /** + * Transaction fee refunded to original recipient of payment. + * + * @return \PayPal\Api\Currency + */ + public function getRefundFromTransactionFee() + { + return $this->refund_from_transaction_fee; + } + + /** + * Amount subtracted from PayPal balance of the original recipient of payment, to make this refund. + * + * @param \PayPal\Api\Currency $refund_from_received_amount + * + * @return $this + */ + public function setRefundFromReceivedAmount($refund_from_received_amount) + { + $this->refund_from_received_amount = $refund_from_received_amount; + return $this; + } + + /** + * Amount subtracted from PayPal balance of the original recipient of payment, to make this refund. + * + * @return \PayPal\Api\Currency + */ + public function getRefundFromReceivedAmount() + { + return $this->refund_from_received_amount; + } + + /** + * Total amount refunded so far from the original purchase. Say, for example, a buyer makes $100 purchase, the buyer was refunded $20 a week ago and is refunded $30 in this transaction. The gross refund amount is $30 (in this transaction). The total refunded amount is $50. + * + * @param \PayPal\Api\Currency $total_refunded_amount + * + * @return $this + */ + public function setTotalRefundedAmount($total_refunded_amount) + { + $this->total_refunded_amount = $total_refunded_amount; + return $this; + } + + /** + * Total amount refunded so far from the original purchase. Say, for example, a buyer makes $100 purchase, the buyer was refunded $20 a week ago and is refunded $30 in this transaction. The gross refund amount is $30 (in this transaction). The total refunded amount is $50. + * + * @return \PayPal\Api\Currency + */ + public function getTotalRefundedAmount() + { + return $this->total_refunded_amount; + } + +} diff --git a/lib/PayPal/Api/Details.php b/lib/PayPal/Api/Details.php index a1964162..53212b7c 100644 --- a/lib/PayPal/Api/Details.php +++ b/lib/PayPal/Api/Details.php @@ -28,7 +28,7 @@ class Details extends PayPalModel * Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places. * * @param string|double $subtotal - * + * * @return $this */ public function setSubtotal($subtotal) @@ -53,7 +53,7 @@ public function getSubtotal() * Amount charged for shipping. 10 characters max with support for 2 decimal places. * * @param string|double $shipping - * + * * @return $this */ public function setShipping($shipping) @@ -78,7 +78,7 @@ public function getShipping() * Amount charged for tax. 10 characters max with support for 2 decimal places. * * @param string|double $tax - * + * * @return $this */ public function setTax($tax) @@ -103,7 +103,7 @@ public function getTax() * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $handling_fee - * + * * @return $this */ public function setHandlingFee($handling_fee) @@ -128,7 +128,7 @@ public function getHandlingFee() * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $shipping_discount - * + * * @return $this */ public function setShippingDiscount($shipping_discount) @@ -153,7 +153,7 @@ public function getShippingDiscount() * Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $insurance - * + * * @return $this */ public function setInsurance($insurance) @@ -178,7 +178,7 @@ public function getInsurance() * Amount being charged as gift wrap fee. * * @param string|double $gift_wrap - * + * * @return $this */ public function setGiftWrap($gift_wrap) @@ -203,7 +203,7 @@ public function getGiftWrap() * Fee charged by PayPal. In case of a refund, this is the fee amount refunded to the original receipient of the payment. * * @param string|double $fee - * + * * @return $this */ public function setFee($fee) diff --git a/lib/PayPal/Api/Error.php b/lib/PayPal/Api/Error.php index f6ef8e19..574dddce 100644 --- a/lib/PayPal/Api/Error.php +++ b/lib/PayPal/Api/Error.php @@ -24,7 +24,7 @@ class Error extends PayPalModel * Human readable, unique name of the error. * * @param string $name - * + * * @return $this */ public function setName($name) @@ -97,7 +97,7 @@ public function getCode() * PayPal internal identifier used for correlation purposes. * * @param string $debug_id - * + * * @return $this */ public function setDebugId($debug_id) @@ -120,7 +120,7 @@ public function getDebugId() * Message describing the error. * * @param string $message - * + * * @return $this */ public function setMessage($message) @@ -143,7 +143,7 @@ public function getMessage() * URI for detailed information related to this error for the developer. * * @param string $information_link - * + * * @return $this */ public function setInformationLink($information_link) @@ -166,7 +166,7 @@ public function getInformationLink() * Additional details of the error * * @param \PayPal\Api\ErrorDetails[] $details - * + * * @return $this */ public function setDetails($details) diff --git a/lib/PayPal/Api/ErrorDetails.php b/lib/PayPal/Api/ErrorDetails.php index 38ed5d11..d120b0a1 100644 --- a/lib/PayPal/Api/ErrorDetails.php +++ b/lib/PayPal/Api/ErrorDetails.php @@ -64,10 +64,9 @@ public function getIssue() /** * Reference ID of the purchase_unit associated with this error - * * @deprecated Not publicly available * @param string $purchase_unit_reference_id - * + * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) @@ -78,7 +77,6 @@ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) /** * Reference ID of the purchase_unit associated with this error - * * @deprecated Not publicly available * @return string */ @@ -89,10 +87,9 @@ public function getPurchaseUnitReferenceId() /** * PayPal internal error code. - * * @deprecated Not publicly available * @param string $code - * + * * @return $this */ public function setCode($code) @@ -103,7 +100,6 @@ public function setCode($code) /** * PayPal internal error code. - * * @deprecated Not publicly available * @return string */ diff --git a/lib/PayPal/Api/ExtendedBankAccount.php b/lib/PayPal/Api/ExtendedBankAccount.php index ce771b24..3206c9db 100644 --- a/lib/PayPal/Api/ExtendedBankAccount.php +++ b/lib/PayPal/Api/ExtendedBankAccount.php @@ -14,10 +14,9 @@ class ExtendedBankAccount extends BankAccount { /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). - * * @deprecated Not publicly available * @param string $mandate_reference_number - * + * * @return $this */ public function setMandateReferenceNumber($mandate_reference_number) @@ -28,7 +27,6 @@ public function setMandateReferenceNumber($mandate_reference_number) /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). - * * @deprecated Not publicly available * @return string */ diff --git a/lib/PayPal/Api/ExternalFunding.php b/lib/PayPal/Api/ExternalFunding.php index 67eb2b9c..e03335bc 100644 --- a/lib/PayPal/Api/ExternalFunding.php +++ b/lib/PayPal/Api/ExternalFunding.php @@ -16,6 +16,7 @@ * @property string funding_account_id * @property string display_text * @property \PayPal\Api\Amount amount + * @property string funding_instruction */ class ExternalFunding extends PayPalModel { @@ -134,4 +135,27 @@ public function getAmount() return $this->amount; } + /** + * Indicates that the Payment should be fully funded by External Funded Incentive + * Valid Values: ["FULLY_FUNDED"] + * + * @param string $funding_instruction + * + * @return $this + */ + public function setFundingInstruction($funding_instruction) + { + $this->funding_instruction = $funding_instruction; + return $this; + } + + /** + * Indicates that the Payment should be fully funded by External Funded Incentive + * + * @return string + */ + public function getFundingInstruction() + { + return $this->funding_instruction; + } } diff --git a/lib/PayPal/Api/FmfDetails.php b/lib/PayPal/Api/FmfDetails.php index 0d58cef2..c5681c8a 100644 --- a/lib/PayPal/Api/FmfDetails.php +++ b/lib/PayPal/Api/FmfDetails.php @@ -23,7 +23,7 @@ class FmfDetails extends PayPalModel * Valid Values: ["ACCEPT", "PENDING", "DENY", "REPORT"] * * @param string $filter_type - * + * * @return $this */ public function setFilterType($filter_type) @@ -47,7 +47,7 @@ public function getFilterType() * Valid Values: ["AVS_NO_MATCH", "AVS_PARTIAL_MATCH", "AVS_UNAVAILABLE_OR_UNSUPPORTED", "CARD_SECURITY_CODE_MISMATCH", "MAXIMUM_TRANSACTION_AMOUNT", "UNCONFIRMED_ADDRESS", "COUNTRY_MONITOR", "LARGE_ORDER_NUMBER", "BILLING_OR_SHIPPING_ADDRESS_MISMATCH", "RISKY_ZIP_CODE", "SUSPECTED_FREIGHT_FORWARDER_CHECK", "TOTAL_PURCHASE_PRICE_MINIMUM", "IP_ADDRESS_VELOCITY", "RISKY_EMAIL_ADDRESS_DOMAIN_CHECK", "RISKY_BANK_IDENTIFICATION_NUMBER_CHECK", "RISKY_IP_ADDRESS_RANGE", "PAYPAL_FRAUD_MODEL"] * * @param string $filter_id - * + * * @return $this */ public function setFilterId($filter_id) @@ -70,7 +70,7 @@ public function getFilterId() * Name of the filter * * @param string $name - * + * * @return $this */ public function setName($name) @@ -93,7 +93,7 @@ public function getName() * Description of the filter. * * @param string $description - * + * * @return $this */ public function setDescription($description) diff --git a/lib/PayPal/Api/FundingDetail.php b/lib/PayPal/Api/FundingDetail.php index 00bad314..66cc1f34 100644 --- a/lib/PayPal/Api/FundingDetail.php +++ b/lib/PayPal/Api/FundingDetail.php @@ -22,7 +22,7 @@ class FundingDetail extends PayPalModel * Expected clearing time * * @param string $clearing_time - * + * * @return $this */ public function setClearingTime($clearing_time) @@ -45,7 +45,7 @@ public function getClearingTime() * [DEPRECATED] Hold-off duration of the payment. payment_debit_date should be used instead. * * @param string $payment_hold_date - * + * * @return $this */ public function setPaymentHoldDate($payment_hold_date) @@ -68,7 +68,7 @@ public function getPaymentHoldDate() * Date when funds will be debited from the payer's account * * @param string $payment_debit_date - * + * * @return $this */ public function setPaymentDebitDate($payment_debit_date) @@ -89,10 +89,10 @@ public function getPaymentDebitDate() /** * Processing type of the payment card - * Valid Values: ["PINLESS_DEBIT"] + * Valid Values: ["CUP_SECURE", "PINLESS_DEBIT"] * * @param string $processing_type - * + * * @return $this */ public function setProcessingType($processing_type) diff --git a/lib/PayPal/Api/FundingInstrument.php b/lib/PayPal/Api/FundingInstrument.php index 8fbe0ac5..da311f41 100644 --- a/lib/PayPal/Api/FundingInstrument.php +++ b/lib/PayPal/Api/FundingInstrument.php @@ -11,9 +11,9 @@ * * @package PayPal\Api * - * @property \PayPal\Api\CreditCard credit_card + * @property \PayPal\Api\CreditCard credit_card * @property \PayPal\Api\CreditCardToken credit_card_token - * @property \PayPal\Api\Billing billing + * @property \PayPal\Api\Billing billing */ class FundingInstrument extends PayPalModel { @@ -34,7 +34,6 @@ public function setCreditCard($credit_card) * Credit Card instrument. * * @return \PayPal\Api\CreditCard - * */ public function getCreditCard() { @@ -89,7 +88,6 @@ public function getPaymentCard() /** * Bank Account information. - * * @deprecated Not publicly available * @param \PayPal\Api\ExtendedBankAccount $bank_account * @@ -103,7 +101,6 @@ public function setBankAccount($bank_account) /** * Bank Account information. - * * @deprecated Not publicly available * @return \PayPal\Api\ExtendedBankAccount */ @@ -114,7 +111,6 @@ public function getBankAccount() /** * Vaulted bank account instrument. - * * @deprecated Not publicly available * @param \PayPal\Api\BankToken $bank_account_token * @@ -128,7 +124,6 @@ public function setBankAccountToken($bank_account_token) /** * Vaulted bank account instrument. - * * @deprecated Not publicly available * @return \PayPal\Api\BankToken */ @@ -139,7 +134,6 @@ public function getBankAccountToken() /** * PayPal credit funding instrument. - * * @deprecated Not publicly available * @param \PayPal\Api\Credit $credit * @@ -153,7 +147,6 @@ public function setCredit($credit) /** * PayPal credit funding instrument. - * * @deprecated Not publicly available * @return \PayPal\Api\Credit */ @@ -164,7 +157,6 @@ public function getCredit() /** * Incentive funding instrument. - * * @deprecated Not publicly available * @param \PayPal\Api\Incentive $incentive * @@ -178,7 +170,6 @@ public function setIncentive($incentive) /** * Incentive funding instrument. - * * @deprecated Not publicly available * @return \PayPal\Api\Incentive */ @@ -189,7 +180,6 @@ public function getIncentive() /** * External funding instrument. - * * @deprecated Not publicly available * @param \PayPal\Api\ExternalFunding $external_funding * @@ -203,7 +193,6 @@ public function setExternalFunding($external_funding) /** * External funding instrument. - * * @deprecated Not publicly available * @return \PayPal\Api\ExternalFunding */ @@ -214,7 +203,6 @@ public function getExternalFunding() /** * Carrier account token instrument. - * * @deprecated Not publicly available * @param \PayPal\Api\CarrierAccountToken $carrier_account_token * @@ -228,7 +216,6 @@ public function setCarrierAccountToken($carrier_account_token) /** * Carrier account token instrument. - * * @deprecated Not publicly available * @return \PayPal\Api\CarrierAccountToken */ @@ -239,7 +226,6 @@ public function getCarrierAccountToken() /** * Carrier account instrument - * * @deprecated Not publicly available * @param \PayPal\Api\CarrierAccount $carrier_account * @@ -253,7 +239,6 @@ public function setCarrierAccount($carrier_account) /** * Carrier account instrument - * * @deprecated Not publicly available * @return \PayPal\Api\CarrierAccount */ @@ -264,7 +249,6 @@ public function getCarrierAccount() /** * Private Label Card funding instrument. These are store cards provided by merchants to drive business with value to customer with convenience and rewards. - * * @deprecated Not publicly available * @param \PayPal\Api\PrivateLabelCard $private_label_card * @@ -278,7 +262,6 @@ public function setPrivateLabelCard($private_label_card) /** * Private Label Card funding instrument. These are store cards provided by merchants to drive business with value to customer with convenience and rewards. - * * @deprecated Not publicly available * @return \PayPal\Api\PrivateLabelCard */ diff --git a/lib/PayPal/Api/FundingSource.php b/lib/PayPal/Api/FundingSource.php index 5b39be60..95f17992 100644 --- a/lib/PayPal/Api/FundingSource.php +++ b/lib/PayPal/Api/FundingSource.php @@ -11,25 +11,24 @@ * * @package PayPal\Api * - * @property string funding_mode - * @property string funding_instrument_type - * @property string soft_descriptor - * @property \PayPal\Api\Currency amount - * @property \PayPal\Api\Currency negative_balance_amount - * @property string legal_text - * @property \PayPal\Api\FundingDetail funding_detail - * @property string additional_text - * @property \PayPal\Api\FundingInstrument extends - * @property \PayPal\Api\Links[] links + * @property string funding_mode + * @property string funding_instrument_type + * @property string soft_descriptor + * @property \PayPal\Api\Currency amount + * @property \PayPal\Api\Currency negative_balance_amount + * @property string legal_text + * @property \PayPal\Api\FundingDetail funding_detail + * @property string additional_text + * @property \PayPal\Api\Links[] links */ -class FundingSource extends PayPalModel +class FundingSource extends FundingInstrument { /** * specifies funding mode of the instrument - * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] + * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK", "PAY_UPON_INVOICE"] * * @param string $funding_mode - * + * * @return $this */ public function setFundingMode($funding_mode) @@ -50,10 +49,10 @@ public function getFundingMode() /** * Instrument type for this funding source - * Valid Values: ["BALANCE", "PAYMENT_CARD", "BANK_ACCOUNT", "CREDIT", "INCENTIVE"] + * Valid Values: ["BALANCE", "PAYMENT_CARD", "BANK_ACCOUNT", "CREDIT", "INCENTIVE", "EXTERNAL_FUNDING", "TAB"] * * @param string $funding_instrument_type - * + * * @return $this */ public function setFundingInstrumentType($funding_instrument_type) @@ -76,7 +75,7 @@ public function getFundingInstrumentType() * Soft descriptor used when charging this funding source. * * @param string $soft_descriptor - * + * * @return $this */ public function setSoftDescriptor($soft_descriptor) @@ -99,7 +98,7 @@ public function getSoftDescriptor() * Total anticipated amount of money to be pulled from instrument. * * @param \PayPal\Api\Currency $amount - * + * * @return $this */ public function setAmount($amount) @@ -119,33 +118,33 @@ public function getAmount() } /** - * Additional amount to be pulled from the instrument to recover a negative balance on the buyer - * - * @param \PayPal\Api\Currency $amount + * Additional amount to be pulled from the instrument to recover a negative balance on the buyer's account that is owed to PayPal. * + * @param \PayPal\Api\Currency $negative_balance_amount + * * @return $this */ - public function setNegativeBalanceAmount($amount) + public function setNegativeBalanceAmount($negative_balance_amount) { - $this->amount = $amount; + $this->negative_balance_amount = $negative_balance_amount; return $this; } /** - * Additional amount to be pulled from the instrument to recover a negative balance on the buyer + * Additional amount to be pulled from the instrument to recover a negative balance on the buyer's account that is owed to PayPal. * * @return \PayPal\Api\Currency */ public function getNegativeBalanceAmount() { - return $this->amount; + return $this->negative_balance_amount; } /** * Localized legal text relevant to funding source. * * @param string $legal_text - * + * * @return $this */ public function setLegalText($legal_text) @@ -168,7 +167,7 @@ public function getLegalText() * Additional detail of the funding. * * @param \PayPal\Api\FundingDetail $funding_detail - * + * * @return $this */ public function setFundingDetail($funding_detail) @@ -191,7 +190,7 @@ public function getFundingDetail() * Additional text relevant to funding source. * * @param string $additional_text - * + * * @return $this */ public function setAdditionalText($additional_text) @@ -215,6 +214,8 @@ public function getAdditionalText() * * @param \PayPal\Api\FundingInstrument $extends * + * @deprecated Unused + * * @return $this */ public function setExtends($extends) @@ -226,6 +227,8 @@ public function setExtends($extends) /** * Gets Extends * + * @deprecated Unused + * * @return \PayPal\Api\FundingInstrument */ public function getExtends() @@ -237,7 +240,7 @@ public function getExtends() * Sets Links * * @param \PayPal\Api\Links[] $links - * + * * @return $this */ public function setLinks($links) diff --git a/lib/PayPal/Api/Incentive.php b/lib/PayPal/Api/Incentive.php index 017a34df..7493a658 100644 --- a/lib/PayPal/Api/Incentive.php +++ b/lib/PayPal/Api/Incentive.php @@ -12,15 +12,15 @@ * * @package PayPal\Api * - * @property string id - * @property string code - * @property string name - * @property string description + * @property string id + * @property string code + * @property string name + * @property string description * @property \PayPal\Api\Currency minimum_purchase_amount - * @property string logo_image_url - * @property string expiry_date - * @property string type - * @property string terms + * @property string logo_image_url + * @property string expiry_date + * @property string type + * @property string terms */ class Incentive extends PayPalModel { @@ -28,7 +28,7 @@ class Incentive extends PayPalModel * Identifier of the instrument in PayPal Wallet * * @param string $id - * + * * @return $this */ public function setId($id) @@ -51,7 +51,7 @@ public function getId() * Code that identifies the incentive. * * @param string $code - * + * * @return $this */ public function setCode($code) @@ -74,7 +74,7 @@ public function getCode() * Name of the incentive. * * @param string $name - * + * * @return $this */ public function setName($name) @@ -97,7 +97,7 @@ public function getName() * Description of the incentive. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -120,7 +120,7 @@ public function getDescription() * Indicates incentive is applicable for this minimum purchase amount. * * @param \PayPal\Api\Currency $minimum_purchase_amount - * + * * @return $this */ public function setMinimumPurchaseAmount($minimum_purchase_amount) @@ -167,7 +167,7 @@ public function getLogoImageUrl() * expiry date of the incentive. * * @param string $expiry_date - * + * * @return $this */ public function setExpiryDate($expiry_date) @@ -191,7 +191,7 @@ public function getExpiryDate() * Valid Values: ["COUPON", "GIFT_CARD", "MERCHANT_SPECIFIC_BALANCE", "VOUCHER"] * * @param string $type - * + * * @return $this */ public function setType($type) @@ -214,7 +214,7 @@ public function getType() * URI to the associated terms * * @param string $terms - * + * * @return $this */ public function setTerms($terms) diff --git a/lib/PayPal/Api/InstallmentOption.php b/lib/PayPal/Api/InstallmentOption.php index 43342b7b..58e1b924 100644 --- a/lib/PayPal/Api/InstallmentOption.php +++ b/lib/PayPal/Api/InstallmentOption.php @@ -11,9 +11,9 @@ * * @package PayPal\Api * - * @property int term - * @property \PayPal\Api\Currency monthly_payment - * @property \PayPal\Api\Currency discount_amount + * @property int term + * @property \PayPal\Api\Currency monthly_payment + * @property \PayPal\Api\Currency discount_amount * @property string discount_percentage */ class InstallmentOption extends PayPalModel @@ -22,7 +22,7 @@ class InstallmentOption extends PayPalModel * Number of installments * * @param int $term - * + * * @return $this */ public function setTerm($term) @@ -45,7 +45,7 @@ public function getTerm() * Monthly payment * * @param \PayPal\Api\Currency $monthly_payment - * + * * @return $this */ public function setMonthlyPayment($monthly_payment) @@ -68,7 +68,7 @@ public function getMonthlyPayment() * Discount amount applied to the payment, if any * * @param \PayPal\Api\Currency $discount_amount - * + * * @return $this */ public function setDiscountAmount($discount_amount) @@ -91,7 +91,7 @@ public function getDiscountAmount() * Discount percentage applied to the payment, if any * * @param string $discount_percentage - * + * * @return $this */ public function setDiscountPercentage($discount_percentage) diff --git a/lib/PayPal/Api/Item.php b/lib/PayPal/Api/Item.php index 4c647ab9..75056ba0 100644 --- a/lib/PayPal/Api/Item.php +++ b/lib/PayPal/Api/Item.php @@ -22,7 +22,6 @@ * @property string currency * @property string tax * @property string url - * @property string category */ class Item extends PayPalModel { @@ -30,7 +29,7 @@ class Item extends PayPalModel * Stock keeping unit corresponding (SKU) to item. * * @param string $sku - * + * * @return $this */ public function setSku($sku) @@ -53,7 +52,7 @@ public function getSku() * Item name. 127 characters max. * * @param string $name - * + * * @return $this */ public function setName($name) @@ -76,7 +75,7 @@ public function getName() * Description of the item. Only supported when the `payment_method` is set to `paypal`. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -99,7 +98,7 @@ public function getDescription() * Number of a particular item. 10 characters max. * * @param string $quantity - * + * * @return $this */ public function setQuantity($quantity) @@ -122,7 +121,7 @@ public function getQuantity() * Item cost. 10 characters max. * * @param string|double $price - * + * * @return $this */ public function setPrice($price) @@ -147,7 +146,7 @@ public function getPrice() * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). * * @param string $currency - * + * * @return $this */ public function setCurrency($currency) @@ -170,7 +169,7 @@ public function getCurrency() * Tax of the item. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $tax - * + * * @return $this */ public function setTax($tax) @@ -218,9 +217,9 @@ public function getUrl() /** * Category type of the item. * Valid Values: ["DIGITAL", "PHYSICAL"] - * + * @deprecated Not publicly available * @param string $category - * + * * @return $this */ public function setCategory($category) @@ -231,7 +230,7 @@ public function setCategory($category) /** * Category type of the item. - * + * @deprecated Not publicly available * @return string */ public function getCategory() @@ -241,10 +240,9 @@ public function getCategory() /** * Weight of the item. - * * @deprecated Not publicly available * @param \PayPal\Api\Measurement $weight - * + * * @return $this */ public function setWeight($weight) @@ -255,7 +253,6 @@ public function setWeight($weight) /** * Weight of the item. - * * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ @@ -266,10 +263,9 @@ public function getWeight() /** * Length of the item. - * * @deprecated Not publicly available * @param \PayPal\Api\Measurement $length - * + * * @return $this */ public function setLength($length) @@ -280,7 +276,6 @@ public function setLength($length) /** * Length of the item. - * * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ @@ -291,10 +286,9 @@ public function getLength() /** * Height of the item. - * * @deprecated Not publicly available * @param \PayPal\Api\Measurement $height - * + * * @return $this */ public function setHeight($height) @@ -305,7 +299,6 @@ public function setHeight($height) /** * Height of the item. - * * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ @@ -316,10 +309,9 @@ public function getHeight() /** * Width of the item. - * * @deprecated Not publicly available * @param \PayPal\Api\Measurement $width - * + * * @return $this */ public function setWidth($width) @@ -330,7 +322,6 @@ public function setWidth($width) /** * Width of the item. - * * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ @@ -341,10 +332,9 @@ public function getWidth() /** * Set of optional data used for PayPal risk determination. - * * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair[] $supplementary_data - * + * * @return $this */ public function setSupplementaryData($supplementary_data) @@ -355,7 +345,6 @@ public function setSupplementaryData($supplementary_data) /** * Set of optional data used for PayPal risk determination. - * * @deprecated Not publicly available * @return \PayPal\Api\NameValuePair[] */ @@ -366,7 +355,6 @@ public function getSupplementaryData() /** * Append SupplementaryData to the list. - * * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this @@ -384,7 +372,6 @@ public function addSupplementaryData($nameValuePair) /** * Remove SupplementaryData from the list. - * * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this @@ -398,10 +385,9 @@ public function removeSupplementaryData($nameValuePair) /** * Set of optional data used for PayPal post-transaction notifications. - * * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair[] $postback_data - * + * * @return $this */ public function setPostbackData($postback_data) @@ -412,7 +398,6 @@ public function setPostbackData($postback_data) /** * Set of optional data used for PayPal post-transaction notifications. - * * @deprecated Not publicly available * @return \PayPal\Api\NameValuePair[] */ @@ -423,7 +408,6 @@ public function getPostbackData() /** * Append PostbackData to the list. - * * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this @@ -441,7 +425,6 @@ public function addPostbackData($nameValuePair) /** * Remove PostbackData from the list. - * * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this diff --git a/lib/PayPal/Api/ItemList.php b/lib/PayPal/Api/ItemList.php index 3b674add..262047ab 100644 --- a/lib/PayPal/Api/ItemList.php +++ b/lib/PayPal/Api/ItemList.php @@ -7,14 +7,14 @@ /** * Class ItemList * - * Items and related shipping address within a transaction. + * List of items being paid for. * * @package PayPal\Api * - * @property \PayPal\Api\Item[] items + * @property \PayPal\Api\Item[] items * @property \PayPal\Api\ShippingAddress shipping_address - * @property string shipping_method - * @property string shipping_phone_number + * @property string shipping_method + * @property string shipping_phone_number */ class ItemList extends PayPalModel { @@ -22,7 +22,7 @@ class ItemList extends PayPalModel * List of items. * * @param \PayPal\Api\Item[] $items - * + * * @return $this */ public function setItems($items) @@ -72,10 +72,10 @@ public function removeItem($item) } /** - * Shipping address, if different than the payer address. + * Shipping address. * * @param \PayPal\Api\ShippingAddress $shipping_address - * + * * @return $this */ public function setShippingAddress($shipping_address) @@ -85,7 +85,7 @@ public function setShippingAddress($shipping_address) } /** - * Shipping address, if different than the payer address. + * Shipping address. * * @return \PayPal\Api\ShippingAddress */ @@ -98,7 +98,7 @@ public function getShippingAddress() * Shipping method used for this payment like USPSParcel etc. * * @param string $shipping_method - * + * * @return $this */ public function setShippingMethod($shipping_method) @@ -121,7 +121,7 @@ public function getShippingMethod() * Allows merchant's to share payer’s contact number with PayPal for the current payment. Final contact number of payer associated with the transaction might be same as shipping_phone_number or different based on Payer’s action on PayPal. The phone number must be represented in its canonical international format, as defined by the E.164 numbering plan * * @param string $shipping_phone_number - * + * * @return $this */ public function setShippingPhoneNumber($shipping_phone_number) diff --git a/lib/PayPal/Api/Order.php b/lib/PayPal/Api/Order.php index f611ff7d..13312cc0 100644 --- a/lib/PayPal/Api/Order.php +++ b/lib/PayPal/Api/Order.php @@ -3,8 +3,8 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; -use PayPal\Rest\ApiContext; use PayPal\Validation\ArgumentValidator; +use PayPal\Rest\ApiContext; /** * Class Order @@ -13,20 +13,20 @@ * * @package PayPal\Api * - * @property string id - * @property string purchase_unit_reference_id - * @property \PayPal\Api\Amount amount - * @property string payment_mode - * @property string state - * @property string reason_code - * @property string pending_reason - * @property string protection_eligibility - * @property string protection_eligibility_type - * @property string parent_payment + * @property string id + * @property string reference_id + * @property \PayPal\Api\Amount amount + * @property string payment_mode + * @property string state + * @property string reason_code + * @property string pending_reason + * @property string protection_eligibility + * @property string protection_eligibility_type + * @property string parent_payment * @property \PayPal\Api\FmfDetails fmf_details - * @property string create_time - * @property string update_time - * @property \PayPal\Api\Links[] links + * @property string create_time + * @property string update_time + * @property \PayPal\Api\Links[] links */ class Order extends PayPalResourceModel { @@ -34,7 +34,7 @@ class Order extends PayPalResourceModel * Identifier of the order transaction. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -56,6 +56,8 @@ public function getId() /** * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. * + * @deprecated Use #setReferenceId instead + * * @param string $purchase_unit_reference_id * * @return $this @@ -68,6 +70,7 @@ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) /** * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. + * @deprecated Use #getReferenceId instead * * @return string */ @@ -76,11 +79,34 @@ public function getPurchaseUnitReferenceId() return $this->purchase_unit_reference_id; } + /** + * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. + * + * @param string $reference_id + * + * @return $this + */ + public function setReferenceId($reference_id) + { + $this->reference_id = $reference_id; + return $this; + } + + /** + * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. + * + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + /** * Amount being collected. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -104,7 +130,7 @@ public function getAmount() * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $payment_mode - * + * * @return $this */ public function setPaymentMode($payment_mode) @@ -125,10 +151,10 @@ public function getPaymentMode() /** * State of the order transaction. - * Valid Values: ["pending", "completed", "refunded", "partially_refunded", "voided"] + * Valid Values: ["pending", "completed", "voided", "authorized", "captured"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -148,11 +174,11 @@ public function getState() } /** - * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. + * Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["PAYER_SHIPPING_UNCONFIRMED", "MULTI_CURRENCY", "RISK_REVIEW", "REGULATORY_REVIEW", "VERIFICATION_REQUIRED", "ORDER", "OTHER"] * * @param string $reason_code - * + * * @return $this */ public function setReasonCode($reason_code) @@ -162,7 +188,7 @@ public function setReasonCode($reason_code) } /** - * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. + * Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -172,11 +198,11 @@ public function getReasonCode() } /** - * [DEPRECATED] Reason the transaction is in pending state. Use reason_code field above instead. + * [DEPRECATED] Reason code for the transaction state being Pending. Obsolete. Retained for backward compatability. Use reason_code field above instead. * Valid Values: ["payer_shipping_unconfirmed", "multi_currency", "risk_review", "regulatory_review", "verification_required", "order", "other"] * * @param string $pending_reason - * + * * @return $this */ public function setPendingReason($pending_reason) @@ -186,7 +212,7 @@ public function setPendingReason($pending_reason) } /** - * @deprecated [DEPRECATED] Reason the transaction is in pending state. Use reason_code field above instead. + * @deprecated [DEPRECATED] Reason code for the transaction state being Pending. Obsolete. Retained for backward compatability. Use reason_code field above instead. * * @return string */ @@ -200,7 +226,7 @@ public function getPendingReason() * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility - * + * * @return $this */ public function setProtectionEligibility($protection_eligibility) @@ -224,7 +250,7 @@ public function getProtectionEligibility() * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"] * * @param string $protection_eligibility_type - * + * * @return $this */ public function setProtectionEligibilityType($protection_eligibility_type) @@ -247,7 +273,7 @@ public function getProtectionEligibilityType() * ID of the Payment resource that this transaction is based on. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -270,7 +296,7 @@ public function getParentPayment() * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. * * @param \PayPal\Api\FmfDetails $fmf_details - * + * * @return $this */ public function setFmfDetails($fmf_details) @@ -293,7 +319,7 @@ public function getFmfDetails() * Time the resource was created in UTC ISO8601 format. * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -316,7 +342,7 @@ public function getCreateTime() * Time the resource was last updated in UTC ISO8601 format. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -336,11 +362,11 @@ public function getUpdateTime() } /** - * Retrieve details about an order by passing the order_id in the request URI. + * Shows details for an order, by ID. * - * @param string $orderId - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param string $orderId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Order */ public static function get($orderId, $apiContext = null, $restCall = null) @@ -361,11 +387,11 @@ public static function get($orderId, $apiContext = null, $restCall = null) } /** - * Capture a payment. In addition, include the amount of the payment and indicate whether this is a final capture for the given authorization in the body of the request JSON. + * Captures a payment for an order, by ID. To use this call, the original payment call must specify an intent of `order`. In the JSON request body, include the payment amount and indicate whether this capture is the final capture for the authorization. * - * @param Capture $capture - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param Capture $capture + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Capture */ public function capture($capture, $apiContext = null, $restCall = null) @@ -387,10 +413,10 @@ public function capture($capture, $apiContext = null, $restCall = null) } /** - * Void (cancel) an order by passing the order_id in the request URI. Note that an order cannot be voided if payment has already been partially or fully captured. + * Voids, or cancels, an order, by ID. You cannot void an order if a payment has already been partially or fully captured. * - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Order */ public function void($apiContext = null, $restCall = null) @@ -410,11 +436,11 @@ public function void($apiContext = null, $restCall = null) } /** - * Authorize an order by passing the order_id in the request URI. In addition, include an amount object in the body of the request JSON. + * Authorizes an order, by ID. Include an `amount` object in the JSON request body. * * @param Authorization $authorization Authorization Object with Amount value to be authorized - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Authorization */ public function authorize($authorization, $apiContext = null, $restCall = null) diff --git a/lib/PayPal/Api/Patch.php b/lib/PayPal/Api/Patch.php index bd9a1685..68a6fa85 100644 --- a/lib/PayPal/Api/Patch.php +++ b/lib/PayPal/Api/Patch.php @@ -7,7 +7,7 @@ /** * Class Patch * - * A JSON Patch object used for doing partial updates to resources. + * A JSON patch object that you can use to apply partial updates to resources. * * @package PayPal\Api * @@ -43,7 +43,7 @@ public function getOp() } /** - * string containing a JSON-Pointer value that references a location within the target document (the target location) where the operation is performed. + * A JSON pointer that references a location in the target document where the operation is performed. A `string` value. * * @param string $path * @@ -56,7 +56,7 @@ public function setPath($path) } /** - * string containing a JSON-Pointer value that references a location within the target document (the target location) where the operation is performed. + * A JSON pointer that references a location in the target document where the operation is performed. A `string` value. * * @return string */ @@ -68,7 +68,7 @@ public function getPath() /** * New value to apply based on the operation. * - * @param string $value + * @param mixed $value * * @return $this */ @@ -81,7 +81,7 @@ public function setValue($value) /** * New value to apply based on the operation. * - * @return string + * @return mixed */ public function getValue() { diff --git a/lib/PayPal/Api/PatchRequest.php b/lib/PayPal/Api/PatchRequest.php index effc1058..2f446868 100644 --- a/lib/PayPal/Api/PatchRequest.php +++ b/lib/PayPal/Api/PatchRequest.php @@ -7,7 +7,7 @@ /** * Class PatchRequest * - * Request object used for a JSON Patch. + * A JSON patch request. * * @package PayPal\Api * diff --git a/lib/PayPal/Api/Payee.php b/lib/PayPal/Api/Payee.php index c0fde8f7..22594b99 100644 --- a/lib/PayPal/Api/Payee.php +++ b/lib/PayPal/Api/Payee.php @@ -17,10 +17,10 @@ class Payee extends PayPalModel { /** - * Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements. + * Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements. * * @param string $email - * + * * @return $this */ public function setEmail($email) @@ -30,7 +30,7 @@ public function setEmail($email) } /** - * Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receiver PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements. + * Email Address associated with the Payee's PayPal Account. If the provided email address is not associated with any PayPal Account, the payee can only receive PayPal Wallet Payments. Direct Credit Card Payments will be denied due to card compliance requirements. * * @return string */ @@ -43,7 +43,7 @@ public function getEmail() * Encrypted PayPal account identifier for the Payee. * * @param string $merchant_id - * + * * @return $this */ public function setMerchantId($merchant_id) @@ -64,10 +64,9 @@ public function getMerchantId() /** * First Name of the Payee. - * * @deprecated Not publicly available * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -78,7 +77,6 @@ public function setFirstName($first_name) /** * First Name of the Payee. - * * @deprecated Not publicly available * @return string */ @@ -89,10 +87,9 @@ public function getFirstName() /** * Last Name of the Payee. - * * @deprecated Not publicly available * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -103,7 +100,6 @@ public function setLastName($last_name) /** * Last Name of the Payee. - * * @deprecated Not publicly available * @return string */ @@ -114,10 +110,9 @@ public function getLastName() /** * Unencrypted PayPal account Number of the Payee - * * @deprecated Not publicly available * @param string $account_number - * + * * @return $this */ public function setAccountNumber($account_number) @@ -128,7 +123,6 @@ public function setAccountNumber($account_number) /** * Unencrypted PayPal account Number of the Payee - * * @deprecated Not publicly available * @return string */ @@ -138,11 +132,10 @@ public function getAccountNumber() } /** - * Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet. - * + * Information related to the Payee. * @deprecated Not publicly available * @param \PayPal\Api\Phone $phone - * + * * @return $this */ public function setPhone($phone) @@ -152,8 +145,7 @@ public function setPhone($phone) } /** - * Information related to the Payer. In case of PayPal Wallet payment, this information will be filled in by PayPal after the user approves the payment using their PayPal Wallet. - * + * Information related to the Payee. * @deprecated Not publicly available * @return \PayPal\Api\Phone */ diff --git a/lib/PayPal/Api/Payer.php b/lib/PayPal/Api/Payer.php index 860d0950..6d9a37bf 100644 --- a/lib/PayPal/Api/Payer.php +++ b/lib/PayPal/Api/Payer.php @@ -11,11 +11,11 @@ * * @package PayPal\Api * - * @property string payment_method - * @property string status + * @property string payment_method + * @property string status * @property \PayPal\Api\FundingInstrument[] funding_instruments - * @property string funding_option_id - * @property \PayPal\Api\PayerInfo payer_info + * @property string external_selected_funding_instrument_type + * @property \PayPal\Api\PayerInfo payer_info */ class Payer extends PayPalModel { @@ -24,7 +24,7 @@ class Payer extends PayPalModel * Valid Values: ["credit_card", "bank", "paypal", "pay_upon_invoice", "carrier", "alternate_payment"] * * @param string $payment_method - * + * * @return $this */ public function setPaymentMethod($payment_method) @@ -48,7 +48,7 @@ public function getPaymentMethod() * Valid Values: ["VERIFIED", "UNVERIFIED"] * * @param string $status - * + * * @return $this */ public function setStatus($status) @@ -70,10 +70,9 @@ public function getStatus() /** * Type of account relationship payer has with PayPal. * Valid Values: ["BUSINESS", "PERSONAL", "PREMIER"] - * * @deprecated Not publicly available * @param string $account_type - * + * * @return $this */ public function setAccountType($account_type) @@ -84,7 +83,6 @@ public function setAccountType($account_type) /** * Type of account relationship payer has with PayPal. - * * @deprecated Not publicly available * @return string */ @@ -95,10 +93,9 @@ public function getAccountType() /** * Duration since the payer established account relationship with PayPal in days. - * * @deprecated Not publicly available * @param string $account_age - * + * * @return $this */ public function setAccountAge($account_age) @@ -109,7 +106,6 @@ public function setAccountAge($account_age) /** * Duration since the payer established account relationship with PayPal in days. - * * @deprecated Not publicly available * @return string */ @@ -122,7 +118,7 @@ public function getAccountAge() * List of funding instruments to fund the payment. 'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. * * @param \PayPal\Api\FundingInstrument[] $funding_instruments - * + * * @return $this */ public function setFundingInstruments($funding_instruments) @@ -173,9 +169,9 @@ public function removeFundingInstrument($fundingInstrument) /** * Id of user selected funding option for the payment.'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. - * + * @deprecated Not publicly available * @param string $funding_option_id - * + * * @return $this */ public function setFundingOptionId($funding_option_id) @@ -186,7 +182,7 @@ public function setFundingOptionId($funding_option_id) /** * Id of user selected funding option for the payment.'OneOf' funding_instruments,funding_option_id to be used to identify the specifics of payment method passed. - * + * @deprecated Not publicly available * @return string */ public function getFundingOptionId() @@ -195,11 +191,10 @@ public function getFundingOptionId() } /** - * Default funding option available for the payment - * + * Default funding option available for the payment * @deprecated Not publicly available * @param \PayPal\Api\FundingOption $funding_option - * + * * @return $this */ public function setFundingOption($funding_option) @@ -209,8 +204,7 @@ public function setFundingOption($funding_option) } /** - * Default funding option available for the payment - * + * Default funding option available for the payment * @deprecated Not publicly available * @return \PayPal\Api\FundingOption */ @@ -220,11 +214,34 @@ public function getFundingOption() } /** - * Funding option related to default funding option. + * Instrument type pre-selected by the user outside of PayPal and passed along the payment creation. This param is used in cases such as PayPal Credit Second Button + * Valid Values: ["CREDIT", "PAY_UPON_INVOICE"] * + * @param string $external_selected_funding_instrument_type + * + * @return $this + */ + public function setExternalSelectedFundingInstrumentType($external_selected_funding_instrument_type) + { + $this->external_selected_funding_instrument_type = $external_selected_funding_instrument_type; + return $this; + } + + /** + * Instrument type pre-selected by the user outside of PayPal and passed along the payment creation. This param is used in cases such as PayPal Credit Second Button + * + * @return string + */ + public function getExternalSelectedFundingInstrumentType() + { + return $this->external_selected_funding_instrument_type; + } + + /** + * Funding option related to default funding option. * @deprecated Not publicly available * @param \PayPal\Api\FundingOption $related_funding_option - * + * * @return $this */ public function setRelatedFundingOption($related_funding_option) @@ -235,7 +252,6 @@ public function setRelatedFundingOption($related_funding_option) /** * Funding option related to default funding option. - * * @deprecated Not publicly available * @return \PayPal\Api\FundingOption */ @@ -245,10 +261,10 @@ public function getRelatedFundingOption() } /** - * Information related to the Payer. + * Information related to the Payer. * * @param \PayPal\Api\PayerInfo $payer_info - * + * * @return $this */ public function setPayerInfo($payer_info) @@ -258,7 +274,7 @@ public function setPayerInfo($payer_info) } /** - * Information related to the Payer. + * Information related to the Payer. * * @return \PayPal\Api\PayerInfo */ diff --git a/lib/PayPal/Api/PayerInfo.php b/lib/PayPal/Api/PayerInfo.php index 39cbfda4..ae70c65a 100644 --- a/lib/PayPal/Api/PayerInfo.php +++ b/lib/PayPal/Api/PayerInfo.php @@ -11,22 +11,22 @@ * * @package PayPal\Api * - * @property string email - * @property string external_remember_me_id - * @property string salutation - * @property string first_name - * @property string middle_name - * @property string last_name - * @property string suffix - * @property string payer_id - * @property string phone - * @property string phone_type - * @property string birth_date - * @property string tax_id - * @property string tax_id_type - * @property string country_code - * @property \PayPal\Api\Address billing_address - * @property \PayPal\Api\ShippingAddress shipping_address + * @property string email + * @property string external_remember_me_id + * @property string buyer_account_number + * @property string salutation + * @property string first_name + * @property string middle_name + * @property string last_name + * @property string suffix + * @property string payer_id + * @property string phone + * @property string phone_type + * @property string birth_date + * @property string tax_id + * @property string tax_id_type + * @property string country_code + * @property \PayPal\Api\Address billing_address */ class PayerInfo extends PayPalModel { @@ -34,7 +34,7 @@ class PayerInfo extends PayPalModel * Email address representing the payer. 127 characters max. * * @param string $email - * + * * @return $this */ public function setEmail($email) @@ -57,7 +57,7 @@ public function getEmail() * External Remember Me id representing the payer * * @param string $external_remember_me_id - * + * * @return $this */ public function setExternalRememberMeId($external_remember_me_id) @@ -79,7 +79,7 @@ public function getExternalRememberMeId() /** * Account Number representing the Payer * - * @deprecated Not publicly available + * @deprecated Use #setBuyerAccountNumberInstead * @param string $account_number * * @return $this @@ -93,6 +93,8 @@ public function setAccountNumber($account_number) /** * Account Number representing the Payer * + * @deprecated Use #getBuyerAccountNumberInstead + * * @deprecated Not publicly available * @return string */ @@ -101,11 +103,34 @@ public function getAccountNumber() return $this->account_number; } + /** + * Account Number representing the Payer + * + * @param string $buyer_account_number + * + * @return $this + */ + public function setBuyerAccountNumber($buyer_account_number) + { + $this->buyer_account_number = $buyer_account_number; + return $this; + } + + /** + * Account Number representing the Payer + * + * @return string + */ + public function getBuyerAccountNumber() + { + return $this->buyer_account_number; + } + /** * Salutation of the payer. * * @param string $salutation - * + * * @return $this */ public function setSalutation($salutation) @@ -128,7 +153,7 @@ public function getSalutation() * First name of the payer. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -151,7 +176,7 @@ public function getFirstName() * Middle name of the payer. * * @param string $middle_name - * + * * @return $this */ public function setMiddleName($middle_name) @@ -174,7 +199,7 @@ public function getMiddleName() * Last name of the payer. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -197,7 +222,7 @@ public function getLastName() * Suffix of the payer. * * @param string $suffix - * + * * @return $this */ public function setSuffix($suffix) @@ -220,7 +245,7 @@ public function getSuffix() * PayPal assigned encrypted Payer ID. * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -243,7 +268,7 @@ public function getPayerId() * Phone number representing the payer. 20 characters max. * * @param string $phone - * + * * @return $this */ public function setPhone($phone) @@ -267,7 +292,7 @@ public function getPhone() * Valid Values: ["HOME", "WORK", "MOBILE", "OTHER"] * * @param string $phone_type - * + * * @return $this */ public function setPhoneType($phone_type) @@ -290,7 +315,7 @@ public function getPhoneType() * Birth date of the Payer in ISO8601 format (yyyy-mm-dd). * * @param string $birth_date - * + * * @return $this */ public function setBirthDate($birth_date) @@ -313,7 +338,7 @@ public function getBirthDate() * Payer’s tax ID. Only supported when the `payment_method` is set to `paypal`. * * @param string $tax_id - * + * * @return $this */ public function setTaxId($tax_id) @@ -337,7 +362,7 @@ public function getTaxId() * Valid Values: ["BR_CPF", "BR_CNPJ"] * * @param string $tax_id_type - * + * * @return $this */ public function setTaxIdType($tax_id_type) @@ -360,7 +385,7 @@ public function getTaxIdType() * Two-letter registered country code of the payer to identify the buyer country. * * @param string $country_code - * + * * @return $this */ public function setCountryCode($country_code) @@ -383,7 +408,7 @@ public function getCountryCode() * Billing address of the Payer. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -403,10 +428,10 @@ public function getBillingAddress() } /** - * Shipping address of payer PayPal account. + * @deprecated [DEPRECATED] Use shipping address present in purchase unit or at root level of checkout Session. * * @param \PayPal\Api\ShippingAddress $shipping_address - * + * * @return $this */ public function setShippingAddress($shipping_address) @@ -416,7 +441,7 @@ public function setShippingAddress($shipping_address) } /** - * Shipping address of payer PayPal account. + * @deprecated [DEPRECATED] Use shipping address present in purchase unit or at root level of checkout Session. * * @return \PayPal\Api\ShippingAddress */ diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php index 13229d5f..c0747ae7 100644 --- a/lib/PayPal/Api/Payment.php +++ b/lib/PayPal/Api/Payment.php @@ -4,9 +4,8 @@ use PayPal\Common\PayPalResourceModel; use PayPal\Core\PayPalConstants; -use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; +use PayPal\Rest\ApiContext; /** * Class Payment @@ -15,30 +14,27 @@ * * @package PayPal\Api * - * @property string id - * @property string intent - * @property \PayPal\Api\Payer payer - * @property \PayPal\Api\PotentialPayerInfo potential_payer_info - * @property \PayPal\Api\Payee payee - * @property \PayPal\Api\Transaction[] transactions - * @property string[] billing_agreement_tokens - * @property \PayPal\Api\PaymentInstruction payment_instruction - * @property string state - * @property string experience_profile_id - * @property string note_to_payer - * @property \PayPal\Api\RedirectUrls redirect_urls - * @property string failure_reason - * @property string create_time - * @property string update_time - * @property \PayPal\Api\Links[] links + * @property string id + * @property string intent + * @property \PayPal\Api\Payer payer + * @property \PayPal\Api\Transaction[] transactions + * @property string state + * @property string experience_profile_id + * @property string note_to_payer + * @property \PayPal\Api\Payee $payee + * @property \PayPal\Api\RedirectUrls redirect_urls + * @property string failure_reason + * @property string create_time + * @property string update_time + * @property \PayPal\Api\Links[] links */ class Payment extends PayPalResourceModel { /** - * ID of the created payment, the 'transaction ID' + * Identifier of the payment resource created. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -48,7 +44,7 @@ public function setId($id) } /** - * ID of the created payment, the 'transaction ID' + * Identifier of the payment resource created. * * @return string */ @@ -62,7 +58,7 @@ public function getId() * Valid Values: ["sale", "authorize", "order"] * * @param string $intent - * + * * @return $this */ public function setIntent($intent) @@ -85,7 +81,7 @@ public function getIntent() * Source of the funds for this payment represented by a PayPal account or a direct credit card. * * @param \PayPal\Api\Payer $payer - * + * * @return $this */ public function setPayer($payer) @@ -106,9 +102,9 @@ public function getPayer() /** * Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic. - * + * @deprecated Not publicly available * @param \PayPal\Api\PotentialPayerInfo $potential_payer_info - * + * * @return $this */ public function setPotentialPayerInfo($potential_payer_info) @@ -119,7 +115,7 @@ public function setPotentialPayerInfo($potential_payer_info) /** * Information that the merchant knows about the payer. This information is not definitive and only serves as a hint to the UI or any pre-processing logic. - * + * @deprecated Not publicly available * @return \PayPal\Api\PotentialPayerInfo */ public function getPotentialPayerInfo() @@ -128,10 +124,9 @@ public function getPotentialPayerInfo() } /** - * Receiver of funds for this payment. **Readonly for PayPal external REST payments.** - * + * Receiver of funds for this payment. * @param \PayPal\Api\Payee $payee - * + * * @return $this */ public function setPayee($payee) @@ -141,8 +136,7 @@ public function setPayee($payee) } /** - * Receiver of funds for this payment. **Readonly for PayPal external REST payments.** - * + * Receiver of funds for this payment. * @return \PayPal\Api\Payee */ public function getPayee() @@ -152,10 +146,9 @@ public function getPayee() /** * ID of the cart to execute the payment. - * * @deprecated Not publicly available * @param string $cart - * + * * @return $this */ public function setCart($cart) @@ -166,7 +159,6 @@ public function setCart($cart) /** * ID of the cart to execute the payment. - * * @deprecated Not publicly available * @return string */ @@ -179,7 +171,7 @@ public function getCart() * Transactional details including the amount and item details. * * @param \PayPal\Api\Transaction[] $transactions - * + * * @return $this */ public function setTransactions($transactions) @@ -230,10 +222,9 @@ public function removeTransaction($transaction) /** * Applicable for advanced payments like multi seller payment (MSP) to support partial failures - * * @deprecated Not publicly available * @param \PayPal\Api\Error[] $failed_transactions - * + * * @return $this */ public function setFailedTransactions($failed_transactions) @@ -244,7 +235,6 @@ public function setFailedTransactions($failed_transactions) /** * Applicable for advanced payments like multi seller payment (MSP) to support partial failures - * * @deprecated Not publicly available * @return \PayPal\Api\Error[] */ @@ -255,7 +245,6 @@ public function getFailedTransactions() /** * Append FailedTransactions to the list. - * * @deprecated Not publicly available * @param \PayPal\Api\Error $error * @return $this @@ -273,7 +262,6 @@ public function addFailedTransaction($error) /** * Remove FailedTransactions from the list. - * * @deprecated Not publicly available * @param \PayPal\Api\Error $error * @return $this @@ -287,9 +275,9 @@ public function removeFailedTransaction($error) /** * Collection of PayPal generated billing agreement tokens. - * + * @deprecated Not publicly available * @param string[] $billing_agreement_tokens - * + * * @return $this */ public function setBillingAgreementTokens($billing_agreement_tokens) @@ -300,7 +288,7 @@ public function setBillingAgreementTokens($billing_agreement_tokens) /** * Collection of PayPal generated billing agreement tokens. - * + * @deprecated Not publicly available * @return string[] */ public function getBillingAgreementTokens() @@ -310,7 +298,7 @@ public function getBillingAgreementTokens() /** * Append BillingAgreementTokens to the list. - * + * @deprecated Not publicly available * @param string $billingAgreementToken * @return $this */ @@ -327,7 +315,7 @@ public function addBillingAgreementToken($billingAgreementToken) /** * Remove BillingAgreementTokens from the list. - * + * @deprecated Not publicly available * @param string $billingAgreementToken * @return $this */ @@ -340,10 +328,9 @@ public function removeBillingAgreementToken($billingAgreementToken) /** * Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in - * * @deprecated Not publicly available * @param \PayPal\Api\CreditFinancingOffered $credit_financing_offered - * + * * @return $this */ public function setCreditFinancingOffered($credit_financing_offered) @@ -354,7 +341,6 @@ public function setCreditFinancingOffered($credit_financing_offered) /** * Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in - * * @deprecated Not publicly available * @return \PayPal\Api\CreditFinancingOffered */ @@ -365,9 +351,9 @@ public function getCreditFinancingOffered() /** * Instructions for the payer to complete this payment. - * + * @deprecated Not publicly available * @param \PayPal\Api\PaymentInstruction $payment_instruction - * + * * @return $this */ public function setPaymentInstruction($payment_instruction) @@ -378,7 +364,7 @@ public function setPaymentInstruction($payment_instruction) /** * Instructions for the payer to complete this payment. - * + * @deprecated Not publicly available * @return \PayPal\Api\PaymentInstruction */ public function getPaymentInstruction() @@ -387,11 +373,11 @@ public function getPaymentInstruction() } /** - * Payment state. + * The state of the payment, authorization, or order transaction. The value is: * Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -401,7 +387,7 @@ public function setState($state) } /** - * Payment state. + * The state of the payment, authorization, or order transaction. The value is: * * @return string */ @@ -411,10 +397,10 @@ public function getState() } /** - * PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/webapps/developer/docs/api/#payment-experience) link to create experience profile ID. + * PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID. * * @param string $experience_profile_id - * + * * @return $this */ public function setExperienceProfileId($experience_profile_id) @@ -424,7 +410,7 @@ public function setExperienceProfileId($experience_profile_id) } /** - * PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/webapps/developer/docs/api/#payment-experience) link to create experience profile ID. + * PayPal generated identifier for the merchant's payment experience profile. Refer to [this](https://developer.paypal.com/docs/api/#payment-experience) link to create experience profile ID. * * @return string */ @@ -437,7 +423,7 @@ public function getExperienceProfileId() * free-form field for the use of clients to pass in a message to the payer * * @param string $note_to_payer - * + * * @return $this */ public function setNoteToPayer($note_to_payer) @@ -460,7 +446,7 @@ public function getNoteToPayer() * Set of redirect URLs you provide only for PayPal-based payments. * * @param \PayPal\Api\RedirectUrls $redirect_urls - * + * * @return $this */ public function setRedirectUrls($redirect_urls) @@ -484,7 +470,7 @@ public function getRedirectUrls() * Valid Values: ["UNABLE_TO_COMPLETE_TRANSACTION", "INVALID_PAYMENT_METHOD", "PAYER_CANNOT_PAY", "CANNOT_PAY_THIS_PAYEE", "REDIRECT_REQUIRED", "PAYEE_FILTER_RESTRICTIONS"] * * @param string $failure_reason - * + * * @return $this */ public function setFailureReason($failure_reason) @@ -507,7 +493,7 @@ public function getFailureReason() * Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -530,7 +516,7 @@ public function getCreateTime() * Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -560,10 +546,10 @@ public function getApprovalLink() } /** - * Create and process a payment by passing a payment object that includes the intent, payer, and transactions in the body of the request JSON. For PayPal payments, include redirect URLs in the payment object. + * Creates and processes a payment. In the JSON request body, include a `payment` object with the intent, payer, and transactions. For PayPal payments, include redirect URLs in the `payment` object. * - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Payment */ public function create($apiContext = null, $restCall = null) @@ -582,11 +568,11 @@ public function create($apiContext = null, $restCall = null) } /** - * Look up a particular payment resource by passing the payment_id in the request URI. + * Shows details for a payment, by ID. * - * @param string $paymentId - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param string $paymentId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Payment */ public static function get($paymentId, $apiContext = null, $restCall = null) @@ -607,11 +593,11 @@ public static function get($paymentId, $apiContext = null, $restCall = null) } /** - * Use this call to partially update the payment resource for the given identifier. Allowed objects are amount, shipping_address, invoice_id and custom. Please note that it is not possible to use patch after execute has been called. + * Partially updates a payment, by ID. You can update the amount, shipping address, invoice ID, and custom data. You cannot use patch after execute has been called. * - * @param PatchRequest $patchRequest - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param PatchRequest $patchRequest + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return boolean */ public function update($patchRequest, $apiContext = null, $restCall = null) @@ -631,11 +617,11 @@ public function update($patchRequest, $apiContext = null, $restCall = null) } /** - * Execute (complete) a PayPal payment that has been approved by the payer. Optionally update selective payment information when executing the payment. + * Executes, or completes, a PayPal payment that the payer has approved. You can optionally update selective payment information when you execute a payment. * * @param PaymentExecution $paymentExecution - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Payment */ public function execute($paymentExecution, $apiContext = null, $restCall = null) @@ -656,11 +642,11 @@ public function execute($paymentExecution, $apiContext = null, $restCall = null) } /** - * List payments in any state (created, approved, failed, etc.). Payments returned are the payments made to the merchant issuing the request. + * List payments that were made to the merchant who issues the request. Payments can be in any state. * - * @param array $params - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param array $params + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return PaymentHistory */ public static function all($params, $apiContext = null, $restCall = null) @@ -668,14 +654,14 @@ public static function all($params, $apiContext = null, $restCall = null) ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( - 'count' => 1, - 'start_id' => 1, - 'start_index' => 1, - 'start_time' => 1, - 'end_time' => 1, - 'payee_id' => 1, - 'sort_by' => 1, - 'sort_order' => 1, + 'count' => 1, + 'start_id' => 1, + 'start_index' => 1, + 'start_time' => 1, + 'end_time' => 1, + 'payee_id' => 1, + 'sort_by' => 1, + 'sort_order' => 1, ); $json = self::executeCall( "/v1/payments/payment?" . http_build_query(array_intersect_key($params, $allowedParams)), diff --git a/lib/PayPal/Api/PaymentCard.php b/lib/PayPal/Api/PaymentCard.php index 3e6c7b48..c0704628 100644 --- a/lib/PayPal/Api/PaymentCard.php +++ b/lib/PayPal/Api/PaymentCard.php @@ -7,35 +7,36 @@ /** * Class PaymentCard * - * A resource representing a payment card that can be used to fund a payment. + * A payment card that can fund a payment. * * @package PayPal\Api * - * @property string id - * @property string number - * @property string type - * @property string expire_month - * @property string expire_year - * @property string start_month - * @property string start_year - * @property string cvv2 - * @property string first_name - * @property string last_name - * @property string billing_country + * @property string id + * @property string number + * @property string type + * @property string expire_month + * @property string expire_year + * @property string start_month + * @property string start_year + * @property string cvv2 + * @property string first_name + * @property string last_name + * @property string billing_country * @property \PayPal\Api\Address billing_address - * @property string external_customer_id - * @property string status - * @property string valid_until - * @property string issue_number + * @property string external_customer_id + * @property string status + * @property string card_product_class + * @property string valid_until + * @property string issue_number * @property \PayPal\Api\Links[] links */ class PaymentCard extends PayPalModel { /** - * ID of the credit card being saved for later use. + * The ID of a credit card to save for later use. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -45,7 +46,7 @@ public function setId($id) } /** - * ID of the credit card being saved for later use. + * The ID of a credit card to save for later use. * * @return string */ @@ -55,10 +56,10 @@ public function getId() } /** - * Card number. + * The card number. * * @param string $number - * + * * @return $this */ public function setNumber($number) @@ -68,7 +69,7 @@ public function setNumber($number) } /** - * Card number. + * The card number. * * @return string */ @@ -78,11 +79,11 @@ public function getNumber() } /** - * Type of the Card. + * The card type. * Valid Values: ["VISA", "AMEX", "SOLO", "JCB", "STAR", "DELTA", "DISCOVER", "SWITCH", "MAESTRO", "CB_NATIONALE", "CONFINOGA", "COFIDIS", "ELECTRON", "CETELEM", "CHINA_UNION_PAY", "MASTERCARD"] * * @param string $type - * + * * @return $this */ public function setType($type) @@ -92,7 +93,7 @@ public function setType($type) } /** - * Type of the Card. + * The card type. * * @return string */ @@ -102,10 +103,10 @@ public function getType() } /** - * 2 digit card expiry month. + * The two-digit expiry month for the card. * * @param string $expire_month - * + * * @return $this */ public function setExpireMonth($expire_month) @@ -115,7 +116,7 @@ public function setExpireMonth($expire_month) } /** - * 2 digit card expiry month. + * The two-digit expiry month for the card. * * @return string */ @@ -125,10 +126,10 @@ public function getExpireMonth() } /** - * 4 digit card expiry year + * The four-digit expiry year for the card. * * @param string $expire_year - * + * * @return $this */ public function setExpireYear($expire_year) @@ -138,7 +139,7 @@ public function setExpireYear($expire_year) } /** - * 4 digit card expiry year + * The four-digit expiry year for the card. * * @return string */ @@ -148,10 +149,10 @@ public function getExpireYear() } /** - * 2 digit card start month. Needed for UK Maestro Card. + * The two-digit start month for the card. Required for UK Maestro cards. * * @param string $start_month - * + * * @return $this */ public function setStartMonth($start_month) @@ -161,7 +162,7 @@ public function setStartMonth($start_month) } /** - * 2 digit card start month. Needed for UK Maestro Card. + * The two-digit start month for the card. Required for UK Maestro cards. * * @return string */ @@ -171,10 +172,10 @@ public function getStartMonth() } /** - * 4 digit card start year. Needed for UK Maestro Card. + * The four-digit start year for the card. Required for UK Maestro cards. * * @param string $start_year - * + * * @return $this */ public function setStartYear($start_year) @@ -184,7 +185,7 @@ public function setStartYear($start_year) } /** - * 4 digit card start year. Needed for UK Maestro Card. + * The four-digit start year for the card. Required for UK Maestro cards. * * @return string */ @@ -194,10 +195,10 @@ public function getStartYear() } /** - * Card validation code. Only supported when making a Payment but not when saving a payment card for future use. + * The validation code for the card. Supported for payments but not for saving payment cards for future use. * * @param string $cvv2 - * + * * @return $this */ public function setCvv2($cvv2) @@ -207,7 +208,7 @@ public function setCvv2($cvv2) } /** - * Card validation code. Only supported when making a Payment but not when saving a payment card for future use. + * The validation code for the card. Supported for payments but not for saving payment cards for future use. * * @return string */ @@ -217,10 +218,10 @@ public function getCvv2() } /** - * Card holder's first name. + * The first name of the card holder. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -230,7 +231,7 @@ public function setFirstName($first_name) } /** - * Card holder's first name. + * The first name of the card holder. * * @return string */ @@ -240,10 +241,10 @@ public function getFirstName() } /** - * Card holder's last name. + * The last name of the card holder. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -253,7 +254,7 @@ public function setLastName($last_name) } /** - * Card holder's last name. + * The last name of the card holder. * * @return string */ @@ -263,10 +264,10 @@ public function getLastName() } /** - * 2 letter country code + * The two-letter country code. * * @param string $billing_country - * + * * @return $this */ public function setBillingCountry($billing_country) @@ -276,7 +277,7 @@ public function setBillingCountry($billing_country) } /** - * 2 letter country code + * The two-letter country code. * * @return string */ @@ -286,10 +287,10 @@ public function getBillingCountry() } /** - * Billing Address associated with this card. + * The billing address for the card. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -299,7 +300,7 @@ public function setBillingAddress($billing_address) } /** - * Billing Address associated with this card. + * The billing address for the card. * * @return \PayPal\Api\Address */ @@ -309,10 +310,10 @@ public function getBillingAddress() } /** - * A unique identifier of the customer to whom this card account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault. + * The ID of the customer who owns this card account. The facilitator generates and provides this ID. Required when you create or use a stored funding instrument in the PayPal vault. * * @param string $external_customer_id - * + * * @return $this */ public function setExternalCustomerId($external_customer_id) @@ -322,7 +323,7 @@ public function setExternalCustomerId($external_customer_id) } /** - * A unique identifier of the customer to whom this card account belongs to. Generated and provided by the facilitator. This is required when creating or using a stored funding instrument in vault. + * The ID of the customer who owns this card account. The facilitator generates and provides this ID. Required when you create or use a stored funding instrument in the PayPal vault. * * @return string */ @@ -332,11 +333,11 @@ public function getExternalCustomerId() } /** - * State of the funding instrument. + * The state of the funding instrument. * Valid Values: ["EXPIRED", "ACTIVE"] * * @param string $status - * + * * @return $this */ public function setStatus($status) @@ -346,7 +347,7 @@ public function setStatus($status) } /** - * State of the funding instrument. + * The state of the funding instrument. * * @return string */ @@ -356,10 +357,34 @@ public function getStatus() } /** - * Date/Time until this resource can be used fund a payment. + * The product class of the financial instrument issuer. + * Valid Values: ["CREDIT", "DEBIT", "GIFT", "PAYPAL_PREPAID", "PREPAID", "UNKNOWN"] * - * @param string $valid_until + * @param string $card_product_class + * + * @return $this + */ + public function setCardProductClass($card_product_class) + { + $this->card_product_class = $card_product_class; + return $this; + } + + /** + * The product class of the financial instrument issuer. + * + * @return string + */ + public function getCardProductClass() + { + return $this->card_product_class; + } + + /** + * The date and time until when this instrument can be used fund a payment. * + * @param string $valid_until + * * @return $this */ public function setValidUntil($valid_until) @@ -369,7 +394,7 @@ public function setValidUntil($valid_until) } /** - * Date/Time until this resource can be used fund a payment. + * The date and time until when this instrument can be used fund a payment. * * @return string */ @@ -379,10 +404,10 @@ public function getValidUntil() } /** - * 1-2 digit card issue number. Needed for UK Maestro Card. + * The one- to two-digit card issue number. Required for UK Maestro cards. * * @param string $issue_number - * + * * @return $this */ public function setIssueNumber($issue_number) @@ -392,7 +417,7 @@ public function setIssueNumber($issue_number) } /** - * 1-2 digit card issue number. Needed for UK Maestro Card. + * The one- to two-digit card issue number. Required for UK Maestro cards. * * @return string */ @@ -405,7 +430,7 @@ public function getIssueNumber() * Sets Links * * @param \PayPal\Api\Links[] $links - * + * * @return $this */ public function setLinks($links) diff --git a/lib/PayPal/Api/PaymentExecution.php b/lib/PayPal/Api/PaymentExecution.php index 327731be..47830371 100644 --- a/lib/PayPal/Api/PaymentExecution.php +++ b/lib/PayPal/Api/PaymentExecution.php @@ -11,8 +11,7 @@ * * @package PayPal\Api * - * @property string payer_id - * @property string carrier_account_id + * @property string payer_id * @property \PayPal\Api\Transaction[] transactions */ class PaymentExecution extends PayPalModel @@ -21,7 +20,7 @@ class PaymentExecution extends PayPalModel * The ID of the Payer, passed in the `return_url` by PayPal. * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -42,9 +41,9 @@ public function getPayerId() /** * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable. - * + * @deprecated Not publicly available * @param string $carrier_account_id - * + * * @return $this */ public function setCarrierAccountId($carrier_account_id) @@ -55,7 +54,7 @@ public function setCarrierAccountId($carrier_account_id) /** * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable. - * + * @deprecated Not publicly available * @return string */ public function getCarrierAccountId() @@ -67,7 +66,7 @@ public function getCarrierAccountId() * Transactional details including the amount and item details. * * @param \PayPal\Api\Transaction[] $transactions - * + * * @return $this */ public function setTransactions($transactions) diff --git a/lib/PayPal/Api/PaymentHistory.php b/lib/PayPal/Api/PaymentHistory.php index 89e417a8..eb4e6117 100644 --- a/lib/PayPal/Api/PaymentHistory.php +++ b/lib/PayPal/Api/PaymentHistory.php @@ -71,7 +71,7 @@ public function removePayment($payment) } /** - * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. + * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. Maximum value: 20. * * @param int $count * @@ -84,7 +84,7 @@ public function setCount($count) } /** - * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. + * Number of items returned in each range of results. Note that the last results range could have fewer items than the requested number of items. Maximum value: 20. * * @return int */ diff --git a/lib/PayPal/Api/PaymentOptions.php b/lib/PayPal/Api/PaymentOptions.php index d81fe375..90b24a2f 100644 --- a/lib/PayPal/Api/PaymentOptions.php +++ b/lib/PayPal/Api/PaymentOptions.php @@ -16,11 +16,11 @@ class PaymentOptions extends PayPalModel { /** - * Optional payment method type. If specified, the transaction will go through for only instant payment. Only for use with the paypal payment_method, not relevant for the credit_card payment_method. + * Payment method requested for this purchase unit * Valid Values: ["UNRESTRICTED", "INSTANT_FUNDING_SOURCE", "IMMEDIATE_PAY"] * * @param string $allowed_payment_method - * + * * @return $this */ public function setAllowedPaymentMethod($allowed_payment_method) @@ -30,7 +30,7 @@ public function setAllowedPaymentMethod($allowed_payment_method) } /** - * Optional payment method type. If specified, the transaction will go through for only instant payment. Only for use with the paypal payment_method, not relevant for the credit_card payment_method. + * Payment method requested for this purchase unit * * @return string */ @@ -41,10 +41,9 @@ public function getAllowedPaymentMethod() /** * Indicator if this payment request is a recurring payment. Only supported when the `payment_method` is set to `credit_card` - * * @deprecated Not publicly available * @param bool $recurring_flag - * + * * @return $this */ public function setRecurringFlag($recurring_flag) @@ -55,7 +54,6 @@ public function setRecurringFlag($recurring_flag) /** * Indicator if this payment request is a recurring payment. Only supported when the `payment_method` is set to `credit_card` - * * @deprecated Not publicly available * @return bool */ @@ -66,10 +64,9 @@ public function getRecurringFlag() /** * Indicator if fraud management filters (fmf) should be skipped for this transaction. Only supported when the `payment_method` is set to `credit_card` - * * @deprecated Not publicly available * @param bool $skip_fmf - * + * * @return $this */ public function setSkipFmf($skip_fmf) @@ -80,7 +77,6 @@ public function setSkipFmf($skip_fmf) /** * Indicator if fraud management filters (fmf) should be skipped for this transaction. Only supported when the `payment_method` is set to `credit_card` - * * @deprecated Not publicly available * @return bool */ diff --git a/lib/PayPal/Api/Phone.php b/lib/PayPal/Api/Phone.php index 16c0523d..b93a09ea 100644 --- a/lib/PayPal/Api/Phone.php +++ b/lib/PayPal/Api/Phone.php @@ -7,7 +7,7 @@ /** * Class Phone * - * Representation of a phone number. + * Information related to the Payee. * * @package PayPal\Api * @@ -18,7 +18,7 @@ class Phone extends PayPalModel { /** - * The country calling code (CC) as defined by E.164. The combined length of CC+national cannot be more than 15 digits. + * Country code (from in E.164 format) * * @param string $country_code * @@ -31,7 +31,7 @@ public function setCountryCode($country_code) } /** - * The country calling code (CC) as defined by E.164. The combined length of CC+national cannot be more than 15 digits. + * Country code (from in E.164 format) * * @return string */ @@ -41,7 +41,7 @@ public function getCountryCode() } /** - * The national number as defined by E.164. The combined length of CC+national cannot be more than 15 digits. A national number consists of National Destination Code (NDC) and Subscriber Number (SN). + * In-country phone number (from in E.164 format) * * @param string $national_number * @@ -54,7 +54,7 @@ public function setNationalNumber($national_number) } /** - * The national number as defined by E.164. The combined length of CC+national cannot be more than 15 digits. A national number consists of National Destination Code (NDC) and Subscriber Number (SN). + * In-country phone number (from in E.164 format) * * @return string */ @@ -67,7 +67,7 @@ public function getNationalNumber() * Phone extension * * @param string $extension - * + * * @return $this */ public function setExtension($extension) diff --git a/lib/PayPal/Api/PotentialPayerInfo.php b/lib/PayPal/Api/PotentialPayerInfo.php index fc57e174..63254cfe 100644 --- a/lib/PayPal/Api/PotentialPayerInfo.php +++ b/lib/PayPal/Api/PotentialPayerInfo.php @@ -11,15 +11,12 @@ * * @package PayPal\Api * - * @property string email - * @property string external_remember_me_id - * @property \PayPal\Api\Address billing_address */ class PotentialPayerInfo extends PayPalModel { /** * Email address representing the potential payer. - * + * @deprecated Not publicly available * @param string $email * * @return $this @@ -32,7 +29,7 @@ public function setEmail($email) /** * Email address representing the potential payer. - * + * @deprecated Not publicly available * @return string */ public function getEmail() @@ -42,7 +39,7 @@ public function getEmail() /** * ExternalRememberMe id representing the potential payer - * + * @deprecated Not publicly available * @param string $external_remember_me_id * * @return $this @@ -55,7 +52,7 @@ public function setExternalRememberMeId($external_remember_me_id) /** * ExternalRememberMe id representing the potential payer - * + * @deprecated Not publicly available * @return string */ public function getExternalRememberMeId() @@ -88,7 +85,7 @@ public function getAccountNumber() /** * Billing address of the potential payer. - * + * @deprecated Not publicly available * @param \PayPal\Api\Address $billing_address * * @return $this @@ -101,7 +98,7 @@ public function setBillingAddress($billing_address) /** * Billing address of the potential payer. - * + * @deprecated Not publicly available * @return \PayPal\Api\Address */ public function getBillingAddress() diff --git a/lib/PayPal/Api/Refund.php b/lib/PayPal/Api/Refund.php index dfddb0cf..c008f175 100644 --- a/lib/PayPal/Api/Refund.php +++ b/lib/PayPal/Api/Refund.php @@ -3,8 +3,8 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; -use PayPal\Rest\ApiContext; use PayPal\Validation\ArgumentValidator; +use PayPal\Rest\ApiContext; /** * Class Refund @@ -13,16 +13,18 @@ * * @package PayPal\Api * - * @property string id - * @property \PayPal\Api\Amount amount - * @property string state - * @property string reason - * @property string sale_id - * @property string capture_id - * @property string parent_payment - * @property string description - * @property string create_time - * @property string update_time + * @property string id + * @property \PayPal\Api\Amount amount + * @property string state + * @property string reason + * @property string invoice_number + * @property string sale_id + * @property string capture_id + * @property string parent_payment + * @property string description + * @property string create_time + * @property string update_time + * @property string reason_code * @property \PayPal\Api\Links[] links */ class Refund extends PayPalResourceModel @@ -31,7 +33,7 @@ class Refund extends PayPalResourceModel * ID of the refund transaction. 17 characters max. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -54,7 +56,7 @@ public function getId() * Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -78,7 +80,7 @@ public function getAmount() * Valid Values: ["pending", "completed", "failed"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -101,7 +103,7 @@ public function getState() * Reason description for the Sale transaction being refunded. * * @param string $reason - * + * * @return $this */ public function setReason($reason) @@ -121,10 +123,33 @@ public function getReason() } /** - * ID of the Sale transaction being refunded. + * Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters. * - * @param string $sale_id + * @param string $invoice_number + * + * @return $this + */ + public function setInvoiceNumber($invoice_number) + { + $this->invoice_number = $invoice_number; + return $this; + } + + /** + * Your own invoice or tracking ID number. Character length and limitations: 127 single-byte alphanumeric characters. + * + * @return string + */ + public function getInvoiceNumber() + { + return $this->invoice_number; + } + + /** + * ID of the Sale transaction being refunded. * + * @param string $sale_id + * * @return $this */ public function setSaleId($sale_id) @@ -134,7 +159,7 @@ public function setSaleId($sale_id) } /** - * ID of the Sale transaction being refunded. + * ID of the Sale transaction being refunded. * * @return string */ @@ -147,7 +172,7 @@ public function getSaleId() * ID of the sale transaction being refunded. * * @param string $capture_id - * + * * @return $this */ public function setCaptureId($capture_id) @@ -170,7 +195,7 @@ public function getCaptureId() * ID of the payment resource on which this transaction is based. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -193,7 +218,7 @@ public function getParentPayment() * Description of what is being refunded for. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -216,7 +241,7 @@ public function getDescription() * Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -239,7 +264,7 @@ public function getCreateTime() * Time that the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -259,11 +284,35 @@ public function getUpdateTime() } /** - * Retrieve details about a specific refund by passing the refund_id in the request URI. + * The reason code for the refund state being pending + * Valid Values: ["ECHECK"] + * + * @param string $reason_code + * + * @return $this + */ + public function setReasonCode($reason_code) + { + $this->reason_code = $reason_code; + return $this; + } + + /** + * The reason code for the refund state being pending + * + * @return string + */ + public function getReasonCode() + { + return $this->reason_code; + } + + /** + * Shows details for a refund, by ID. * - * @param string $refundId - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param string $refundId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Refund */ public static function get($refundId, $apiContext = null, $restCall = null) diff --git a/lib/PayPal/Api/RefundRequest.php b/lib/PayPal/Api/RefundRequest.php new file mode 100644 index 00000000..1fdaa953 --- /dev/null +++ b/lib/PayPal/Api/RefundRequest.php @@ -0,0 +1,162 @@ +amount = $amount; + return $this; + } + + /** + * Details including both refunded amount (to payer) and refunded fee (to payee). + * + * @return \PayPal\Api\Amount + */ + public function getAmount() + { + return $this->amount; + } + + /** + * Description of what is being refunded for. Character length and limitations: 255 single-byte alphanumeric characters. + * + * @param string $description + * + * @return $this + */ + public function setDescription($description) + { + $this->description = $description; + return $this; + } + + /** + * Description of what is being refunded for. Character length and limitations: 255 single-byte alphanumeric characters. + * + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * Type of PayPal funding source (balance or eCheck) that can be used for auto refund. + * Valid Values: ["INSTANT_FUNDING_SOURCE", "ECHECK", "UNRESTRICTED"] + * + * @param string $refund_source + * + * @return $this + */ + public function setRefundSource($refund_source) + { + $this->refund_source = $refund_source; + return $this; + } + + /** + * Type of PayPal funding source (balance or eCheck) that can be used for auto refund. + * + * @return string + */ + public function getRefundSource() + { + return $this->refund_source; + } + + /** + * Reason description for the Sale transaction being refunded. + * + * @param string $reason + * + * @return $this + */ + public function setReason($reason) + { + $this->reason = $reason; + return $this; + } + + /** + * Reason description for the Sale transaction being refunded. + * + * @return string + */ + public function getReason() + { + return $this->reason; + } + + /** + * The invoice number that is used to track this payment. Character length and limitations: 127 single-byte alphanumeric characters. + * + * @param string $invoice_number + * + * @return $this + */ + public function setInvoiceNumber($invoice_number) + { + $this->invoice_number = $invoice_number; + return $this; + } + + /** + * The invoice number that is used to track this payment. Character length and limitations: 127 single-byte alphanumeric characters. + * + * @return string + */ + public function getInvoiceNumber() + { + return $this->invoice_number; + } + + /** + * Flag to indicate that the buyer was already given store credit for a given transaction. + * + * @param bool $refund_advice + * + * @return $this + */ + public function setRefundAdvice($refund_advice) + { + $this->refund_advice = $refund_advice; + return $this; + } + + /** + * Flag to indicate that the buyer was already given store credit for a given transaction. + * + * @return bool + */ + public function getRefundAdvice() + { + return $this->refund_advice; + } + +} diff --git a/lib/PayPal/Api/RelatedResources.php b/lib/PayPal/Api/RelatedResources.php index e8f9719b..d324841f 100644 --- a/lib/PayPal/Api/RelatedResources.php +++ b/lib/PayPal/Api/RelatedResources.php @@ -11,11 +11,11 @@ * * @package PayPal\Api * - * @property \PayPal\Api\Sale sale + * @property \PayPal\Api\Sale sale * @property \PayPal\Api\Authorization authorization - * @property \PayPal\Api\Order order - * @property \PayPal\Api\Capture capture - * @property \PayPal\Api\Refund refund + * @property \PayPal\Api\Order order + * @property \PayPal\Api\Capture capture + * @property \PayPal\Api\Refund refund */ class RelatedResources extends PayPalModel { @@ -23,7 +23,7 @@ class RelatedResources extends PayPalModel * Sale transaction * * @param \PayPal\Api\Sale $sale - * + * * @return $this */ public function setSale($sale) @@ -46,7 +46,7 @@ public function getSale() * Authorization transaction * * @param \PayPal\Api\Authorization $authorization - * + * * @return $this */ public function setAuthorization($authorization) @@ -69,7 +69,7 @@ public function getAuthorization() * Order transaction * * @param \PayPal\Api\Order $order - * + * * @return $this */ public function setOrder($order) @@ -92,7 +92,7 @@ public function getOrder() * Capture transaction * * @param \PayPal\Api\Capture $capture - * + * * @return $this */ public function setCapture($capture) @@ -115,7 +115,7 @@ public function getCapture() * Refund transaction * * @param \PayPal\Api\Refund $refund - * + * * @return $this */ public function setRefund($refund) diff --git a/lib/PayPal/Api/Sale.php b/lib/PayPal/Api/Sale.php index 856cbe48..1c4cb282 100644 --- a/lib/PayPal/Api/Sale.php +++ b/lib/PayPal/Api/Sale.php @@ -3,46 +3,46 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; -use PayPal\Rest\ApiContext; use PayPal\Validation\ArgumentValidator; +use PayPal\Rest\ApiContext; /** * Class Sale * - * A sale transaction. + * A sale transaction. This is the resource that is returned as a part related resources in Payment * * @package PayPal\Api * - * @property string id - * @property string purchase_unit_reference_id - * @property \PayPal\Api\Amount amount - * @property string payment_mode - * @property string state - * @property string reason_code - * @property string protection_eligibility - * @property string protection_eligibility_type - * @property string clearing_time - * @property string payment_hold_status - * @property string[] payment_hold_reasons - * @property \PayPal\Api\Currency transaction_fee - * @property \PayPal\Api\Currency receivable_amount - * @property string exchange_rate - * @property \PayPal\Api\FmfDetails fmf_details - * @property string receipt_id - * @property string parent_payment + * @property string id + * @property string purchase_unit_reference_id + * @property \PayPal\Api\Amount amount + * @property string payment_mode + * @property string state + * @property string reason_code + * @property string protection_eligibility + * @property string protection_eligibility_type + * @property string clearing_time + * @property string payment_hold_status + * @property string[] payment_hold_reasons + * @property \PayPal\Api\Currency transaction_fee + * @property \PayPal\Api\Currency receivable_amount + * @property string exchange_rate + * @property \PayPal\Api\FmfDetails fmf_details + * @property string receipt_id + * @property string parent_payment * @property \PayPal\Api\ProcessorResponse processor_response - * @property string billing_agreement_id - * @property string create_time - * @property string update_time - * @property \PayPal\Api\Links[] links + * @property string billing_agreement_id + * @property string create_time + * @property string update_time + * @property \PayPal\Api\Links[] links */ class Sale extends PayPalResourceModel { /** - * ID of the sale transaction. + * Identifier of the sale transaction. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -52,7 +52,7 @@ public function setId($id) } /** - * ID of the sale transaction. + * Identifier of the sale transaction. * * @return string */ @@ -62,10 +62,10 @@ public function getId() } /** - * Identifier of the purchased unit associated with this object. + * Identifier to the purchase or transaction unit corresponding to this sale transaction. * * @param string $purchase_unit_reference_id - * + * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) @@ -75,7 +75,7 @@ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) } /** - * Identifier of the purchased unit associated with this object. + * Identifier to the purchase or transaction unit corresponding to this sale transaction. * * @return string */ @@ -88,7 +88,7 @@ public function getPurchaseUnitReferenceId() * Amount being collected. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -112,7 +112,7 @@ public function getAmount() * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $payment_mode - * + * * @return $this */ public function setPaymentMode($payment_mode) @@ -132,11 +132,11 @@ public function getPaymentMode() } /** - * State of the sale. - * Valid Values: ["completed", "partially_refunded", "pending", "refunded"] + * State of the sale transaction. + * Valid Values: ["completed", "partially_refunded", "pending", "refunded", "denied"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -146,7 +146,7 @@ public function setState($state) } /** - * State of the sale. + * State of the sale transaction. * * @return string */ @@ -157,10 +157,10 @@ public function getState() /** * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. - * Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED"] + * Valid Values: ["CHARGEBACK", "GUARANTEE", "BUYER_COMPLAINT", "REFUND", "UNCONFIRMED_SHIPPING_ADDRESS", "ECHECK", "INTERNATIONAL_WITHDRAWAL", "RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION", "PAYMENT_REVIEW", "REGULATORY_REVIEW", "UNILATERAL", "VERIFICATION_REQUIRED", "TRANSACTION_APPROVED_AWAITING_FUNDING"] * * @param string $reason_code - * + * * @return $this */ public function setReasonCode($reason_code) @@ -180,11 +180,11 @@ public function getReasonCode() } /** - * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. + * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility - * + * * @return $this */ public function setProtectionEligibility($protection_eligibility) @@ -194,7 +194,7 @@ public function setProtectionEligibility($protection_eligibility) } /** - * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. + * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -208,7 +208,7 @@ public function getProtectionEligibility() * Valid Values: ["ITEM_NOT_RECEIVED_ELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE"] * * @param string $protection_eligibility_type - * + * * @return $this */ public function setProtectionEligibilityType($protection_eligibility_type) @@ -228,10 +228,10 @@ public function getProtectionEligibilityType() } /** - * Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`. + * Expected clearing time for eCheck Transactions. Returned when payment is made with eCheck. Only supported when the `payment_method` is set to `paypal`. * * @param string $clearing_time - * + * * @return $this */ public function setClearingTime($clearing_time) @@ -241,7 +241,7 @@ public function setClearingTime($clearing_time) } /** - * Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`. + * Expected clearing time for eCheck Transactions. Returned when payment is made with eCheck. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -255,7 +255,7 @@ public function getClearingTime() * Valid Values: ["HELD"] * * @param string $payment_hold_status - * + * * @return $this */ public function setPaymentHoldStatus($payment_hold_status) @@ -278,7 +278,7 @@ public function getPaymentHoldStatus() * Reasons for PayPal holding recipient fund. It is set only if payment hold status is held * * @param string[] $payment_hold_reasons - * + * * @return $this */ public function setPaymentHoldReasons($payment_hold_reasons) @@ -328,10 +328,10 @@ public function removePaymentHoldReason($string) } /** - * Transaction fee charged by PayPal for this transaction. + * Transaction fee applicable for this payment. * * @param \PayPal\Api\Currency $transaction_fee - * + * * @return $this */ public function setTransactionFee($transaction_fee) @@ -341,7 +341,7 @@ public function setTransactionFee($transaction_fee) } /** - * Transaction fee charged by PayPal for this transaction. + * Transaction fee applicable for this payment. * * @return \PayPal\Api\Currency */ @@ -354,7 +354,7 @@ public function getTransactionFee() * Net amount the merchant receives for this transaction in their receivable currency. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer. * * @param \PayPal\Api\Currency $receivable_amount - * + * * @return $this */ public function setReceivableAmount($receivable_amount) @@ -377,7 +377,7 @@ public function getReceivableAmount() * Exchange rate applied for this transaction. Returned only in cross-currency use cases where a merchant bills a buyer in a non-primary currency for that buyer. * * @param string $exchange_rate - * + * * @return $this */ public function setExchangeRate($exchange_rate) @@ -400,7 +400,7 @@ public function getExchangeRate() * Fraud Management Filter (FMF) details applied for the payment that could result in accept, deny, or pending action. Returned in a payment response only if the merchant has enabled FMF in the profile settings and one of the fraud filters was triggered based on those settings. See [Fraud Management Filters Summary](/docs/classic/fmf/integration-guide/FMFSummary/) for more information. * * @param \PayPal\Api\FmfDetails $fmf_details - * + * * @return $this */ public function setFmfDetails($fmf_details) @@ -423,7 +423,7 @@ public function getFmfDetails() * Receipt id is a payment identification number returned for guest users to identify the payment. * * @param string $receipt_id - * + * * @return $this */ public function setReceiptId($receipt_id) @@ -446,7 +446,7 @@ public function getReceiptId() * ID of the payment resource on which this transaction is based. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -469,7 +469,7 @@ public function getParentPayment() * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * * @param \PayPal\Api\ProcessorResponse $processor_response - * + * * @return $this */ public function setProcessorResponse($processor_response) @@ -492,7 +492,7 @@ public function getProcessorResponse() * ID of the billing agreement used as reference to execute this transaction. * * @param string $billing_agreement_id - * + * * @return $this */ public function setBillingAgreementId($billing_agreement_id) @@ -515,7 +515,7 @@ public function getBillingAgreementId() * Time of sale as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6) * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -538,7 +538,7 @@ public function getCreateTime() * Time the resource was last updated in UTC ISO8601 format. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -558,11 +558,11 @@ public function getUpdateTime() } /** - * Retrieve details about a sale transaction by passing the sale_id in the request URI. This request returns only the sales that were created via the REST API. + * Shows details for a sale, by ID. Returns only sales that were created through the REST API. * - * @param string $saleId - * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. - * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @param string $saleId + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls * @return Sale */ public static function get($saleId, $apiContext = null, $restCall = null) @@ -585,6 +585,7 @@ public static function get($saleId, $apiContext = null, $restCall = null) /** * Refund a completed payment by passing the sale_id in the request URI. In addition, include an empty JSON payload in the request body for a full refund. For a partial refund, include an amount object in the request body. * + * @deprecated Please use #refundSale instead. * @param Refund $refund * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls @@ -608,4 +609,29 @@ public function refund($refund, $apiContext = null, $restCall = null) return $ret; } + /** + * Refunds a sale, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an `amount` object in the JSON request body. + * + * @param RefundRequest $refundRequest + * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials. + * @param PayPalRestCall $restCall is the Rest Call Service that is used to make rest calls + * @return DetailedRefund + */ + public function refundSale($refundRequest, $apiContext = null, $restCall = null) + { + ArgumentValidator::validate($this->getId(), "Id"); + ArgumentValidator::validate($refundRequest, 'refundRequest'); + $payLoad = $refundRequest->toJSON(); + $json = self::executeCall( + "/v1/payments/sale/{$this->getId()}/refund", + "POST", + $payLoad, + null, + $apiContext, + $restCall + ); + $ret = new DetailedRefund(); + $ret->fromJson($json); + return $ret; + } } diff --git a/lib/PayPal/Api/ShippingAddress.php b/lib/PayPal/Api/ShippingAddress.php index 9bde9189..c7d29f75 100644 --- a/lib/PayPal/Api/ShippingAddress.php +++ b/lib/PayPal/Api/ShippingAddress.php @@ -9,18 +9,15 @@ * * @package PayPal\Api * - * @property string id * @property string recipient_name - * @property bool default_address - * @property bool preferred_address */ class ShippingAddress extends Address { /** * Address ID assigned in PayPal system. - * + * @deprecated Not publicly available * @param string $id - * + * * @return $this */ public function setId($id) @@ -31,7 +28,7 @@ public function setId($id) /** * Address ID assigned in PayPal system. - * + * @deprecated Not publicly available * @return string */ public function getId() @@ -43,7 +40,7 @@ public function getId() * Name of the recipient at this address. * * @param string $recipient_name - * + * * @return $this */ public function setRecipientName($recipient_name) @@ -64,9 +61,9 @@ public function getRecipientName() /** * Default shipping address of the Payer. - * + * @deprecated Not publicly available * @param bool $default_address - * + * * @return $this */ public function setDefaultAddress($default_address) @@ -77,7 +74,7 @@ public function setDefaultAddress($default_address) /** * Default shipping address of the Payer. - * + * @deprecated Not publicly available * @return bool */ public function getDefaultAddress() @@ -87,9 +84,9 @@ public function getDefaultAddress() /** * Shipping Address marked as preferred by Payer. - * + * @deprecated Not publicly available * @param bool $preferred_address - * + * * @return $this */ public function setPreferredAddress($preferred_address) @@ -100,7 +97,7 @@ public function setPreferredAddress($preferred_address) /** * Shipping Address marked as preferred by Payer. - * + * @deprecated Not publicly available * @return bool */ public function getPreferredAddress() diff --git a/lib/PayPal/Api/Transaction.php b/lib/PayPal/Api/Transaction.php index 96234304..8520e63c 100644 --- a/lib/PayPal/Api/Transaction.php +++ b/lib/PayPal/Api/Transaction.php @@ -40,7 +40,7 @@ public function getTransactions() * Identifier to the purchase unit corresponding to this sale transaction * * @param string $purchase_unit_reference_id - * + * @deprecated Use #setReferenceId instead * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) @@ -52,6 +52,7 @@ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) /** * Identifier to the purchase unit corresponding to this sale transaction * + * @deprecated Use #getReferenceId instead * @return string */ public function getPurchaseUnitReferenceId() diff --git a/sample/payments/CreatePayment.php b/sample/payments/CreatePayment.php index 45913479..ba83f410 100644 --- a/sample/payments/CreatePayment.php +++ b/sample/payments/CreatePayment.php @@ -3,8 +3,8 @@ // # CreatePaymentSample // // This sample code demonstrate how you can process -// a direct credit card payment. Please note that direct -// credit card payment and related features using the +// a direct credit card payment. Please note that direct +// credit card payment and related features using the // REST API is restricted in some countries. // API used: /v1/payments/payment @@ -29,8 +29,8 @@ ->setExpireYear("2019") ->setCvv2("012") ->setFirstName("Joe") - ->setLastName("Shopper") - ->setBillingCountry("US"); + ->setBillingCountry("US") + ->setLastName("Shopper"); // ### FundingInstrument // A resource representing a Payer's funding instrument. @@ -89,7 +89,7 @@ // ### Transaction // A transaction defines the contract of a // payment - what is the payment for and who -// is fulfilling it. +// is fulfilling it. $transaction = new Transaction(); $transaction->setAmount($amount) ->setItemList($itemList) diff --git a/tests/PayPal/Test/Api/AddressTest.php b/tests/PayPal/Test/Api/AddressTest.php index bfac0655..4fc5e561 100644 --- a/tests/PayPal/Test/Api/AddressTest.php +++ b/tests/PayPal/Test/Api/AddressTest.php @@ -13,17 +13,15 @@ class AddressTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Address - * * @return string */ public static function getJson() { - return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":"TestSample","normalization_status":"TestSample","status":"TestSample"}'; + return '{"line1":"TestSample","line2":"TestSample","city":"TestSample","country_code":"TestSample","postal_code":"TestSample","state":"TestSample","phone":"TestSample","normalization_status":"TestSample","status":"TestSample","type":"TestSample"}'; } /** * Gets Object Instance with Json data filled in - * * @return Address */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Address */ public function testSerializationDeserialization() @@ -50,6 +47,7 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getPhone()); $this->assertNotNull($obj->getNormalizationStatus()); $this->assertNotNull($obj->getStatus()); + $this->assertNotNull($obj->getType()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -69,5 +67,6 @@ public function testGetters($obj) $this->assertEquals($obj->getPhone(), "TestSample"); $this->assertEquals($obj->getNormalizationStatus(), "TestSample"); $this->assertEquals($obj->getStatus(), "TestSample"); + $this->assertEquals($obj->getType(), "TestSample"); } } diff --git a/tests/PayPal/Test/Api/AmountTest.php b/tests/PayPal/Test/Api/AmountTest.php index ba511781..b50b5499 100644 --- a/tests/PayPal/Test/Api/AmountTest.php +++ b/tests/PayPal/Test/Api/AmountTest.php @@ -13,7 +13,6 @@ class AmountTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Amount - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Amount */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Amount */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/AuthorizationTest.php b/tests/PayPal/Test/Api/AuthorizationTest.php index 91fa813a..cac00f22 100644 --- a/tests/PayPal/Test/Api/AuthorizationTest.php +++ b/tests/PayPal/Test/Api/AuthorizationTest.php @@ -14,17 +14,15 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Authorization - * * @return string */ public static function getJson() { - return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; + return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"parent_payment":"TestSample","valid_until":"TestSample","create_time":"TestSample","update_time":"TestSample","reference_id":"TestSample","receipt_id":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return Authorization */ public static function getObject() @@ -35,7 +33,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Authorization */ public function testSerializationDeserialization() @@ -55,6 +52,8 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getValidUntil()); $this->assertNotNull($obj->getCreateTime()); $this->assertNotNull($obj->getUpdateTime()); + $this->assertNotNull($obj->getReferenceId()); + $this->assertNotNull($obj->getReceiptId()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -79,6 +78,8 @@ public function testGetters($obj) $this->assertEquals($obj->getValidUntil(), "TestSample"); $this->assertEquals($obj->getCreateTime(), "TestSample"); $this->assertEquals($obj->getUpdateTime(), "TestSample"); + $this->assertEquals($obj->getReferenceId(), "TestSample"); + $this->assertEquals($obj->getReceiptId(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } @@ -95,13 +96,12 @@ public function testGet($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - AuthorizationTest::getJson() + AuthorizationTest::getJson() )); $result = $obj->get("authorizationId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Authorization $obj @@ -115,14 +115,13 @@ public function testCapture($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - CaptureTest::getJson() + CaptureTest::getJson() )); $capture = CaptureTest::getObject(); $result = $obj->capture($capture, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Authorization $obj @@ -136,13 +135,12 @@ public function testVoid($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - self::getJson() + self::getJson() )); $result = $obj->void($mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Authorization $obj @@ -156,7 +154,7 @@ public function testReauthorize($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - self::getJson() + self::getJson() )); $result = $obj->reauthorize($mockApiContext, $mockPPRestCall); @@ -167,8 +165,8 @@ public function mockProvider() { $obj = self::getObject(); $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); return array( array($obj, $mockApiContext), array($obj, null) diff --git a/tests/PayPal/Test/Api/BankAccountTest.php b/tests/PayPal/Test/Api/BankAccountTest.php index 8e21719f..22f0c906 100644 --- a/tests/PayPal/Test/Api/BankAccountTest.php +++ b/tests/PayPal/Test/Api/BankAccountTest.php @@ -13,17 +13,15 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object BankAccount - * * @return string */ public static function getJson() { - return '{"id":"TestSample","account_number":"TestSample","account_number_type":"TestSample","routing_number":"TestSample","account_type":"TestSample","account_name":"TestSample","check_type":"TestSample","auth_type":"TestSample","auth_capture_timestamp":"TestSample","bank_name":"TestSample","country_code":"TestSample","first_name":"TestSample","last_name":"TestSample","birth_date":"TestSample","billing_address":' . AddressTest::getJson() . ',"state":"TestSample","confirmation_status":"TestSample","payer_id":"TestSample","external_customer_id":"TestSample","merchant_id":"TestSample","create_time":"TestSample","update_time":"TestSample","valid_until":"TestSample","links":' . LinksTest::getJson() . '}'; + return '{"id":"TestSample","account_number":"TestSample","account_number_type":"TestSample","routing_number":"TestSample","account_type":"TestSample","account_name":"TestSample","check_type":"TestSample","auth_type":"TestSample","auth_capture_timestamp":"TestSample","bank_name":"TestSample","country_code":"TestSample","first_name":"TestSample","last_name":"TestSample","birth_date":"TestSample","billing_address":' .AddressTest::getJson() . ',"state":"TestSample","confirmation_status":"TestSample","payer_id":"TestSample","external_customer_id":"TestSample","merchant_id":"TestSample","create_time":"TestSample","update_time":"TestSample","valid_until":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return BankAccount */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return BankAccount */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/BankTokenTest.php b/tests/PayPal/Test/Api/BankTokenTest.php index f0a3206a..3b6e4f2c 100644 --- a/tests/PayPal/Test/Api/BankTokenTest.php +++ b/tests/PayPal/Test/Api/BankTokenTest.php @@ -13,7 +13,6 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object BankToken - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return BankToken */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return BankToken */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/CaptureTest.php b/tests/PayPal/Test/Api/CaptureTest.php index 0313a2d7..0314c82e 100644 --- a/tests/PayPal/Test/Api/CaptureTest.php +++ b/tests/PayPal/Test/Api/CaptureTest.php @@ -14,17 +14,15 @@ class CaptureTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Capture - * * @return string */ public static function getJson() { - return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","parent_payment":"TestSample","transaction_fee":' . CurrencyTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; + return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"is_final_capture":true,"state":"TestSample","reason_code":"TestSample","parent_payment":"TestSample","invoice_number":"TestSample","transaction_fee":' .CurrencyTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return Capture */ public static function getObject() @@ -35,7 +33,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Capture */ public function testSerializationDeserialization() @@ -46,7 +43,9 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getAmount()); $this->assertNotNull($obj->getIsFinalCapture()); $this->assertNotNull($obj->getState()); + $this->assertNotNull($obj->getReasonCode()); $this->assertNotNull($obj->getParentPayment()); + $this->assertNotNull($obj->getInvoiceNumber()); $this->assertNotNull($obj->getTransactionFee()); $this->assertNotNull($obj->getCreateTime()); $this->assertNotNull($obj->getUpdateTime()); @@ -65,7 +64,9 @@ public function testGetters($obj) $this->assertEquals($obj->getAmount(), AmountTest::getObject()); $this->assertEquals($obj->getIsFinalCapture(), true); $this->assertEquals($obj->getState(), "TestSample"); + $this->assertEquals($obj->getReasonCode(), "TestSample"); $this->assertEquals($obj->getParentPayment(), "TestSample"); + $this->assertEquals($obj->getInvoiceNumber(), "TestSample"); $this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject()); $this->assertEquals($obj->getCreateTime(), "TestSample"); $this->assertEquals($obj->getUpdateTime(), "TestSample"); @@ -85,13 +86,12 @@ public function testGet($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - CaptureTest::getJson() + CaptureTest::getJson() )); $result = $obj->get("captureId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Capture $obj @@ -117,8 +117,8 @@ public function mockProvider() { $obj = self::getObject(); $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); return array( array($obj, $mockApiContext), array($obj, null) diff --git a/tests/PayPal/Test/Api/CartBaseTest.php b/tests/PayPal/Test/Api/CartBaseTest.php index e2e2037f..cb4cf2e6 100644 --- a/tests/PayPal/Test/Api/CartBaseTest.php +++ b/tests/PayPal/Test/Api/CartBaseTest.php @@ -2,6 +2,7 @@ namespace PayPal\Test\Api; +use PayPal\Common\PayPalModel; use PayPal\Api\CartBase; /** @@ -13,17 +14,15 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object CartBase - * * @return string */ public static function getJson() { - return '{"reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' . PaymentOptionsTest::getJson() . ',"item_list":' . ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' . ExternalFundingTest::getJson() . '}'; + return '{"reference_id":"TestSample","amount":' .AmountTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","soft_descriptor_city":"TestSample","payment_options":' .PaymentOptionsTest::getJson() . ',"item_list":' .ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com","external_funding":' .ExternalFundingTest::getJson() . ',"type":"TestSample"}'; } /** * Gets Object Instance with Json data filled in - * * @return CartBase */ public static function getObject() @@ -34,7 +33,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return CartBase */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/CreditCardTest.php b/tests/PayPal/Test/Api/CreditCardTest.php index 681ed1df..3088f5c7 100644 --- a/tests/PayPal/Test/Api/CreditCardTest.php +++ b/tests/PayPal/Test/Api/CreditCardTest.php @@ -23,7 +23,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return CreditCard */ public static function getObject() diff --git a/tests/PayPal/Test/Api/DetailedRefundTest.php b/tests/PayPal/Test/Api/DetailedRefundTest.php new file mode 100644 index 00000000..73308d70 --- /dev/null +++ b/tests/PayPal/Test/Api/DetailedRefundTest.php @@ -0,0 +1,68 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getCustom()); + $this->assertNotNull($obj->getInvoiceNumber()); + $this->assertNotNull($obj->getRefundToPayer()); + $this->assertNotNull($obj->getRefundToExternalFunding()); + $this->assertNotNull($obj->getRefundFromTransactionFee()); + $this->assertNotNull($obj->getRefundFromReceivedAmount()); + $this->assertNotNull($obj->getTotalRefundedAmount()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param DetailedRefund $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getCustom(), "TestSample"); + $this->assertEquals($obj->getInvoiceNumber(), "TestSample"); + $this->assertEquals($obj->getRefundToPayer(), CurrencyTest::getObject()); + $this->assertEquals($obj->getRefundToExternalFunding(), ExternalFundingTest::getObject()); + $this->assertEquals($obj->getRefundFromTransactionFee(), CurrencyTest::getObject()); + $this->assertEquals($obj->getRefundFromReceivedAmount(), CurrencyTest::getObject()); + $this->assertEquals($obj->getTotalRefundedAmount(), CurrencyTest::getObject()); + } + + +} diff --git a/tests/PayPal/Test/Api/ErrorTest.php b/tests/PayPal/Test/Api/ErrorTest.php index c20a5848..b104e8bd 100644 --- a/tests/PayPal/Test/Api/ErrorTest.php +++ b/tests/PayPal/Test/Api/ErrorTest.php @@ -23,7 +23,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Error */ public static function getObject() @@ -34,7 +33,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Error */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/ExtendedBankAccountTest.php b/tests/PayPal/Test/Api/ExtendedBankAccountTest.php index edb427d9..98411af9 100644 --- a/tests/PayPal/Test/Api/ExtendedBankAccountTest.php +++ b/tests/PayPal/Test/Api/ExtendedBankAccountTest.php @@ -13,7 +13,6 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ExtendedBankAccount - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return ExtendedBankAccount */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return ExtendedBankAccount */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/FmfDetailsTest.php b/tests/PayPal/Test/Api/FmfDetailsTest.php index 1a06b7bf..9bfee967 100644 --- a/tests/PayPal/Test/Api/FmfDetailsTest.php +++ b/tests/PayPal/Test/Api/FmfDetailsTest.php @@ -13,7 +13,6 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FmfDetails - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return FmfDetails */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return FmfDetails */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/FundingDetailTest.php b/tests/PayPal/Test/Api/FundingDetailTest.php index 09600730..84226149 100644 --- a/tests/PayPal/Test/Api/FundingDetailTest.php +++ b/tests/PayPal/Test/Api/FundingDetailTest.php @@ -13,7 +13,6 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingDetail - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return FundingDetail */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return FundingDetail */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/FundingInstrumentTest.php b/tests/PayPal/Test/Api/FundingInstrumentTest.php index 401113ad..b09a282e 100644 --- a/tests/PayPal/Test/Api/FundingInstrumentTest.php +++ b/tests/PayPal/Test/Api/FundingInstrumentTest.php @@ -13,7 +13,6 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingInstrument - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return FundingInstrument */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return FundingInstrument */ public function testSerializationDeserialization() @@ -53,7 +50,6 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getCarrierAccount()); $this->assertNotNull($obj->getPrivateLabelCard()); $this->assertNotNull($obj->getBilling()); - $this->assertNotNull($obj->getAlternatePayment()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -76,6 +72,5 @@ public function testGetters($obj) $this->assertEquals($obj->getCarrierAccount(), CarrierAccountTest::getObject()); $this->assertEquals($obj->getPrivateLabelCard(), PrivateLabelCardTest::getObject()); $this->assertEquals($obj->getBilling(), BillingTest::getObject()); - $this->assertEquals($obj->getAlternatePayment(), AlternatePaymentTest::getObject()); } } diff --git a/tests/PayPal/Test/Api/FundingOptionTest.php b/tests/PayPal/Test/Api/FundingOptionTest.php index 39182500..556bbee3 100644 --- a/tests/PayPal/Test/Api/FundingOptionTest.php +++ b/tests/PayPal/Test/Api/FundingOptionTest.php @@ -13,7 +13,6 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingOption - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return FundingOption */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return FundingOption */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/FundingSourceTest.php b/tests/PayPal/Test/Api/FundingSourceTest.php index 9f0756d1..6954dfe7 100644 --- a/tests/PayPal/Test/Api/FundingSourceTest.php +++ b/tests/PayPal/Test/Api/FundingSourceTest.php @@ -13,17 +13,15 @@ class FundingSourceTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingSource - * * @return string */ public static function getJson() { - return '{"funding_mode":"TestSample","funding_instrument_type":"TestSample","soft_descriptor":"TestSample","amount":' . CurrencyTest::getJson() . ',"legal_text":"TestSample","funding_detail":' . FundingDetailTest::getJson() . ',"additional_text":"TestSample","extends":' . FundingInstrumentTest::getJson() . ',"links":' . LinksTest::getJson() . '}'; + return '{"funding_mode":"TestSample","funding_instrument_type":"TestSample","soft_descriptor":"TestSample","amount":' .CurrencyTest::getJson() . ',"negative_balance_amount":' .CurrencyTest::getJson() . ',"legal_text":"TestSample","terms":"TestSample","funding_detail":' .FundingDetailTest::getJson() . ',"additional_text":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return FundingSource */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return FundingSource */ public function testSerializationDeserialization() @@ -45,10 +42,10 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getFundingInstrumentType()); $this->assertNotNull($obj->getSoftDescriptor()); $this->assertNotNull($obj->getAmount()); + $this->assertNotNull($obj->getNegativeBalanceAmount()); $this->assertNotNull($obj->getLegalText()); $this->assertNotNull($obj->getFundingDetail()); $this->assertNotNull($obj->getAdditionalText()); - $this->assertNotNull($obj->getExtends()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -64,10 +61,10 @@ public function testGetters($obj) $this->assertEquals($obj->getFundingInstrumentType(), "TestSample"); $this->assertEquals($obj->getSoftDescriptor(), "TestSample"); $this->assertEquals($obj->getAmount(), CurrencyTest::getObject()); + $this->assertEquals($obj->getNegativeBalanceAmount(), CurrencyTest::getObject()); $this->assertEquals($obj->getLegalText(), "TestSample"); $this->assertEquals($obj->getFundingDetail(), FundingDetailTest::getObject()); $this->assertEquals($obj->getAdditionalText(), "TestSample"); - $this->assertEquals($obj->getExtends(), FundingInstrumentTest::getObject()); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } } diff --git a/tests/PayPal/Test/Api/IncentiveTest.php b/tests/PayPal/Test/Api/IncentiveTest.php index cfe3cbab..12cbd04f 100644 --- a/tests/PayPal/Test/Api/IncentiveTest.php +++ b/tests/PayPal/Test/Api/IncentiveTest.php @@ -13,7 +13,6 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Incentive - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Incentive */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Incentive */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/InstallmentInfoTest.php b/tests/PayPal/Test/Api/InstallmentInfoTest.php index c8192293..ed0f399f 100644 --- a/tests/PayPal/Test/Api/InstallmentInfoTest.php +++ b/tests/PayPal/Test/Api/InstallmentInfoTest.php @@ -13,7 +13,6 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object InstallmentInfo - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return InstallmentInfo */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return InstallmentInfo */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/InstallmentOptionTest.php b/tests/PayPal/Test/Api/InstallmentOptionTest.php index 9c0a4133..95963e73 100644 --- a/tests/PayPal/Test/Api/InstallmentOptionTest.php +++ b/tests/PayPal/Test/Api/InstallmentOptionTest.php @@ -13,7 +13,6 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object InstallmentOption - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return InstallmentOption */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return InstallmentOption */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/ItemListTest.php b/tests/PayPal/Test/Api/ItemListTest.php index 0099d940..498bfde0 100644 --- a/tests/PayPal/Test/Api/ItemListTest.php +++ b/tests/PayPal/Test/Api/ItemListTest.php @@ -13,7 +13,6 @@ class ItemListTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ItemList - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return ItemList */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return ItemList */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/ItemTest.php b/tests/PayPal/Test/Api/ItemTest.php index ae46b9d5..ded71668 100644 --- a/tests/PayPal/Test/Api/ItemTest.php +++ b/tests/PayPal/Test/Api/ItemTest.php @@ -13,7 +13,6 @@ class ItemTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Item - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Item */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Item */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/MeasurementTest.php b/tests/PayPal/Test/Api/MeasurementTest.php index dd23b680..5a0bf1fd 100644 --- a/tests/PayPal/Test/Api/MeasurementTest.php +++ b/tests/PayPal/Test/Api/MeasurementTest.php @@ -13,7 +13,6 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Measurement - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Measurement */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Measurement */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/NameValuePairTest.php b/tests/PayPal/Test/Api/NameValuePairTest.php index 8fd0d50b..a6100a25 100644 --- a/tests/PayPal/Test/Api/NameValuePairTest.php +++ b/tests/PayPal/Test/Api/NameValuePairTest.php @@ -13,7 +13,6 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object NameValuePair - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return NameValuePair */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return NameValuePair */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/OrderTest.php b/tests/PayPal/Test/Api/OrderTest.php index 5bdc9a57..e917d809 100644 --- a/tests/PayPal/Test/Api/OrderTest.php +++ b/tests/PayPal/Test/Api/OrderTest.php @@ -14,17 +14,15 @@ class OrderTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Order - * * @return string */ public static function getJson() { - return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","parent_payment":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; + return '{"id":"TestSample","reference_id":"TestSample","amount":' .AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","pending_reason":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","parent_payment":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return Order */ public static function getObject() @@ -35,7 +33,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Order */ public function testSerializationDeserialization() @@ -43,7 +40,7 @@ public function testSerializationDeserialization() $obj = new Order(self::getJson()); $this->assertNotNull($obj); $this->assertNotNull($obj->getId()); - $this->assertNotNull($obj->getPurchaseUnitReferenceId()); + $this->assertNotNull($obj->getReferenceId()); $this->assertNotNull($obj->getAmount()); $this->assertNotNull($obj->getPaymentMode()); $this->assertNotNull($obj->getState()); @@ -67,7 +64,7 @@ public function testSerializationDeserialization() public function testGetters($obj) { $this->assertEquals($obj->getId(), "TestSample"); - $this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample"); + $this->assertEquals($obj->getReferenceId(), "TestSample"); $this->assertEquals($obj->getAmount(), AmountTest::getObject()); $this->assertEquals($obj->getPaymentMode(), "TestSample"); $this->assertEquals($obj->getState(), "TestSample"); @@ -95,13 +92,12 @@ public function testGet($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - OrderTest::getJson() + OrderTest::getJson() )); $result = $obj->get("orderId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Order $obj @@ -115,14 +111,13 @@ public function testCapture($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - CaptureTest::getJson() + CaptureTest::getJson() )); $capture = CaptureTest::getObject(); $result = $obj->capture($capture, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Order $obj @@ -136,13 +131,12 @@ public function testVoid($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - self::getJson() + self::getJson() )); $result = $obj->void($mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Order $obj @@ -156,7 +150,7 @@ public function testAuthorize($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - AuthorizationTest::getJson() + AuthorizationTest::getJson() )); $authorization = new Authorization(); @@ -168,8 +162,8 @@ public function mockProvider() { $obj = self::getObject(); $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); return array( array($obj, $mockApiContext), array($obj, null) diff --git a/tests/PayPal/Test/Api/PayeeTest.php b/tests/PayPal/Test/Api/PayeeTest.php index f951a9c5..cce2e740 100644 --- a/tests/PayPal/Test/Api/PayeeTest.php +++ b/tests/PayPal/Test/Api/PayeeTest.php @@ -13,17 +13,15 @@ class PayeeTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Payee - * * @return string */ public static function getJson() { - return '{"email":"TestSample","merchant_id":"TestSample","first_name":"TestSample","last_name":"TestSample","account_number":"TestSample","phone":' . PhoneTest::getJson() . '}'; + return '{"email":"TestSample","merchant_id":"TestSample","first_name":"TestSample","last_name":"TestSample","account_number":"TestSample","phone":' .PhoneTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return Payee */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Payee */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/PayerInfoTest.php b/tests/PayPal/Test/Api/PayerInfoTest.php index f8b17edf..18b9a818 100644 --- a/tests/PayPal/Test/Api/PayerInfoTest.php +++ b/tests/PayPal/Test/Api/PayerInfoTest.php @@ -13,17 +13,15 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PayerInfo - * * @return string */ public static function getJson() { - return '{"email":"TestSample","external_remember_me_id":"TestSample","account_number":"TestSample","salutation":"TestSample","first_name":"TestSample","middle_name":"TestSample","last_name":"TestSample","suffix":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","country_code":"TestSample","billing_address":' . AddressTest::getJson() . ',"shipping_address":' . ShippingAddressTest::getJson() . '}'; + return '{"email":"TestSample","external_remember_me_id":"TestSample","buyer_account_number":"TestSample","salutation":"TestSample","first_name":"TestSample","middle_name":"TestSample","last_name":"TestSample","suffix":"TestSample","payer_id":"TestSample","phone":"TestSample","phone_type":"TestSample","birth_date":"TestSample","tax_id":"TestSample","tax_id_type":"TestSample","country_code":"TestSample","billing_address":' .AddressTest::getJson() . ',"shipping_address":' .ShippingAddressTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return PayerInfo */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return PayerInfo */ public function testSerializationDeserialization() @@ -43,7 +40,7 @@ public function testSerializationDeserialization() $this->assertNotNull($obj); $this->assertNotNull($obj->getEmail()); $this->assertNotNull($obj->getExternalRememberMeId()); - $this->assertNotNull($obj->getAccountNumber()); + $this->assertNotNull($obj->getBuyerAccountNumber()); $this->assertNotNull($obj->getSalutation()); $this->assertNotNull($obj->getFirstName()); $this->assertNotNull($obj->getMiddleName()); @@ -70,7 +67,7 @@ public function testGetters($obj) { $this->assertEquals($obj->getEmail(), "TestSample"); $this->assertEquals($obj->getExternalRememberMeId(), "TestSample"); - $this->assertEquals($obj->getAccountNumber(), "TestSample"); + $this->assertEquals($obj->getBuyerAccountNumber(), "TestSample"); $this->assertEquals($obj->getSalutation(), "TestSample"); $this->assertEquals($obj->getFirstName(), "TestSample"); $this->assertEquals($obj->getMiddleName(), "TestSample"); diff --git a/tests/PayPal/Test/Api/PayerTest.php b/tests/PayPal/Test/Api/PayerTest.php index de7e272b..7e29d94c 100644 --- a/tests/PayPal/Test/Api/PayerTest.php +++ b/tests/PayPal/Test/Api/PayerTest.php @@ -13,17 +13,15 @@ class PayerTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Payer - * * @return string */ public static function getJson() { - return '{"payment_method":"TestSample","status":"TestSample","account_type":"TestSample","account_age":"TestSample","funding_instruments":' . FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","funding_option":' . FundingOptionTest::getJson() . ',"related_funding_option":' . FundingOptionTest::getJson() . ',"payer_info":' . PayerInfoTest::getJson() . '}'; + return '{"payment_method":"TestSample","status":"TestSample","account_type":"TestSample","account_age":"TestSample","funding_instruments":' .FundingInstrumentTest::getJson() . ',"funding_option_id":"TestSample","funding_option":' .FundingOptionTest::getJson() . ',"external_selected_funding_instrument_type":"TestSample","related_funding_option":' .FundingOptionTest::getJson() . ',"payer_info":' .PayerInfoTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return Payer */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Payer */ public function testSerializationDeserialization() @@ -48,6 +45,7 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getFundingInstruments()); $this->assertNotNull($obj->getFundingOptionId()); $this->assertNotNull($obj->getFundingOption()); + $this->assertNotNull($obj->getExternalSelectedFundingInstrumentType()); $this->assertNotNull($obj->getRelatedFundingOption()); $this->assertNotNull($obj->getPayerInfo()); $this->assertEquals(self::getJson(), $obj->toJson()); @@ -67,6 +65,7 @@ public function testGetters($obj) $this->assertEquals($obj->getFundingInstruments(), FundingInstrumentTest::getObject()); $this->assertEquals($obj->getFundingOptionId(), "TestSample"); $this->assertEquals($obj->getFundingOption(), FundingOptionTest::getObject()); + $this->assertEquals($obj->getExternalSelectedFundingInstrumentType(), "TestSample"); $this->assertEquals($obj->getRelatedFundingOption(), FundingOptionTest::getObject()); $this->assertEquals($obj->getPayerInfo(), PayerInfoTest::getObject()); } diff --git a/tests/PayPal/Test/Api/PaymentCardTest.php b/tests/PayPal/Test/Api/PaymentCardTest.php index fae01aba..86cce222 100644 --- a/tests/PayPal/Test/Api/PaymentCardTest.php +++ b/tests/PayPal/Test/Api/PaymentCardTest.php @@ -13,17 +13,15 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentCard - * * @return string */ public static function getJson() { - return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"start_month":"TestSample","start_year":"TestSample","cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_country":"TestSample","billing_address":' . AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","valid_until":"TestSample","issue_number":"TestSample","links":' . LinksTest::getJson() . '}'; + return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":"123","expire_year":"123","start_month":"TestSample","start_year":"TestSample","cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_country":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","status":"TestSample","card_product_class":"TestSample","valid_until":"TestSample","issue_number":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return PaymentCard */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return PaymentCard */ public function testSerializationDeserialization() @@ -55,6 +52,7 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getBillingAddress()); $this->assertNotNull($obj->getExternalCustomerId()); $this->assertNotNull($obj->getStatus()); + $this->assertNotNull($obj->getCardProductClass()); $this->assertNotNull($obj->getValidUntil()); $this->assertNotNull($obj->getIssueNumber()); $this->assertNotNull($obj->getLinks()); @@ -71,8 +69,8 @@ public function testGetters($obj) $this->assertEquals($obj->getId(), "TestSample"); $this->assertEquals($obj->getNumber(), "TestSample"); $this->assertEquals($obj->getType(), "TestSample"); - $this->assertEquals($obj->getExpireMonth(), 123); - $this->assertEquals($obj->getExpireYear(), 123); + $this->assertEquals($obj->getExpireMonth(), "TestSample"); + $this->assertEquals($obj->getExpireYear(), "TestSample"); $this->assertEquals($obj->getStartMonth(), "TestSample"); $this->assertEquals($obj->getStartYear(), "TestSample"); $this->assertEquals($obj->getCvv2(), "TestSample"); @@ -82,6 +80,7 @@ public function testGetters($obj) $this->assertEquals($obj->getBillingAddress(), AddressTest::getObject()); $this->assertEquals($obj->getExternalCustomerId(), "TestSample"); $this->assertEquals($obj->getStatus(), "TestSample"); + $this->assertEquals($obj->getCardProductClass(), "TestSample"); $this->assertEquals($obj->getValidUntil(), "TestSample"); $this->assertEquals($obj->getIssueNumber(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); diff --git a/tests/PayPal/Test/Api/PaymentExecutionTest.php b/tests/PayPal/Test/Api/PaymentExecutionTest.php index b1823446..71b15514 100644 --- a/tests/PayPal/Test/Api/PaymentExecutionTest.php +++ b/tests/PayPal/Test/Api/PaymentExecutionTest.php @@ -13,7 +13,6 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentExecution - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return PaymentExecution */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return PaymentExecution */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/PaymentHistoryTest.php b/tests/PayPal/Test/Api/PaymentHistoryTest.php index ff2be382..9ad748a7 100644 --- a/tests/PayPal/Test/Api/PaymentHistoryTest.php +++ b/tests/PayPal/Test/Api/PaymentHistoryTest.php @@ -13,7 +13,6 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentHistory - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return PaymentHistory */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return PaymentHistory */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/PaymentOptionsTest.php b/tests/PayPal/Test/Api/PaymentOptionsTest.php index 60e852ae..31eb9f07 100644 --- a/tests/PayPal/Test/Api/PaymentOptionsTest.php +++ b/tests/PayPal/Test/Api/PaymentOptionsTest.php @@ -13,7 +13,6 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentOptions - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return PaymentOptions */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return PaymentOptions */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/PaymentTest.php b/tests/PayPal/Test/Api/PaymentTest.php index 2f6d88e7..e74f0936 100644 --- a/tests/PayPal/Test/Api/PaymentTest.php +++ b/tests/PayPal/Test/Api/PaymentTest.php @@ -2,7 +2,6 @@ namespace PayPal\Test\Api; -use PayPal\Api\object; use PayPal\Api\Payment; /** @@ -14,7 +13,6 @@ class PaymentTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Payment - * * @return string */ public static function getJson() @@ -24,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Payment */ public static function getObject() @@ -35,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Payment */ public function testSerializationDeserialization() @@ -105,13 +101,12 @@ public function testCreate($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - self::getJson() + self::getJson() )); $result = $obj->create($mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Payment $obj @@ -125,13 +120,12 @@ public function testGet($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - PaymentTest::getJson() + PaymentTest::getJson() )); $result = $obj->get("paymentId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Payment $obj @@ -152,7 +146,6 @@ public function testUpdate($obj, $mockApiContext) $result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Payment $obj @@ -166,14 +159,13 @@ public function testExecute($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - self::getJson() + self::getJson() )); $paymentExecution = PaymentExecutionTest::getObject(); $result = $obj->execute($paymentExecution, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Payment $obj @@ -187,7 +179,7 @@ public function testList($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - PaymentHistoryTest::getJson() + PaymentHistoryTest::getJson() )); $params = array(); @@ -199,8 +191,8 @@ public function mockProvider() { $obj = self::getObject(); $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); return array( array($obj, $mockApiContext), array($obj, null) diff --git a/tests/PayPal/Test/Api/PhoneTest.php b/tests/PayPal/Test/Api/PhoneTest.php index 185f8add..258f3277 100644 --- a/tests/PayPal/Test/Api/PhoneTest.php +++ b/tests/PayPal/Test/Api/PhoneTest.php @@ -13,7 +13,6 @@ class PhoneTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Phone - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Phone */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Phone */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php b/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php index 04823221..93c481cd 100644 --- a/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php +++ b/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php @@ -13,7 +13,6 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object RecipientBankingInstruction - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return RecipientBankingInstruction */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return RecipientBankingInstruction */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/RedirectUrlsTest.php b/tests/PayPal/Test/Api/RedirectUrlsTest.php index 7abf56c0..890312c2 100644 --- a/tests/PayPal/Test/Api/RedirectUrlsTest.php +++ b/tests/PayPal/Test/Api/RedirectUrlsTest.php @@ -13,7 +13,6 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object RedirectUrls - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return RedirectUrls */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return RedirectUrls */ public function testSerializationDeserialization() @@ -66,7 +63,6 @@ public function testUrlValidationForReturnUrl() $obj = new RedirectUrls(); $obj->setReturnUrl(null); } - /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage CancelUrl is not a fully qualified URL diff --git a/tests/PayPal/Test/Api/RefundRequestTest.php b/tests/PayPal/Test/Api/RefundRequestTest.php new file mode 100644 index 00000000..ba446768 --- /dev/null +++ b/tests/PayPal/Test/Api/RefundRequestTest.php @@ -0,0 +1,66 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getAmount()); + $this->assertNotNull($obj->getDescription()); + $this->assertNotNull($obj->getRefundSource()); + $this->assertNotNull($obj->getReason()); + $this->assertNotNull($obj->getInvoiceNumber()); + $this->assertNotNull($obj->getRefundAdvice()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param RefundRequest $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getAmount(), AmountTest::getObject()); + $this->assertEquals($obj->getDescription(), "TestSample"); + $this->assertEquals($obj->getRefundSource(), "TestSample"); + $this->assertEquals($obj->getReason(), "TestSample"); + $this->assertEquals($obj->getInvoiceNumber(), "TestSample"); + $this->assertEquals($obj->getRefundAdvice(), true); + } + + +} diff --git a/tests/PayPal/Test/Api/RefundTest.php b/tests/PayPal/Test/Api/RefundTest.php index 4edc7fb4..c7a5d8fe 100644 --- a/tests/PayPal/Test/Api/RefundTest.php +++ b/tests/PayPal/Test/Api/RefundTest.php @@ -13,17 +13,15 @@ class RefundTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Refund - * * @return string */ public static function getJson() { - return '{"id":"TestSample","amount":' . AmountTest::getJson() . ',"state":"TestSample","reason":"TestSample","sale_id":"TestSample","capture_id":"TestSample","parent_payment":"TestSample","description":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; + return '{"id":"TestSample","amount":' .AmountTest::getJson() . ',"state":"TestSample","reason":"TestSample","invoice_number":"TestSample","sale_id":"TestSample","capture_id":"TestSample","parent_payment":"TestSample","description":"TestSample","create_time":"TestSample","update_time":"TestSample","reason_code":"TestSample","links":' .LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in - * * @return Refund */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Refund */ public function testSerializationDeserialization() @@ -45,12 +42,14 @@ public function testSerializationDeserialization() $this->assertNotNull($obj->getAmount()); $this->assertNotNull($obj->getState()); $this->assertNotNull($obj->getReason()); + $this->assertNotNull($obj->getInvoiceNumber()); $this->assertNotNull($obj->getSaleId()); $this->assertNotNull($obj->getCaptureId()); $this->assertNotNull($obj->getParentPayment()); $this->assertNotNull($obj->getDescription()); $this->assertNotNull($obj->getCreateTime()); $this->assertNotNull($obj->getUpdateTime()); + $this->assertNotNull($obj->getReasonCode()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -66,12 +65,14 @@ public function testGetters($obj) $this->assertEquals($obj->getAmount(), AmountTest::getObject()); $this->assertEquals($obj->getState(), "TestSample"); $this->assertEquals($obj->getReason(), "TestSample"); + $this->assertEquals($obj->getInvoiceNumber(), "TestSample"); $this->assertEquals($obj->getSaleId(), "TestSample"); $this->assertEquals($obj->getCaptureId(), "TestSample"); $this->assertEquals($obj->getParentPayment(), "TestSample"); $this->assertEquals($obj->getDescription(), "TestSample"); $this->assertEquals($obj->getCreateTime(), "TestSample"); $this->assertEquals($obj->getUpdateTime(), "TestSample"); + $this->assertEquals($obj->getReasonCode(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } @@ -88,7 +89,7 @@ public function testGet($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - RefundTest::getJson() + RefundTest::getJson() )); $result = $obj->get("refundId", $mockApiContext, $mockPPRestCall); @@ -99,8 +100,8 @@ public function mockProvider() { $obj = self::getObject(); $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); + ->disableOriginalConstructor() + ->getMock(); return array( array($obj, $mockApiContext), array($obj, null) diff --git a/tests/PayPal/Test/Api/RelatedResourcesTest.php b/tests/PayPal/Test/Api/RelatedResourcesTest.php index 3b97e7f2..e7ad6847 100644 --- a/tests/PayPal/Test/Api/RelatedResourcesTest.php +++ b/tests/PayPal/Test/Api/RelatedResourcesTest.php @@ -13,7 +13,6 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object RelatedResources - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return RelatedResources */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return RelatedResources */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/SaleTest.php b/tests/PayPal/Test/Api/SaleTest.php index 2a61512b..3afb3e6f 100644 --- a/tests/PayPal/Test/Api/SaleTest.php +++ b/tests/PayPal/Test/Api/SaleTest.php @@ -13,7 +13,6 @@ class SaleTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Sale - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Sale */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Sale */ public function testSerializationDeserialization() @@ -110,13 +107,12 @@ public function testGet($obj, $mockApiContext) $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - SaleTest::getJson() + SaleTest::getJson() )); $result = $obj->get("saleId", $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } - /** * @dataProvider mockProvider * @param Sale $obj diff --git a/tests/PayPal/Test/Api/ShippingAddressTest.php b/tests/PayPal/Test/Api/ShippingAddressTest.php index 0247664c..9fa01a42 100644 --- a/tests/PayPal/Test/Api/ShippingAddressTest.php +++ b/tests/PayPal/Test/Api/ShippingAddressTest.php @@ -13,7 +13,6 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ShippingAddress - * * @return string */ public static function getJson() @@ -23,7 +22,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return ShippingAddress */ public static function getObject() @@ -34,7 +32,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return ShippingAddress */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/TransactionTest.php b/tests/PayPal/Test/Api/TransactionTest.php index 93c09897..e5198377 100644 --- a/tests/PayPal/Test/Api/TransactionTest.php +++ b/tests/PayPal/Test/Api/TransactionTest.php @@ -23,7 +23,6 @@ public static function getJson() /** * Gets Object Instance with Json data filled in - * * @return Transaction */ public static function getObject() @@ -34,7 +33,6 @@ public static function getObject() /** * Tests for Serialization and Deserialization Issues - * * @return Transaction */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Functional/resources/PaymentsFunctionalTest/testCreate.json b/tests/PayPal/Test/Functional/resources/PaymentsFunctionalTest/testCreate.json index 313037be..46ddee68 100644 --- a/tests/PayPal/Test/Functional/resources/PaymentsFunctionalTest/testCreate.json +++ b/tests/PayPal/Test/Functional/resources/PaymentsFunctionalTest/testCreate.json @@ -23,8 +23,9 @@ "payment_method": "credit_card", "funding_instruments": [ { - "credit_card": { + "payment_card": { "number": "4160285494148633", + "billing_country": "US", "type": "visa", "expire_month": 11, "expire_year": 2018, From cbff55238d81bec11acc3a03e94b5bfe82deda44 Mon Sep 17 00:00:00 2001 From: jaypatel512 and sdcoffey Date: Thu, 27 Oct 2016 14:02:22 -0700 Subject: [PATCH 2/2] Update samples for 3rd Party Payments --- sample/doc/assets/behavior.js | 448 ++++++++++++++---- .../notifications/ValidateWebhookEvent.html | 45 +- sample/doc/payments/CreatePayment.html | 4 +- .../doc/payments/CreateThirdPartyPayment.html | 90 ++++ sample/doc/payments/RefundCapture.html | 13 +- sample/doc/sale/RefundSale.html | 11 +- sample/index.php | 11 + sample/payments/CreateThirdPartyPayment.php | 133 ++++++ sample/payments/RefundCapture.php | 11 +- sample/sale/RefundSale.php | 11 +- 10 files changed, 645 insertions(+), 132 deletions(-) create mode 100644 sample/doc/payments/CreateThirdPartyPayment.html create mode 100644 sample/payments/CreateThirdPartyPayment.php diff --git a/sample/doc/assets/behavior.js b/sample/doc/assets/behavior.js index bbccc3fb..6b2f8402 100644 --- a/sample/doc/assets/behavior.js +++ b/sample/doc/assets/behavior.js @@ -49,7 +49,29 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "billing/CreateBillingAgreementWithCreditCard", "title": "CreateBillingAgreementWithCreditCard" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Create Billing Agreement with Credit Card as Payment Source", + "slug": "create-billing-agreement-with-credit-card-as-payment-source" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Create Agreement", + "slug": "create-agreement" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -403,8 +425,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "invoice-templates/GetAllInvoiceTemplates", "title": "GetAllInvoiceTemplates" }, - "depth": 2, - "outline": [] + "depth": 2 }, { "type": "file", "data": { @@ -422,29 +443,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "invoice-templates/GetInvoiceTemplate", "title": "GetInvoiceTemplate" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 1, - "title": "Retrieve Invoice Template Sample", - "slug": "retrieve-invoice-template-sample" - }, - "depth": 1, - "children": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Retrieve Invoice Template", - "slug": "retrieve-invoice-template" - }, - "depth": 3 - } - ] - } - ] + "depth": 2 }, { "type": "file", "data": { @@ -724,53 +723,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "invoice/UpdateInvoice", "title": "UpdateInvoice" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 1, - "title": "Update Invoice Sample", - "slug": "update-invoice-sample" - }, - "depth": 1, - "children": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Update Invoice", - "slug": "update-invoice" - }, - "depth": 3 - }, { - "type": "heading", - "data": { - "level": 3, - "title": "NOTE: These are the work-around added to the", - "slug": "note-these-are-the-work-around-added-to-the" - }, - "depth": 3 - }, { - "type": "heading", - "data": { - "level": 3, - "title": "Update Invoice", - "slug": "update-invoice" - }, - "depth": 3 - }, { - "type": "heading", - "data": { - "level": 3, - "title": "Retrieve Invoice", - "slug": "retrieve-invoice" - }, - "depth": 3 - } - ] - } - ] + "depth": 2 } ] }, { @@ -1024,7 +977,18 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "notifications/ValidateWebhookEvent", "title": "ValidateWebhookEvent" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Validate Webhook", + "slug": "validate-webhook" + }, + "depth": 1 + } + ] }, { "type": "file", "data": { @@ -1070,29 +1034,7 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payment-experience/CreateWebProfile", "title": "CreateWebProfile" }, - "depth": 2, - "outline": [ - { - "type": "heading", - "data": { - "level": 3, - "title": "Create Web Profile", - "slug": "create-web-profile" - }, - "depth": 3, - "children": [ - { - "type": "heading", - "data": { - "level": 4, - "title": "Payment Web experience profile resource", - "slug": "payment-web-experience-profile-resource" - }, - "depth": 4 - } - ] - } - ] + "depth": 2 }, { "type": "file", "data": { @@ -1228,7 +1170,29 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payments/AuthorizePayment", "title": "AuthorizePayment" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Authorize Payment", + "slug": "authorize-payment" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payment", + "slug": "create-payment" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1282,7 +1246,93 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payments/CreatePayment", "title": "CreatePayment" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "CreatePaymentSample", + "slug": "createpaymentsample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "PaymentCard", + "slug": "paymentcard" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "FundingInstrument", + "slug": "fundinginstrument" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Payer", + "slug": "payer" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Itemized information", + "slug": "itemized-information" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Additional payment details", + "slug": "additional-payment-details" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Amount", + "slug": "amount" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Transaction", + "slug": "transaction" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Payment", + "slug": "payment" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payment", + "slug": "create-payment" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1319,6 +1369,118 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "title": "CreatePaymentUsingSavedCard" }, "depth": 2 + }, { + "type": "file", + "data": { + "language": { + "nameMatchers": [{}, ".fbp"], + "pygmentsLexer": "php", + "singleLineComment": ["//"], + "ignorePrefix": "}", + "foldPrefix": "^", + "name": "PHP" + }, + "sourcePath": "/Users/scoffey/paypal/server_sdk/PayPal-PHP-SDK/sample/payments/CreateThirdPartyPayment.php", + "projectPath": "payments/CreateThirdPartyPayment.php", + "targetPath": "payments/CreateThirdPartyPayment", + "pageTitle": "payments/CreateThirdPartyPayment", + "title": "CreateThirdPartyPayment" + }, + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "CreatePaymentSample", + "slug": "createpaymentsample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "PaymentCard", + "slug": "paymentcard" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "FundingInstrument", + "slug": "fundinginstrument" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Payer", + "slug": "payer" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Itemized information", + "slug": "itemized-information" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Additional payment details", + "slug": "additional-payment-details" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Amount", + "slug": "amount" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Payee", + "slug": "payee" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Transaction", + "slug": "transaction" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Payment", + "slug": "payment" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Create Payment", + "slug": "create-payment" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1390,7 +1552,29 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payments/GetPayment", "title": "GetPayment" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "GetPaymentSample", + "slug": "getpaymentsample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Retrieve payment", + "slug": "retrieve-payment" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1588,7 +1772,29 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "payments/RefundCapture", "title": "RefundCapture" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Refund Capture Sample", + "slug": "refund-capture-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Refund", + "slug": "refund" + }, + "depth": 3 + } + ] + } + ] }, { "type": "file", "data": { @@ -1770,7 +1976,45 @@ f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3 "pageTitle": "sale/RefundSale", "title": "RefundSale" }, - "depth": 2 + "depth": 2, + "outline": [ + { + "type": "heading", + "data": { + "level": 1, + "title": "Sale Refund Sample", + "slug": "sale-refund-sample" + }, + "depth": 1, + "children": [ + { + "type": "heading", + "data": { + "level": 3, + "title": "Refund amount", + "slug": "refund-amount" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Refund object", + "slug": "refund-object" + }, + "depth": 3 + }, { + "type": "heading", + "data": { + "level": 3, + "title": "Sale", + "slug": "sale" + }, + "depth": 3 + } + ] + } + ] } ] }, { diff --git a/sample/doc/notifications/ValidateWebhookEvent.html b/sample/doc/notifications/ValidateWebhookEvent.html index 9cd58c29..1470979d 100644 --- a/sample/doc/notifications/ValidateWebhookEvent.html +++ b/sample/doc/notifications/ValidateWebhookEvent.html @@ -11,15 +11,46 @@ */ /** @var String $requestBody */ $requestBody = '{"id":"WH-9UG43882HX7271132-6E0871324L7949614","event_version":"1.0","create_time":"2016-09-21T22:00:45Z","resource_type":"sale","event_type":"PAYMENT.SALE.COMPLETED","summary":"Payment completed for $ 21.0 USD","resource":{"id":"80F85758S3080410K","state":"completed","amount":{"total":"21.00","currency":"USD","details":{"subtotal":"17.50","tax":"1.30","shipping":"2.20"}},"payment_mode":"INSTANT_TRANSFER","protection_eligibility":"ELIGIBLE","protection_eligibility_type":"ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE","transaction_fee":{"value":"0.91","currency":"USD"},"invoice_number":"57e3028db8d1b","custom":"","parent_payment":"PAY-7F371669SL612941HK7RQFDQ","create_time":"2016-09-21T21:59:02Z","update_time":"2016-09-21T22:00:06Z","links":[{"href":"https://api.sandbox.paypal.com/v1/payments/sale/80F85758S3080410K","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/payments/sale/80F85758S3080410K/refund","rel":"refund","method":"POST"},{"href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-7F371669SL612941HK7RQFDQ","rel":"parent_payment","method":"GET"}]},"links":[{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-9UG43882HX7271132-6E0871324L7949614","rel":"self","method":"GET"},{"href":"https://api.sandbox.paypal.com/v1/notifications/webhooks-events/WH-9UG43882HX7271132-6E0871324L7949614/resend","rel":"resend","method":"POST"}]}'; +/** +* Receive the entire body that you received from PayPal webhook. +* Just uncomment the below line to read the data from actual request. +*/ +/** @var String $bodyReceived */

$bodyReceived = file_get_contents('php://input');

+ $headers = array ( + 'Client-Pid' => '14910', + 'Cal-Poolstack' => 'amqunphttpdeliveryd:UNPHTTPDELIVERY*CalThreadId=0*TopLevelTxnStartTime=1579e71daf8*Host=slcsbamqunphttpdeliveryd3001', + 'Correlation-Id' => '958be65120106', + 'Host' => 'shiparound-dev.de', + 'User-Agent' => 'PayPal/AUHD-208.0-25552773', + 'Paypal-Auth-Algo' => 'SHA256withRSA', + 'Paypal-Cert-Url' => 'https://api.sandbox.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-a5cafa77', + 'Paypal-Auth-Version' => 'v2', + 'Paypal-Transmission-Sig' => 'eDOnWUj9FXOnr2naQnrdL7bhgejVSTwRbwbJ0kuk5wAtm2ZYkr7w5BSUDO7e5ZOsqLwN3sPn3RV85Jd9pjHuTlpuXDLYk+l5qiViPbaaC0tLV+8C/zbDjg2WCfvtf2NmFT8CHgPPQAByUqiiTY+RJZPPQC5np7j7WuxcegsJLeWStRAofsDLiSKrzYV3CKZYtNoNnRvYmSFMkYp/5vk4xGcQLeYNV1CC2PyqraZj8HGG6Y+KV4trhreV9VZDn+rPtLDZTbzUohie1LpEy31k2dg+1szpWaGYOz+MRb40U04oD7fD69vghCrDTYs5AsuFM2+WZtsMDmYGI0pxLjn2yw==', + 'Paypal-Transmission-Time' => '2016-09-21T22:00:46Z', + 'Paypal-Transmission-Id' => 'd938e770-8046-11e6-8103-6b62a8a99ac4', + 'Accept' => '*/*', +); -$signatureVerification = new VerifyWebhookSignature(); -$signatureVerification->setAuthAlgo("SHA256withRSA"); -$signatureVerification->setTransmissionId("d938e770-8046-11e6-8103-6b62a8a99ac4"); -$signatureVerification->setCertUrl("https://api.sandbox.paypal.com/v1/notifications/certs/CERT-360caa42-fca2a594-a5cafa77"); // todo: this isn't going to work -$signatureVerification->setWebhookId("9XL90610J3647323C"); -$signatureVerification->setTransmissionSig("eDOnWUj9FXOnr2naQnrdL7bhgejVSTwRbwbJ0kuk5wAtm2ZYkr7w5BSUDO7e5ZOsqLwN3sPn3RV85Jd9pjHuTlpuXDLYk+l5qiViPbaaC0tLV+8C/zbDjg2WCfvtf2NmFT8CHgPPQAByUqiiTY+RJZPPQC5np7j7WuxcegsJLeWStRAofsDLiSKrzYV3CKZYtNoNnRvYmSFMkYp/5vk4xGcQLeYNV1CC2PyqraZj8HGG6Y+KV4trhreV9VZDn+rPtLDZTbzUohie1LpEy31k2dg+1szpWaGYOz+MRb40U04oD7fD69vghCrDTYs5AsuFM2+WZtsMDmYGI0pxLjn2yw=="); -$signatureVerification->setTransmissionTime("2016-09-21T22:00:46Z"); +/** +* Receive HTTP headers that you received from PayPal webhook. +* Just uncomment the below line to read the data from actual request. +*/ +/** @var Array $headers */ +//$headers = getallheaders(); +/** +* In Documentions https://developer.paypal.com/docs/api/webhooks/#verify-webhook-signature_post +* All header keys as UPPERCASE, but I recive the header key as the example array, First letter as UPPERCASE +*/ +$headers = array_change_key_case($headers, CASE_UPPER); + +$signatureVerification = new VerifyWebhookSignature(); +$signatureVerification->setAuthAlgo($headers['PAYPAL-AUTH-ALGO']); +$signatureVerification->setTransmissionId($headers['PAYPAL-TRANSMISSION-ID']); +$signatureVerification->setCertUrl($headers['PAYPAL-CERT-URL']); +$signatureVerification->setWebhookId("9XL90610J3647323C"); // Note that the Webhook ID must be a currently valid Webhook that you created with your client ID/secret. +$signatureVerification->setTransmissionSig($headers['PAYPAL-TRANSMISSION-SIG']); +$signatureVerification->setTransmissionTime($headers['PAYPAL-TRANSMISSION-TIME']); $webhookEvent = new WebhookEvent(); $webhookEvent->fromJson($requestBody); diff --git a/sample/doc/payments/CreatePayment.html b/sample/doc/payments/CreatePayment.html index 1ba9d669..07208e1e 100644 --- a/sample/doc/payments/CreatePayment.html +++ b/sample/doc/payments/CreatePayment.html @@ -21,8 +21,8 @@ ->setExpireYear("2019") ->setCvv2("012") ->setFirstName("Joe") - ->setLastName("Shopper") - ->setBillingCountry("US");

FundingInstrument

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

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/doc/payments/CreateThirdPartyPayment.html b/sample/doc/payments/CreateThirdPartyPayment.html new file mode 100644 index 00000000..33de3917 --- /dev/null +++ b/sample/doc/payments/CreateThirdPartyPayment.html @@ -0,0 +1,90 @@ +payments/CreateThirdPartyPayment
payments/CreateThirdPartyPayment.php
<?php

CreatePaymentSample

+

This sample code demonstrate how you can process +a direct credit card payment. Please note that direct +credit card payment and related features using the +REST API is restricted in some countries. +API used: /v1/payments/payment

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

PaymentCard

+

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

$card = new PaymentCard(); +$card->setType("visa") + ->setNumber("4669424246660779") + ->setExpireMonth("11") + ->setExpireYear("2019") + ->setCvv2("012") + ->setFirstName("Joe") + ->setBillingCountry("US") + ->setLastName("Shopper");

FundingInstrument

+

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

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

Payer

+

A resource representing a Payer that funds a payment +For direct credit card payments, set payment method +to 'credit_card' and add an array of funding instruments.

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

Itemized information

+

(Optional) Lets you specify item wise +information

$item1 = new Item(); +$item1->setName('Ground Coffee 40 oz') + ->setDescription('Ground Coffee 40 oz') + ->setCurrency('USD') + ->setQuantity(1) + ->setTax(0.3) + ->setPrice(7.50); +$item2 = new Item(); +$item2->setName('Granola bars') + ->setDescription('Granola Bars with Peanuts') + ->setCurrency('USD') + ->setQuantity(5) + ->setTax(0.2) + ->setPrice(2); + +$itemList = new ItemList(); +$itemList->setItems(array($item1, $item2));

Additional payment details

+

Use this optional field to set additional +payment information such as tax, shipping +charges etc.

$details = new Details(); +$details->setShipping(1.2) + ->setTax(1.3) + ->setSubtotal(17.5);

Amount

+

Lets you specify a payment amount. +You can also specify additional details +such as shipping, tax.

$amount = new Amount(); +$amount->setCurrency("USD") + ->setTotal(20) + ->setDetails($details);

Payee

+

Specify a payee with that user's email or merchant id +Merchant Id can be found at https://www.paypal.com/businessprofile/settings/

$payee = new Payee(); +$payee->setEmail("stevendcoffey-facilitator@gmail.com");

Transaction

+

A transaction defines the contract of a +payment - what is the payment for and who +is fulfilling it.

$transaction = new Transaction(); +$transaction->setAmount($amount) + ->setItemList($itemList) + ->setDescription("Payment description") + ->setPayee($payee) + ->setInvoiceNumber(uniqid());

Payment

+

A Payment Resource; create one using +the above types and intent set to sale 'sale'

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

For Sample Purposes Only.

$request = clone $payment;

Create Payment

+

Create a payment by calling the payment->create() method +with a valid ApiContext (See bootstrap.php for more on ApiContext) +The return object contains the state.

try { + $payment->create($apiContext); +} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError('Create Payment Using Credit Card. If 500 Exception, try creating a new Credit Card using <a href="https://www.paypal-knowledge.com/infocenter/index?page=content&widgetview=true&id=FAQ1413">Step 4, on this link</a>, and using it.', 'Payment', null, $request, $ex); + exit(1); +}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult('Create Payment Using Credit Card', 'Payment', $payment->getId(), $request, $payment); + +return $payment;
diff --git a/sample/doc/payments/RefundCapture.html b/sample/doc/payments/RefundCapture.html index 0bb8a317..546dd9c8 100644 --- a/sample/doc/payments/RefundCapture.html +++ b/sample/doc/payments/RefundCapture.html @@ -5,15 +5,16 @@ $capture = require 'AuthorizationCapture.php'; use PayPal\Api\Capture; -use PayPal\Api\Refund;

Refund

+use PayPal\Api\Refund; +use PayPal\Api\RefundRequest;

Refund

Create a refund object indicating -refund amount and call the refund method

$refund = new Refund(); -$refund->setAmount($amt); +refund amount and call the refund method

$refundRequest = new RefundRequest(); +$refundRequest->setAmount($amt); try {

Create a new apiContext object so we send a new PayPal-Request-Id (idempotency) header for this resource

$apiContext = getApiContext($clientId, $clientSecret); - $captureRefund = $capture->refund($refund, $apiContext); -} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError("Refund Capture", "Capture", null, $refund, $ex); + $captureRefund = $capture->refundCapturedPayment($refundRequest, $apiContext); +} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError("Refund Capture", "Capture", null, $refundRequest, $ex); exit(1); -}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult("Refund Capture", "Capture", $captureRefund->getId(), $refund, $captureRefund);
+}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult("Refund Capture", "Capture", $captureRefund->getId(), $refundRequest, $captureRefund);
diff --git a/sample/doc/sale/RefundSale.html b/sample/doc/sale/RefundSale.html index fa21d155..2022484c 100644 --- a/sample/doc/sale/RefundSale.html +++ b/sample/doc/sale/RefundSale.html @@ -8,22 +8,23 @@ use PayPal\Api\Amount; use PayPal\Api\Refund; +use PayPal\Api\RefundRequest; use PayPal\Api\Sale;

Refund amount

Includes both the refunded amount (to Payer) and refunded fee (to Payee). Use the $amt->details field to mention fees refund details.

$amt = new Amount(); $amt->setCurrency('USD') - ->setTotal(0.01);

Refund object

$refund = new Refund(); -$refund->setAmount($amt);

Sale

+ ->setTotal(0.01);

Refund object

$refundRequest = new RefundRequest(); +$refundRequest->setAmount($amt);

Sale

A sale transaction. Create a Sale object with the given sale transaction id.

$sale = new Sale(); $sale->setId($saleId); try {

Create a new apiContext object so we send a new PayPal-Request-Id (idempotency) header for this resource

$apiContext = getApiContext($clientId, $clientSecret);

Refund the sale -(See bootstrap.php for more on ApiContext)

$refundedSale = $sale->refund($refund, $apiContext); -} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError("Refund Sale", "Sale", $refundedSale->getId(), $refund, $ex); +(See bootstrap.php for more on ApiContext)

$refundedSale = $sale->refundSale($refundRequest, $apiContext); +} catch (Exception $ex) {

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printError("Refund Sale", "Sale", null, $refundRequest, $ex); exit(1); -}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult("Refund Sale", "Sale", $refundedSale->getId(), $refund, $refundedSale); +}

NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY

ResultPrinter::printResult("Refund Sale", "Sale", $refundedSale->getId(), $refundRequest, $refundedSale); return $refundedSale;
diff --git a/sample/index.php b/sample/index.php index cfc38369..974f99eb 100644 --- a/sample/index.php +++ b/sample/index.php @@ -303,6 +303,17 @@ class="fa fa-file-code-o"> +
  • +
    +
    Payments to a 3rd-Party Payee
    + +
    +
  • Payments using saved credit card (using Vault APIs)
    diff --git a/sample/payments/CreateThirdPartyPayment.php b/sample/payments/CreateThirdPartyPayment.php new file mode 100644 index 00000000..e90a9e64 --- /dev/null +++ b/sample/payments/CreateThirdPartyPayment.php @@ -0,0 +1,133 @@ +setType("visa") + ->setNumber("4669424246660779") + ->setExpireMonth("11") + ->setExpireYear("2019") + ->setCvv2("012") + ->setFirstName("Joe") + ->setBillingCountry("US") + ->setLastName("Shopper"); + +// ### FundingInstrument +// A resource representing a Payer's funding instrument. +// For direct credit card payments, set the CreditCard +// field on this object. +$fi = new FundingInstrument(); +$fi->setPaymentCard($card); + +// ### Payer +// A resource representing a Payer that funds a payment +// For direct credit card payments, set payment method +// to 'credit_card' and add an array of funding instruments. +$payer = new Payer(); +$payer->setPaymentMethod("credit_card") + ->setFundingInstruments(array($fi)); + +// ### Itemized information +// (Optional) Lets you specify item wise +// information +$item1 = new Item(); +$item1->setName('Ground Coffee 40 oz') + ->setDescription('Ground Coffee 40 oz') + ->setCurrency('USD') + ->setQuantity(1) + ->setTax(0.3) + ->setPrice(7.50); +$item2 = new Item(); +$item2->setName('Granola bars') + ->setDescription('Granola Bars with Peanuts') + ->setCurrency('USD') + ->setQuantity(5) + ->setTax(0.2) + ->setPrice(2); + +$itemList = new ItemList(); +$itemList->setItems(array($item1, $item2)); + +// ### Additional payment details +// Use this optional field to set additional +// payment information such as tax, shipping +// charges etc. +$details = new Details(); +$details->setShipping(1.2) + ->setTax(1.3) + ->setSubtotal(17.5); + +// ### Amount +// Lets you specify a payment amount. +// You can also specify additional details +// such as shipping, tax. +$amount = new Amount(); +$amount->setCurrency("USD") + ->setTotal(20) + ->setDetails($details); + +// ### Payee +// Specify a payee with that user's email or merchant id +// Merchant Id can be found at https://www.paypal.com/businessprofile/settings/ +$payee = new Payee(); +$payee->setEmail("stevendcoffey-facilitator@gmail.com"); + +// ### Transaction +// A transaction defines the contract of a +// payment - what is the payment for and who +// is fulfilling it. +$transaction = new Transaction(); +$transaction->setAmount($amount) + ->setItemList($itemList) + ->setDescription("Payment description") + ->setPayee($payee) + ->setInvoiceNumber(uniqid()); + +// ### Payment +// A Payment Resource; create one using +// the above types and intent set to sale 'sale' +$payment = new Payment(); +$payment->setIntent("sale") + ->setPayer($payer) + ->setTransactions(array($transaction)); + +// For Sample Purposes Only. +$request = clone $payment; + +// ### Create Payment +// Create a payment by calling the payment->create() method +// with a valid ApiContext (See bootstrap.php for more on `ApiContext`) +// The return object contains the state. +try { + $payment->create($apiContext); +} catch (Exception $ex) { + // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY + ResultPrinter::printError('Create Payment Using Credit Card. If 500 Exception, try creating a new Credit Card using Step 4, on this link, and using it.', 'Payment', null, $request, $ex); + exit(1); +} + +// NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY + ResultPrinter::printResult('Create Payment Using Credit Card', 'Payment', $payment->getId(), $request, $payment); + +return $payment; diff --git a/sample/payments/RefundCapture.php b/sample/payments/RefundCapture.php index 9fbc5eb4..8d47777f 100644 --- a/sample/payments/RefundCapture.php +++ b/sample/payments/RefundCapture.php @@ -8,25 +8,26 @@ use PayPal\Api\Capture; use PayPal\Api\Refund; +use PayPal\Api\RefundRequest; // ### Refund // Create a refund object indicating // refund amount and call the refund method -$refund = new Refund(); -$refund->setAmount($amt); +$refundRequest = new RefundRequest(); +$refundRequest->setAmount($amt); try { // Create a new apiContext object so we send a new // PayPal-Request-Id (idempotency) header for this resource $apiContext = getApiContext($clientId, $clientSecret); - $captureRefund = $capture->refund($refund, $apiContext); + $captureRefund = $capture->refundCapturedPayment($refundRequest, $apiContext); } catch (Exception $ex) { // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printError("Refund Capture", "Capture", null, $refund, $ex); + ResultPrinter::printError("Refund Capture", "Capture", null, $refundRequest, $ex); exit(1); } // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printResult("Refund Capture", "Capture", $captureRefund->getId(), $refund, $captureRefund); +ResultPrinter::printResult("Refund Capture", "Capture", $captureRefund->getId(), $refundRequest, $captureRefund); diff --git a/sample/sale/RefundSale.php b/sample/sale/RefundSale.php index ccf3b278..bf61ab0d 100644 --- a/sample/sale/RefundSale.php +++ b/sample/sale/RefundSale.php @@ -12,6 +12,7 @@ use PayPal\Api\Amount; use PayPal\Api\Refund; +use PayPal\Api\RefundRequest; use PayPal\Api\Sale; // ### Refund amount @@ -23,8 +24,8 @@ ->setTotal(0.01); // ### Refund object -$refund = new Refund(); -$refund->setAmount($amt); +$refundRequest = new RefundRequest(); +$refundRequest->setAmount($amt); // ###Sale // A sale transaction. @@ -39,14 +40,14 @@ // Refund the sale // (See bootstrap.php for more on `ApiContext`) - $refundedSale = $sale->refund($refund, $apiContext); + $refundedSale = $sale->refundSale($refundRequest, $apiContext); } catch (Exception $ex) { // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printError("Refund Sale", "Sale", $refundedSale->getId(), $refund, $ex); + ResultPrinter::printError("Refund Sale", "Sale", null, $refundRequest, $ex); exit(1); } // NOTE: PLEASE DO NOT USE RESULTPRINTER CLASS IN YOUR ORIGINAL CODE. FOR SAMPLE ONLY - ResultPrinter::printResult("Refund Sale", "Sale", $refundedSale->getId(), $refund, $refundedSale); +ResultPrinter::printResult("Refund Sale", "Sale", $refundedSale->getId(), $refundRequest, $refundedSale); return $refundedSale;