diff --git a/lib/PayPal/Api/Address.php b/lib/PayPal/Api/Address.php index a8f72fd..39a0c86 100644 --- a/lib/PayPal/Api/Address.php +++ b/lib/PayPal/Api/Address.php @@ -11,13 +11,13 @@ namespace PayPal\Api; * * @property string phone */ -class Address extends BaseAddress +class Address extends BaseAddress { /** * Phone number in E.123 format. * * @param string $phone - * + * * @return $this */ public function setPhone($phone) diff --git a/lib/PayPal/Api/AlternatePayment.php b/lib/PayPal/Api/AlternatePayment.php new file mode 100644 index 0000000..0af3226 --- /dev/null +++ b/lib/PayPal/Api/AlternatePayment.php @@ -0,0 +1,89 @@ +alternate_payment_account_id = $alternate_payment_account_id; + return $this; + } + + /** + * The unique identifier of the alternate payment account. + * + * @return string + */ + public function getAlternatePaymentAccountId() + { + return $this->alternate_payment_account_id; + } + + /** + * The unique identifier of the payer + * + * @param string $external_customer_id + * + * @return $this + */ + public function setExternalCustomerId($external_customer_id) + { + $this->external_customer_id = $external_customer_id; + return $this; + } + + /** + * The unique identifier of the payer + * + * @return string + */ + public function getExternalCustomerId() + { + return $this->external_customer_id; + } + + /** + * Alternate Payment provider id. This is an optional attribute needed only for certain alternate providers e.g Ideal + * + * @param string $alternate_payment_provider_id + * + * @return $this + */ + public function setAlternatePaymentProviderId($alternate_payment_provider_id) + { + $this->alternate_payment_provider_id = $alternate_payment_provider_id; + return $this; + } + + /** + * Alternate Payment provider id. This is an optional attribute needed only for certain alternate providers e.g Ideal + * + * @return string + */ + public function getAlternatePaymentProviderId() + { + return $this->alternate_payment_provider_id; + } + +} diff --git a/lib/PayPal/Api/Amount.php b/lib/PayPal/Api/Amount.php index 0ad1333..7221730 100644 --- a/lib/PayPal/Api/Amount.php +++ b/lib/PayPal/Api/Amount.php @@ -13,17 +13,17 @@ use PayPal\Validation\NumericValidator; * * @package PayPal\Api * - * @property string currency - * @property string total + * @property string currency + * @property string total * @property \PayPal\Api\Details details */ class Amount extends PayPalModel { /** - * 3 letter currency code + * 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) @@ -33,7 +33,7 @@ class Amount extends PayPalModel } /** - * 3 letter currency code + * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). PayPal does not support all currencies. * * @return string */ @@ -43,8 +43,7 @@ class Amount extends PayPalModel } /** - * Total amount charged as part of this payment. - * + * 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 * @@ -59,7 +58,7 @@ class Amount extends PayPalModel } /** - * Total amount charged as part of this payment. + * 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. * * @return string */ @@ -72,7 +71,7 @@ class Amount extends PayPalModel * 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 68a72fe..142d060 100644 --- a/lib/PayPal/Api/Authorization.php +++ b/lib/PayPal/Api/Authorization.php @@ -4,7 +4,6 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** @@ -14,29 +13,29 @@ use PayPal\Validation\ArgumentValidator; * * @package PayPal\Api * - * @property string id - * @property string create_time - * @property string update_time - * @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 clearing_time - * @property string valid_until - * @property \PayPal\Api\Links links + * @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 */ class Authorization extends PayPalResourceModel { /** - * Identifier of the authorization transaction. + * ID of the authorization transaction. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -46,7 +45,7 @@ class Authorization extends PayPalResourceModel } /** - * Identifier of the authorization transaction. + * ID of the authorization transaction. * * @return string */ @@ -56,10 +55,10 @@ class Authorization extends PayPalResourceModel } /** - * Amount being authorized for. + * Amount being authorized. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -69,7 +68,7 @@ class Authorization extends PayPalResourceModel } /** - * Amount being authorized for. + * Amount being authorized. * * @return \PayPal\Api\Amount */ @@ -79,11 +78,11 @@ class Authorization extends PayPalResourceModel } /** - * specifies payment mode of the transaction - * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] + * Specifies the payment mode of the transaction. + * Valid Values: ["INSTANT_TRANSFER"] * * @param string $payment_mode - * + * * @return $this */ public function setPaymentMode($payment_mode) @@ -93,7 +92,7 @@ class Authorization extends PayPalResourceModel } /** - * specifies payment mode of the transaction + * Specifies the payment mode of the transaction. * * @return string */ @@ -103,11 +102,11 @@ class Authorization extends PayPalResourceModel } /** - * State of the authorization transaction. + * State of the authorization. * Valid Values: ["pending", "authorized", "partially_captured", "captured", "expired", "voided"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -117,7 +116,7 @@ class Authorization extends PayPalResourceModel } /** - * State of the authorization transaction. + * State of the authorization. * * @return string */ @@ -127,11 +126,11 @@ class Authorization extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending. This field will replace pending_reason field eventually + * Reason code, `AUTHORIZATION`, for a transaction state of `pending`. * Valid Values: ["AUTHORIZATION"] * * @param string $reason_code - * + * * @return $this */ public function setReasonCode($reason_code) @@ -141,7 +140,7 @@ class Authorization extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending. This field will replace pending_reason field eventually + * Reason code, `AUTHORIZATION`, for a transaction state of `pending`. * * @return string */ @@ -153,9 +152,9 @@ class Authorization extends PayPalResourceModel /** * [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead. * Valid Values: ["AUTHORIZATION"] - * @deprecated Plese Use setReasonCode instead + * * @param string $pending_reason - * + * * @return $this */ public function setPendingReason($pending_reason) @@ -165,8 +164,8 @@ class Authorization extends PayPalResourceModel } /** - * [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead. - * @deprecated Plese Use setReasonCode instead + * @deprecated [DEPRECATED] Reason code for the transaction state being Pending.Obsolete. use reason_code field instead. + * * @return string */ public function getPendingReason() @@ -175,11 +174,11 @@ class Authorization extends PayPalResourceModel } /** - * Protection Eligibility of the Payer + * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. Allowed values:
`ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Unauthorized Payments and Item Not Received.
`PARTIALLY_ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Item Not Received or Unauthorized Payments. Refer to `protection_eligibility_type` for specifics.
`INELIGIBLE`- Merchant is not protected under the Seller Protection Policy. * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility - * + * * @return $this */ public function setProtectionEligibility($protection_eligibility) @@ -189,7 +188,7 @@ class Authorization extends PayPalResourceModel } /** - * Protection Eligibility of the Payer + * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. Allowed values:
`ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Unauthorized Payments and Item Not Received.
`PARTIALLY_ELIGIBLE`- Merchant is protected by PayPal's Seller Protection Policy for Item Not Received or Unauthorized Payments. Refer to `protection_eligibility_type` for specifics.
`INELIGIBLE`- Merchant is not protected under the Seller Protection Policy. * * @return string */ @@ -199,11 +198,11 @@ class Authorization extends PayPalResourceModel } /** - * Protection Eligibility Type of the Payer - * Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"] + * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:
`ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.
`UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.
One or both of the allowed values can be returned. + * 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) @@ -213,7 +212,7 @@ class Authorization extends PayPalResourceModel } /** - * Protection Eligibility Type of the Payer + * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:
`ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.
`UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.
One or both of the allowed values can be returned. * * @return string */ @@ -223,10 +222,10 @@ class Authorization extends PayPalResourceModel } /** - * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. + * 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) @@ -236,7 +235,7 @@ class Authorization extends PayPalResourceModel } /** - * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. + * 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. * * @return \PayPal\Api\FmfDetails */ @@ -249,7 +248,7 @@ class Authorization extends PayPalResourceModel * ID of the Payment resource that this transaction is based on. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -269,34 +268,33 @@ class Authorization extends PayPalResourceModel } /** - * Expected clearing time for eCheck Transactions + * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * - * - * @param string $clearing_time + * @param \PayPal\Api\ProcessorResponse $processor_response * * @return $this */ - public function setClearingTime($clearing_time) + public function setProcessorResponse($processor_response) { - $this->clearing_time = $clearing_time; + $this->processor_response = $processor_response; return $this; } /** - * Expected clearing time for eCheck Transactions + * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. * - * @return string + * @return \PayPal\Api\ProcessorResponse */ - public function getClearingTime() + public function getProcessorResponse() { - return $this->clearing_time; + return $this->processor_response; } /** - * Date/Time until which funds may be captured against this resource in UTC ISO8601 format. + * 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) @@ -306,7 +304,7 @@ class Authorization extends PayPalResourceModel } /** - * Date/Time until which funds may be captured against this resource in UTC ISO8601 format. + * Authorization expiration time and date as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ @@ -316,10 +314,10 @@ class Authorization extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * 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) @@ -329,7 +327,7 @@ class Authorization extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * Time of authorization as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ @@ -339,10 +337,10 @@ class Authorization extends PayPalResourceModel } /** - * Time the resource was last updated in UTC ISO8601 format. + * Time that the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -352,7 +350,7 @@ class Authorization extends PayPalResourceModel } /** - * Time the resource was last updated in UTC ISO8601 format. + * Time that the resource was last updated. * * @return string */ @@ -364,9 +362,9 @@ class Authorization extends PayPalResourceModel /** * Retrieve details about a previously created authorization by passing the authorization_id in the request URI. * - * @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) @@ -389,9 +387,9 @@ class Authorization extends PayPalResourceModel /** * 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. * - * @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) @@ -415,8 +413,8 @@ class Authorization extends PayPalResourceModel /** * Void (cancel) a previously authorized payment by passing the authorization_id in the request URI. Note that a fully captured authorization cannot be voided. * - * @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) @@ -436,10 +434,10 @@ class Authorization extends PayPalResourceModel } /** - * 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. + * 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 * - * @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 34c0de0..4a45f8d 100644 --- a/lib/PayPal/Api/BankAccount.php +++ b/lib/PayPal/Api/BankAccount.php @@ -2,10 +2,7 @@ namespace PayPal\Api; -use PayPal\Common\PayPalResourceModel; -use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; -use PayPal\Validation\ArgumentValidator; +use PayPal\Common\PayPalModel; /** * Class BankAccount @@ -14,37 +11,38 @@ use PayPal\Validation\ArgumentValidator; * * @package PayPal\Api * - * @property string id - * @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 PayPalResourceModel +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) @@ -56,6 +54,7 @@ class BankAccount extends PayPalResourceModel /** * ID of the bank account being saved for later use. * + * @deprecated Not publicly available * @return string */ public function getId() @@ -67,7 +66,7 @@ class BankAccount extends PayPalResourceModel * 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) @@ -91,7 +90,7 @@ class BankAccount extends PayPalResourceModel * Valid Values: ["BBAN", "IBAN"] * * @param string $account_number_type - * + * * @return $this */ public function setAccountNumberType($account_number_type) @@ -114,7 +113,7 @@ class BankAccount extends PayPalResourceModel * 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) @@ -138,7 +137,7 @@ class BankAccount extends PayPalResourceModel * Valid Values: ["CHECKING", "SAVINGS"] * * @param string $account_type - * + * * @return $this */ public function setAccountType($account_type) @@ -161,7 +160,7 @@ class BankAccount extends PayPalResourceModel * A customer designated name. * * @param string $account_name - * + * * @return $this */ public function setAccountName($account_name) @@ -185,7 +184,7 @@ class BankAccount extends PayPalResourceModel * Valid Values: ["PERSONAL", "COMPANY"] * * @param string $check_type - * + * * @return $this */ public function setCheckType($check_type) @@ -209,7 +208,7 @@ class BankAccount extends PayPalResourceModel * Valid Values: ["CCD", "PPD", "TEL", "POP", "ARC", "RCK", "WEB"] * * @param string $auth_type - * + * * @return $this */ public function setAuthType($auth_type) @@ -232,7 +231,7 @@ class BankAccount extends PayPalResourceModel * 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) @@ -255,7 +254,7 @@ class BankAccount extends PayPalResourceModel * Name of the bank. * * @param string $bank_name - * + * * @return $this */ public function setBankName($bank_name) @@ -278,7 +277,7 @@ class BankAccount extends PayPalResourceModel * 2 letter country code of the Bank. * * @param string $country_code - * + * * @return $this */ public function setCountryCode($country_code) @@ -301,7 +300,7 @@ class BankAccount extends PayPalResourceModel * Account holder's first name. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -324,7 +323,7 @@ class BankAccount extends PayPalResourceModel * Account holder's last name. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -347,7 +346,7 @@ class BankAccount extends PayPalResourceModel * Birth date of the bank account holder. * * @param string $birth_date - * + * * @return $this */ public function setBirthDate($birth_date) @@ -370,7 +369,7 @@ class BankAccount extends PayPalResourceModel * Billing address. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -394,7 +393,7 @@ class BankAccount extends PayPalResourceModel * Valid Values: ["ACTIVE", "INACTIVE", "DELETED"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -418,7 +417,7 @@ class BankAccount extends PayPalResourceModel * Valid Values: ["UNCONFIRMED", "CONFIRMED"] * * @param string $confirmation_status - * + * * @return $this */ public function setConfirmationStatus($confirmation_status) @@ -438,10 +437,10 @@ class BankAccount extends PayPalResourceModel } /** - * Deprecated - Use external_customer_id instead. + * [DEPRECATED] Use external_customer_id instead. * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -451,7 +450,7 @@ class BankAccount extends PayPalResourceModel } /** - * Deprecated - Use external_customer_id instead. + * @deprecated [DEPRECATED] Use external_customer_id instead. * * @return string */ @@ -464,7 +463,7 @@ class BankAccount extends PayPalResourceModel * 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,12 +482,11 @@ class BankAccount extends PayPalResourceModel return $this->external_customer_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. * * @param string $merchant_id - * + * * @return $this */ public function setMerchantId($merchant_id) @@ -511,7 +509,7 @@ class BankAccount extends PayPalResourceModel * Time the resource was created. * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -534,7 +532,7 @@ class BankAccount extends PayPalResourceModel * Time the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -557,7 +555,7 @@ class BankAccount extends PayPalResourceModel * Date/Time until this resource can be used to fund a payment. * * @param string $valid_until - * + * * @return $this */ public function setValidUntil($valid_until) @@ -577,97 +575,56 @@ class BankAccount extends PayPalResourceModel } /** - * Creates a new Bank Account Resource. + * Sets Links * - * @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 BankAccount + * @param \PayPal\Api\Links[] $links + * + * @return $this */ - public function create($apiContext = null, $restCall = null) + public function setLinks($links) { - $payLoad = $this->toJSON(); - $json = self::executeCall( - "/v1/vault/bank-accounts", - "POST", - $payLoad, - null, - $apiContext, - $restCall - ); - $this->fromJson($json); + $this->links = $links; return $this; } /** - * Obtain the Bank Account resource for the given identifier. + * Gets Links * - * @param string $bankAccountId - * @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 BankAccount + * @return \PayPal\Api\Links[] */ - public static function get($bankAccountId, $apiContext = null, $restCall = null) + public function getLinks() { - ArgumentValidator::validate($bankAccountId, 'bankAccountId'); - $payLoad = ""; - $json = self::executeCall( - "/v1/vault/bank-accounts/$bankAccountId", - "GET", - $payLoad, - null, - $apiContext, - $restCall - ); - $ret = new BankAccount(); - $ret->fromJson($json); - return $ret; + return $this->links; } /** - * Delete the bank account resource for the given identifier. + * Append Links to the list. * - * @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 bool + * @param \PayPal\Api\Links $links + * @return $this */ - public function delete($apiContext = null, $restCall = null) + public function addLink($links) { - ArgumentValidator::validate($this->getId(), "Id"); - $payLoad = ""; - self::executeCall( - "/v1/vault/bank-accounts/{$this->getId()}", - "DELETE", - $payLoad, - null, - $apiContext, - $restCall - ); - return true; + if (!$this->getLinks()) { + return $this->setLinks(array($links)); + } else { + return $this->setLinks( + array_merge($this->getLinks(), array($links)) + ); + } } /** - * Update information in a previously saved bank account. Only the modified fields need to be passed in the request. + * Remove Links from the list. * - * @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 BankAccount + * @param \PayPal\Api\Links $links + * @return $this */ - public function update($patchRequest, $apiContext = null, $restCall = null) + public function removeLink($links) { - ArgumentValidator::validate($this->getId(), "Id"); - ArgumentValidator::validate($patchRequest, 'patchRequest'); - $payLoad = $patchRequest->toJSON(); - $json = self::executeCall( - "/v1/vault/bank-accounts/{$this->getId()}", - "PATCH", - $payLoad, - null, - $apiContext, - $restCall + return $this->setLinks( + array_diff($this->getLinks(), array($links)) ); - $this->fromJson($json); - return $this; } } diff --git a/lib/PayPal/Api/Billing.php b/lib/PayPal/Api/Billing.php new file mode 100644 index 0000000..7b1bad6 --- /dev/null +++ b/lib/PayPal/Api/Billing.php @@ -0,0 +1,41 @@ +billing_agreement_id = $billing_agreement_id; + return $this; + } + + /** + * Identifier of the instrument in PayPal Wallet + * + * @return string + */ + public function getBillingAgreementId() + { + return $this->billing_agreement_id; + } + +} diff --git a/lib/PayPal/Api/BillingAgreementToken.php b/lib/PayPal/Api/BillingAgreementToken.php new file mode 100644 index 0000000..ca5ef6b --- /dev/null +++ b/lib/PayPal/Api/BillingAgreementToken.php @@ -0,0 +1,17 @@ +id = $id; + return $this; + } + + /** + * ID that identifies the payer�s carrier account. Can be used in subsequent REST API calls, e.g. for making payments. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The payer�s phone number in E.164 format. + * + * @param string $phone_number + * + * @return $this + */ + public function setPhoneNumber($phone_number) + { + $this->phone_number = $phone_number; + return $this; + } + + /** + * The payer�s phone number in E.164 format. + * + * @return string + */ + public function getPhoneNumber() + { + return $this->phone_number; + } + + /** + * User identifier as created by the merchant. + * + * @param string $external_customer_id + * + * @return $this + */ + public function setExternalCustomerId($external_customer_id) + { + $this->external_customer_id = $external_customer_id; + return $this; + } + + /** + * User identifier as created by the merchant. + * + * @return string + */ + public function getExternalCustomerId() + { + return $this->external_customer_id; + } + + /** + * The method of obtaining the phone number (USER_PROVIDED or READ_FROM_DEVICE). + * Valid Values: ["READ_FROM_DEVICE", "USER_PROVIDED"] + * + * @param string $phone_source + * + * @return $this + */ + public function setPhoneSource($phone_source) + { + $this->phone_source = $phone_source; + return $this; + } + + /** + * The method of obtaining the phone number (USER_PROVIDED or READ_FROM_DEVICE). + * + * @return string + */ + public function getPhoneSource() + { + return $this->phone_source; + } + + /** + * The country where the phone number is registered. Specified in 2-character IS0-3166-1 format. + * + * @param \PayPal\Api\CountryCode $country_code + * + * @return $this + */ + public function setCountryCode($country_code) + { + $this->country_code = $country_code; + return $this; + } + + /** + * The country where the phone number is registered. Specified in 2-character IS0-3166-1 format. + * + * @return \PayPal\Api\CountryCode + */ + public function getCountryCode() + { + return $this->country_code; + } + +} diff --git a/lib/PayPal/Api/CarrierAccountToken.php b/lib/PayPal/Api/CarrierAccountToken.php index 65addbd..1313f65 100644 --- a/lib/PayPal/Api/CarrierAccountToken.php +++ b/lib/PayPal/Api/CarrierAccountToken.php @@ -40,10 +40,10 @@ class CarrierAccountToken extends PayPalModel } /** - * ID of a previously saved carrier account resource. - * + * 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 ef85bbd..32aa8a5 100644 --- a/lib/PayPal/Api/CartBase.php +++ b/lib/PayPal/Api/CartBase.php @@ -12,25 +12,48 @@ use PayPal\Validation\UrlValidator; * * @package PayPal\Api * - * @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 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 \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 { + /** + * Merchant identifier to the purchase unit. Optional parameter + * + * @param string $reference_id + * + * @return $this + */ + public function setReferenceId($reference_id) + { + $this->reference_id = $reference_id; + return $this; + } + + /** + * Merchant identifier to the purchase unit. Optional parameter + * + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + /** * Amount being collected. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -52,8 +75,9 @@ class CartBase extends PayPalModel /** * Recipient of the funds in this transaction. * + * @deprecated Not publicly available * @param \PayPal\Api\Payee $payee - * + * * @return $this */ public function setPayee($payee) @@ -65,6 +89,7 @@ class CartBase extends PayPalModel /** * Recipient of the funds in this transaction. * + * @deprecated Not publicly available * @return \PayPal\Api\Payee */ public function getPayee() @@ -73,10 +98,10 @@ class CartBase extends PayPalModel } /** - * Description of what is being paid for. + * Description of transaction. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -86,7 +111,7 @@ class CartBase extends PayPalModel } /** - * Description of what is being paid for. + * Description of transaction. * * @return string */ @@ -99,7 +124,7 @@ class CartBase extends PayPalModel * Note to the recipient of the funds in this transaction. * * @param string $note_to_payee - * + * * @return $this */ public function setNoteToPayee($note_to_payee) @@ -119,11 +144,10 @@ class CartBase extends PayPalModel } /** - * Note to the recipient of the funds in this transaction. - * + * Free-form field for the use of clients. Only supported when the `payment_method` is set to `paypal`. * * @param string $custom - * + * * @return $this */ public function setCustom($custom) @@ -133,7 +157,7 @@ class CartBase extends PayPalModel } /** - * free-form field for the use of clients + * Free-form field for the use of clients. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -143,10 +167,10 @@ class CartBase extends PayPalModel } /** - * invoice number to track this payment + * Invoice number used to track the payment. Only supported when the `payment_method` is set to `paypal`. * * @param string $invoice_number - * + * * @return $this */ public function setInvoiceNumber($invoice_number) @@ -156,7 +180,7 @@ class CartBase extends PayPalModel } /** - * invoice number to track this payment + * Invoice number used to track the payment. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -166,11 +190,10 @@ class CartBase extends PayPalModel } /** - * Soft descriptor used when charging this funding source. - * + * 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) @@ -180,7 +203,7 @@ class CartBase extends PayPalModel } /** - * Soft descriptor used when charging this funding source. + * Soft descriptor used when charging this funding source. If length exceeds max length, the value will be truncated * * @return string */ @@ -189,12 +212,36 @@ class CartBase extends PayPalModel return $this->soft_descriptor; } + /** + * 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) + { + $this->soft_descriptor_city = $soft_descriptor_city; + return $this; + } + + /** + * 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 + */ + public function getSoftDescriptorCity() + { + return $this->soft_descriptor_city; + } + /** * Payment options requested for this purchase unit * - * * @param \PayPal\Api\PaymentOptions $payment_options - * + * * @return $this */ public function setPaymentOptions($payment_options) @@ -214,10 +261,10 @@ class CartBase extends PayPalModel } /** - * List of items being paid for. + * Items and related shipping address within a transaction. * * @param \PayPal\Api\ItemList $item_list - * + * * @return $this */ public function setItemList($item_list) @@ -227,7 +274,7 @@ class CartBase extends PayPalModel } /** - * List of items being paid for. + * Items and related shipping address within a transaction. * * @return \PayPal\Api\ItemList */ @@ -283,4 +330,62 @@ class CartBase extends PayPalModel { return $this->order_url; } + + /** + * 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 + * + * @return $this + */ + public function setExternalFunding($external_funding) + { + $this->external_funding = $external_funding; + return $this; + } + + /** + * 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[] + */ + public function getExternalFunding() + { + return $this->external_funding; + } + + /** + * Append ExternalFunding to the list. + * + * @deprecated Not publicly available + * @param \PayPal\Api\ExternalFunding $externalFunding + * @return $this + */ + public function addExternalFunding($externalFunding) + { + if (!$this->getExternalFunding()) { + return $this->setExternalFunding(array($externalFunding)); + } else { + return $this->setExternalFunding( + array_merge($this->getExternalFunding(), array($externalFunding)) + ); + } + } + + /** + * Remove ExternalFunding from the list. + * + * @deprecated Not publicly available + * @param \PayPal\Api\ExternalFunding $externalFunding + * @return $this + */ + public function removeExternalFunding($externalFunding) + { + return $this->setExternalFunding( + array_diff($this->getExternalFunding(), array($externalFunding)) + ); + } + } diff --git a/lib/PayPal/Api/CountryCode.php b/lib/PayPal/Api/CountryCode.php new file mode 100644 index 0000000..18b45ac --- /dev/null +++ b/lib/PayPal/Api/CountryCode.php @@ -0,0 +1,41 @@ +country_code = $country_code; + return $this; + } + + /** + * ISO country code based on 2-character IS0-3166-1 codes. + * + * @return string + */ + public function getCountryCode() + { + return $this->country_code; + } + +} diff --git a/lib/PayPal/Api/CreateProfileResponse.php b/lib/PayPal/Api/CreateProfileResponse.php index 64f79da..1b36faf 100644 --- a/lib/PayPal/Api/CreateProfileResponse.php +++ b/lib/PayPal/Api/CreateProfileResponse.php @@ -2,8 +2,6 @@ namespace PayPal\Api; -use PayPal\Common\PayPalModel; - /** * Class CreateProfileResponse * @@ -13,7 +11,7 @@ use PayPal\Common\PayPalModel; * * @property string id */ -class CreateProfileResponse extends PayPalModel +class CreateProfileResponse extends WebProfile { /** * ID of the payment web experience profile. diff --git a/lib/PayPal/Api/Credit.php b/lib/PayPal/Api/Credit.php index e87b034..a37370d 100644 --- a/lib/PayPal/Api/Credit.php +++ b/lib/PayPal/Api/Credit.php @@ -13,7 +13,6 @@ use PayPal\Common\PayPalModel; * * @property string id * @property string type - * @property string terms */ class Credit extends PayPalModel { @@ -21,7 +20,7 @@ class Credit extends PayPalModel * Unique identifier of credit resource. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -41,11 +40,11 @@ class Credit extends PayPalModel } /** - * Specifies the type of credit. + * specifies type of credit * Valid Values: ["BILL_ME_LATER", "PAYPAL_EXTRAS_MASTERCARD", "EBAY_MASTERCARD", "PAYPAL_SMART_CONNECT"] * * @param string $type - * + * * @return $this */ public function setType($type) @@ -55,7 +54,7 @@ class Credit extends PayPalModel } /** - * Specifies the type of credit + * specifies type of credit * * @return string */ @@ -64,27 +63,4 @@ class Credit extends PayPalModel return $this->type; } - /** - * URI to the associated terms. - * - * @param string $terms - * - * @return $this - */ - public function setTerms($terms) - { - $this->terms = $terms; - return $this; - } - - /** - * URI to the associated terms. - * - * @return string - */ - public function getTerms() - { - return $this->terms; - } - } diff --git a/lib/PayPal/Api/CreditCard.php b/lib/PayPal/Api/CreditCard.php index 082d785..2f493bd 100644 --- a/lib/PayPal/Api/CreditCard.php +++ b/lib/PayPal/Api/CreditCard.php @@ -10,36 +10,31 @@ use PayPal\Validation\ArgumentValidator; /** * Class CreditCard * - * A resource representing a credit card that can be used to fund a payment. + * @deprecated Represents a credit card to fund a payment. Use Payment Card instead. * - * @package PayPal\Api + * @package PayPal\Api * - * @property string id - * @property string number - * @property string type - * @property int expire_month - * @property int expire_year - * @property string cvv2 - * @property string first_name - * @property string last_name + * @property string number + * @property string type + * @property int expire_month + * @property int expire_year + * @property string cvv2 + * @property string first_name + * @property string last_name * @property \PayPal\Api\Address billing_address - * @property string external_customer_id - * @property string merchant_id - * @property string payer_id - * @property string external_card_id - * @property string state - * @property string create_time - * @property string update_time - * @property string valid_until + * @property string external_customer_id + * @property string state + * @property string valid_until * @property \PayPal\Api\Links[] links */ class CreditCard extends PayPalResourceModel { /** - * ID of the credit card being saved for later use. + * ID of the credit card. This ID is provided in the response when storing credit cards. **Required if using a stored credit card.** * + * @deprecated Not publicly available * @param string $id - * + * * @return $this */ public function setId($id) @@ -49,8 +44,9 @@ class CreditCard extends PayPalResourceModel } /** - * ID of the credit card being saved for later use. + * ID of the credit card. This ID is provided in the response when storing credit cards. **Required if using a stored credit card.** * + * @deprecated Not publicly available * @return string */ public function getId() @@ -59,10 +55,10 @@ class CreditCard extends PayPalResourceModel } /** - * Card number. + * Credit card number. Numeric characters only with no spaces or punctuation. The string must conform with modulo and length required by each credit card type. *Redacted in responses.* * * @param string $number - * + * * @return $this */ public function setNumber($number) @@ -72,7 +68,7 @@ class CreditCard extends PayPalResourceModel } /** - * Card number. + * Credit card number. Numeric characters only with no spaces or punctuation. The string must conform with modulo and length required by each credit card type. *Redacted in responses.* * * @return string */ @@ -82,11 +78,10 @@ class CreditCard extends PayPalResourceModel } /** - * Type of the Card. Currently supporting Visa, Mastercard, Amex, Discover and Maestro - * Valid Values: ["visa", "mastercard", "amex", "discover", "maestro"] + * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex` * * @param string $type - * + * * @return $this */ public function setType($type) @@ -96,7 +91,7 @@ class CreditCard extends PayPalResourceModel } /** - * Type of the Card. Currently supporting Visa, Mastercard, Amex, Discover and Maestro + * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex` * * @return string */ @@ -106,10 +101,10 @@ class CreditCard extends PayPalResourceModel } /** - * 2 digit card expiry month. + * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @param int $expire_month - * + * * @return $this */ public function setExpireMonth($expire_month) @@ -119,7 +114,7 @@ class CreditCard extends PayPalResourceModel } /** - * 2 digit card expiry month. + * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @return int */ @@ -129,10 +124,10 @@ class CreditCard extends PayPalResourceModel } /** - * 4 digit card expiry year + * 4-digit expiration year. * * @param int $expire_year - * + * * @return $this */ public function setExpireYear($expire_year) @@ -142,7 +137,7 @@ class CreditCard extends PayPalResourceModel } /** - * 4 digit card expiry year + * 4-digit expiration year. * * @return int */ @@ -152,10 +147,10 @@ class CreditCard extends PayPalResourceModel } /** - * Card validation code. Only supported when making a Payment but not when saving a credit card for future use. + * 3-4 digit card validation code. * * @param string $cvv2 - * + * * @return $this */ public function setCvv2($cvv2) @@ -165,7 +160,7 @@ class CreditCard extends PayPalResourceModel } /** - * Card validation code. Only supported when making a Payment but not when saving a credit card for future use. + * 3-4 digit card validation code. * * @return string */ @@ -175,10 +170,10 @@ class CreditCard extends PayPalResourceModel } /** - * Card holder's first name. + * Cardholder's first name. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -188,7 +183,7 @@ class CreditCard extends PayPalResourceModel } /** - * Card holder's first name. + * Cardholder's first name. * * @return string */ @@ -198,10 +193,10 @@ class CreditCard extends PayPalResourceModel } /** - * Card holder's last name. + * Cardholder's last name. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -211,7 +206,7 @@ class CreditCard extends PayPalResourceModel } /** - * Card holder's last name. + * Cardholder's last name. * * @return string */ @@ -224,7 +219,7 @@ class CreditCard extends PayPalResourceModel * Billing Address associated with this card. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -244,10 +239,10 @@ class CreditCard extends PayPalResourceModel } /** - * 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. + * A unique identifier of the customer to whom this bank account belongs. Generated and provided by the facilitator. **This is now used in favor of `payer_id` when creating or using a stored funding instrument in the vault.** * * @param string $external_customer_id - * + * * @return $this */ public function setExternalCustomerId($external_customer_id) @@ -257,7 +252,7 @@ class CreditCard extends PayPalResourceModel } /** - * 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. + * A unique identifier of the customer to whom this bank account belongs. Generated and provided by the facilitator. **This is now used in favor of `payer_id` when creating or using a stored funding instrument in the vault.** * * @return string */ @@ -270,7 +265,7 @@ class CreditCard extends PayPalResourceModel * A user provided, optional convenvience field that functions as a unique identifier for the merchant on behalf of whom this credit card is being stored for. Note that this has no relation to PayPal merchant id * * @param string $merchant_id - * + * * @return $this */ public function setMerchantId($merchant_id) @@ -291,9 +286,10 @@ class CreditCard extends PayPalResourceModel /** * 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. + * * @deprecated This is being deprecated in favor of the `external_customer_id` property. * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -304,6 +300,7 @@ class CreditCard extends PayPalResourceModel /** * 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. + * * @deprecated This is being deprecated in favor of the `external_customer_id` property. * @return string */ @@ -316,7 +313,7 @@ class CreditCard extends PayPalResourceModel * A unique identifier of the bank account resource. 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 $external_card_id - * + * * @return $this */ public function setExternalCardId($external_card_id) @@ -340,7 +337,7 @@ class CreditCard extends PayPalResourceModel * Valid Values: ["expired", "ok"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -350,7 +347,7 @@ class CreditCard extends PayPalResourceModel } /** - * State of the funding instrument. + * State of the credit card funding instrument. * * @return string */ @@ -360,10 +357,10 @@ class CreditCard extends PayPalResourceModel } /** - * Resource creation time as ISO8601 date-time format (ex: 1994-11-05T13:15:30Z) that indicates creation time. + * Funding instrument expiration date. * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -386,7 +383,7 @@ class CreditCard extends PayPalResourceModel * Resource creation time as ISO8601 date-time format (ex: 1994-11-05T13:15:30Z) that indicates the updation time. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -409,7 +406,7 @@ class CreditCard extends PayPalResourceModel * Date/Time until this resource can be used fund a payment. * * @param string $valid_until - * + * * @return $this */ public function setValidUntil($valid_until) @@ -419,7 +416,7 @@ class CreditCard extends PayPalResourceModel } /** - * Date/Time until this resource can be used fund a payment. + * Funding instrument expiration date. * * @return string */ @@ -431,8 +428,8 @@ class CreditCard extends PayPalResourceModel /** * Creates a new Credit Card Resource (aka Tokenize). * - * @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 CreditCard */ public function create($apiContext = null, $restCall = null) @@ -453,9 +450,9 @@ class CreditCard extends PayPalResourceModel /** * Obtain the Credit Card resource for the given identifier. * - * @param string $creditCardId - * @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 $creditCardId + * @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 CreditCard */ public static function get($creditCardId, $apiContext = null, $restCall = null) @@ -478,8 +475,8 @@ class CreditCard extends PayPalResourceModel /** * Delete the Credit Card resource for the given identifier. * - * @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 bool */ public function delete($apiContext = null, $restCall = null) @@ -500,9 +497,9 @@ class CreditCard extends PayPalResourceModel /** * Update information in a previously saved card. Only the modified fields need to be passed in the request. * - * @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 CreditCard */ public function update($patchRequest, $apiContext = null, $restCall = null) @@ -525,9 +522,9 @@ class CreditCard extends PayPalResourceModel /** * Retrieves a list of Credit Card resources. * - * @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 CreditCardList */ public static function all($params, $apiContext = null, $restCall = null) @@ -538,16 +535,16 @@ class CreditCard extends PayPalResourceModel ArgumentValidator::validate($params, 'params'); $payLoad = ""; $allowedParams = array( - 'page_size' => 1, - 'page' => 1, - 'start_time' => 1, - 'end_time' => 1, - 'sort_order' => 1, - 'sort_by' => 1, - 'merchant_id' => 1, - 'external_card_id' => 1, - 'external_customer_id' => 1, - ); + 'page_size' => 1, + 'page' => 1, + 'start_time' => 1, + 'end_time' => 1, + 'sort_order' => 1, + 'sort_by' => 1, + 'merchant_id' => 1, + 'external_card_id' => 1, + 'external_customer_id' => 1, + ); $json = self::executeCall( "/v1/vault/credit-cards" . "?" . http_build_query(array_intersect_key($params, $allowedParams)), "GET", diff --git a/lib/PayPal/Api/CreditCardToken.php b/lib/PayPal/Api/CreditCardToken.php index 507ffd2..b43e196 100644 --- a/lib/PayPal/Api/CreditCardToken.php +++ b/lib/PayPal/Api/CreditCardToken.php @@ -15,16 +15,16 @@ use PayPal\Common\PayPalModel; * @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 { /** - * ID of a previously saved Credit Card resource using /vault/credit-card API. + * ID of credit card previously stored using `/vault/credit-card`. * * @param string $credit_card_id - * + * * @return $this */ public function setCreditCardId($credit_card_id) @@ -34,7 +34,7 @@ class CreditCardToken extends PayPalModel } /** - * ID of a previously saved Credit Card resource using /vault/credit-card API. + * ID of credit card previously stored using `/vault/credit-card`. * * @return string */ @@ -44,10 +44,10 @@ class CreditCardToken extends PayPalModel } /** - * The unique identifier of the payer used when saving this credit card using /vault/credit-card API. + * 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) @@ -57,7 +57,7 @@ class CreditCardToken extends PayPalModel } /** - * The unique identifier of the payer used when saving this credit card using /vault/credit-card API. + * 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.** * * @return string */ @@ -67,10 +67,10 @@ class CreditCardToken extends PayPalModel } /** - * Last 4 digits of the card number from the saved card. + * Last four digits of the stored credit card number. * * @param string $last4 - * + * * @return $this */ public function setLast4($last4) @@ -80,7 +80,7 @@ class CreditCardToken extends PayPalModel } /** - * Last 4 digits of the card number from the saved card. + * Last four digits of the stored credit card number. * * @return string */ @@ -90,10 +90,10 @@ class CreditCardToken extends PayPalModel } /** - * Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display. + * 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) @@ -103,7 +103,7 @@ class CreditCardToken extends PayPalModel } /** - * Type of the Card (eg. visa, mastercard, etc.) from the saved card. Please note that the values are always in lowercase and not meant to be used directly for display. + * Credit card type. Valid types are: `visa`, `mastercard`, `discover`, `amex`. Values are presented in lowercase and not should not be used for display. * * @return string */ @@ -113,10 +113,10 @@ class CreditCardToken extends PayPalModel } /** - * card expiry month from the saved card with value 1 - 12 + * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @param int $expire_month - * + * * @return $this */ public function setExpireMonth($expire_month) @@ -126,7 +126,7 @@ class CreditCardToken extends PayPalModel } /** - * card expiry month from the saved card with value 1 - 12 + * Expiration month with no leading zero. Acceptable values are 1 through 12. * * @return int */ @@ -136,10 +136,10 @@ class CreditCardToken extends PayPalModel } /** - * 4 digit card expiry year from the saved card + * 4-digit expiration year. * * @param int $expire_year - * + * * @return $this */ public function setExpireYear($expire_year) @@ -149,7 +149,7 @@ class CreditCardToken extends PayPalModel } /** - * 4 digit card expiry year from the saved card + * 4-digit expiration year. * * @return int */ diff --git a/lib/PayPal/Api/CreditFinancingOffered.php b/lib/PayPal/Api/CreditFinancingOffered.php new file mode 100644 index 0000000..bb24617 --- /dev/null +++ b/lib/PayPal/Api/CreditFinancingOffered.php @@ -0,0 +1,161 @@ +total_cost = $total_cost; + return $this; + } + + /** + * This is the estimated total payment amount including interest and fees the user will pay during the lifetime of the loan. + * + * @return \PayPal\Api\Currency + */ + public function getTotalCost() + { + return $this->total_cost; + } + + /** + * Length of financing terms in month + * + * @param \PayPal\Api\number $term + * + * @return $this + */ + public function setTerm($term) + { + $this->term = $term; + return $this; + } + + /** + * Length of financing terms in month + * + * @return \PayPal\Api\number + */ + public function getTerm() + { + return $this->term; + } + + /** + * This is the estimated amount per month that the customer will need to pay including fees and interest. + * + * @param \PayPal\Api\Currency $monthly_payment + * + * @return $this + */ + public function setMonthlyPayment($monthly_payment) + { + $this->monthly_payment = $monthly_payment; + return $this; + } + + /** + * This is the estimated amount per month that the customer will need to pay including fees and interest. + * + * @return \PayPal\Api\Currency + */ + public function getMonthlyPayment() + { + return $this->monthly_payment; + } + + /** + * Estimated interest or fees amount the payer will have to pay during the lifetime of the loan. + * + * @param \PayPal\Api\Currency $total_interest + * + * @return $this + */ + public function setTotalInterest($total_interest) + { + $this->total_interest = $total_interest; + return $this; + } + + /** + * Estimated interest or fees amount the payer will have to pay during the lifetime of the loan. + * + * @return \PayPal\Api\Currency + */ + public function getTotalInterest() + { + return $this->total_interest; + } + + /** + * Status on whether the customer ultimately was approved for and chose to make the payment using the approved installment credit. + * + * @param bool $payer_acceptance + * + * @return $this + */ + public function setPayerAcceptance($payer_acceptance) + { + $this->payer_acceptance = $payer_acceptance; + return $this; + } + + /** + * Status on whether the customer ultimately was approved for and chose to make the payment using the approved installment credit. + * + * @return bool + */ + public function getPayerAcceptance() + { + return $this->payer_acceptance; + } + + /** + * Indicates whether the cart amount is editable after payer's acceptance on PayPal side + * + * @param bool $cart_amount_immutable + * + * @return $this + */ + public function setCartAmountImmutable($cart_amount_immutable) + { + $this->cart_amount_immutable = $cart_amount_immutable; + return $this; + } + + /** + * Indicates whether the cart amount is editable after payer's acceptance on PayPal side + * + * @return bool + */ + public function getCartAmountImmutable() + { + return $this->cart_amount_immutable; + } + +} diff --git a/lib/PayPal/Api/CurrencyConversion.php b/lib/PayPal/Api/CurrencyConversion.php index 93ae91d..3811277 100644 --- a/lib/PayPal/Api/CurrencyConversion.php +++ b/lib/PayPal/Api/CurrencyConversion.php @@ -12,14 +12,13 @@ use PayPal\Validation\UrlValidator; * * @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 web_url + * @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 @@ -28,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) @@ -51,7 +50,7 @@ class CurrencyConversion extends PayPalModel * 3 letter currency code * * @param string $from_currency - * + * * @return $this */ public function setFromCurrency($from_currency) @@ -71,10 +70,10 @@ class CurrencyConversion extends PayPalModel } /** - * 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) @@ -84,7 +83,7 @@ class CurrencyConversion extends PayPalModel } /** - * Amount participating in currency conversion, set to 1 as default + * Amount participating in currency conversion, set to 1 as default * * @return string */ @@ -97,7 +96,7 @@ class CurrencyConversion extends PayPalModel * 3 letter currency code * * @param string $to_currency - * + * * @return $this */ public function setToCurrency($to_currency) @@ -120,7 +119,7 @@ class CurrencyConversion extends PayPalModel * Amount resulting from currency conversion. * * @param string $to_amount - * + * * @return $this */ public function setToAmount($to_amount) @@ -144,7 +143,7 @@ class CurrencyConversion extends PayPalModel * Valid Values: ["PAYPAL", "VENDOR"] * * @param string $conversion_type - * + * * @return $this */ public function setConversionType($conversion_type) @@ -167,7 +166,7 @@ class CurrencyConversion extends PayPalModel * Allow Payer to change conversion type. * * @param bool $conversion_type_changeable - * + * * @return $this */ public function setConversionTypeChangeable($conversion_type_changeable) @@ -190,6 +189,7 @@ class CurrencyConversion extends PayPalModel * 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 * @return $this @@ -204,6 +204,7 @@ class CurrencyConversion extends PayPalModel /** * Base URL to web applications endpoint * + * @deprecated Not publicly available * @return string */ public function getWebUrl() @@ -215,7 +216,7 @@ class CurrencyConversion extends PayPalModel * Sets Links * * @param \PayPal\Api\Links[] $links - * + * * @return $this */ public function setLinks($links) diff --git a/lib/PayPal/Api/Details.php b/lib/PayPal/Api/Details.php index a164e7d..a196416 100644 --- a/lib/PayPal/Api/Details.php +++ b/lib/PayPal/Api/Details.php @@ -25,10 +25,10 @@ use PayPal\Validation\NumericValidator; class Details extends PayPalModel { /** - * Sub-total (amount) of items being paid for. + * 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) @@ -40,7 +40,7 @@ class Details extends PayPalModel } /** - * Sub-total (amount) of items being paid for. + * Amount of the subtotal of the items. **Required** if line items are specified. 10 characters max, with support for 2 decimal places. * * @return string */ @@ -50,10 +50,10 @@ class Details extends PayPalModel } /** - * Amount being charged for shipping. + * Amount charged for shipping. 10 characters max with support for 2 decimal places. * * @param string|double $shipping - * + * * @return $this */ public function setShipping($shipping) @@ -65,7 +65,7 @@ class Details extends PayPalModel } /** - * Amount being charged for shipping. + * Amount charged for shipping. 10 characters max with support for 2 decimal places. * * @return string */ @@ -75,10 +75,10 @@ class Details extends PayPalModel } /** - * Amount being charged as tax. + * Amount charged for tax. 10 characters max with support for 2 decimal places. * * @param string|double $tax - * + * * @return $this */ public function setTax($tax) @@ -90,7 +90,7 @@ class Details extends PayPalModel } /** - * Amount being charged as tax. + * Amount charged for tax. 10 characters max with support for 2 decimal places. * * @return string */ @@ -100,10 +100,10 @@ class Details extends PayPalModel } /** - * Amount being charged as handling fee. + * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`. + * + * @param string|double $handling_fee * - * @param string $handling_fee - * * @return $this */ public function setHandlingFee($handling_fee) @@ -115,7 +115,7 @@ class Details extends PayPalModel } /** - * Amount being charged as handling fee. + * Amount being charged for the handling fee. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -125,10 +125,10 @@ class Details extends PayPalModel } /** - * Amount being charged as shipping discount. + * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`. + * + * @param string|double $shipping_discount * - * @param string $shipping_discount - * * @return $this */ public function setShippingDiscount($shipping_discount) @@ -140,7 +140,7 @@ class Details extends PayPalModel } /** - * Amount being charged as shipping discount. + * Amount being discounted for the shipping fee. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -150,10 +150,10 @@ class Details extends PayPalModel } /** - * Amount being charged as insurance. + * 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) @@ -165,7 +165,7 @@ class Details extends PayPalModel } /** - * Amount being charged as insurance. + * Amount being charged for the insurance fee. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -177,8 +177,8 @@ class Details extends PayPalModel /** * Amount being charged as gift wrap fee. * - * @param string $gift_wrap - * + * @param string|double $gift_wrap + * * @return $this */ public function setGiftWrap($gift_wrap) @@ -203,7 +203,7 @@ class Details extends PayPalModel * 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 5edbb65..1ad013d 100644 --- a/lib/PayPal/Api/Error.php +++ b/lib/PayPal/Api/Error.php @@ -11,14 +11,12 @@ use PayPal\Common\PayPalModel; * * @package PayPal\Api * - * @property string name - * @property string purchase_unit_reference_id - * @property string debug_id - * @property string message - * @property string code - * @property string information_link + * @property string name + * @property string message * @property \PayPal\Api\ErrorDetails[] details - * @property \PayPal\Api\Links[] links + * @property string information_link + * @property string debug_id + * @property \PayPal\Api\Links[] links */ class Error extends PayPalModel { @@ -26,7 +24,7 @@ class Error extends PayPalModel * Human readable, unique name of the error. * * @param string $name - * + * * @return $this */ public function setName($name) @@ -48,8 +46,9 @@ class Error extends PayPalModel /** * 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) @@ -61,6 +60,7 @@ class Error extends PayPalModel /** * Reference ID of the purchase_unit associated with this error * + * @deprecated Not publicly available * @return string */ public function getPurchaseUnitReferenceId() @@ -68,34 +68,11 @@ class Error extends PayPalModel return $this->purchase_unit_reference_id; } - /** - * PayPal internal identifier used for correlation purposes. - * - * @param string $debug_id - * - * @return $this - */ - public function setDebugId($debug_id) - { - $this->debug_id = $debug_id; - return $this; - } - - /** - * PayPal internal identifier used for correlation purposes. - * - * @return string - */ - public function getDebugId() - { - return $this->debug_id; - } - /** * Message describing the error. * * @param string $message - * + * * @return $this */ public function setMessage($message) @@ -117,8 +94,9 @@ class Error extends PayPalModel /** * PayPal internal error code. * + * @deprecated Not publicly available * @param string $code - * + * * @return $this */ public function setCode($code) @@ -130,6 +108,7 @@ class Error extends PayPalModel /** * PayPal internal error code. * + * @deprecated Not publicly available * @return string */ public function getCode() @@ -137,34 +116,11 @@ class Error extends PayPalModel return $this->code; } - /** - * URI for detailed information related to this error for the developer. - * - * @param string $information_link - * - * @return $this - */ - public function setInformationLink($information_link) - { - $this->information_link = $information_link; - return $this; - } - - /** - * URI for detailed information related to this error for the developer. - * - * @return string - */ - public function getInformationLink() - { - return $this->information_link; - } - /** * Additional details of the error * * @param \PayPal\Api\ErrorDetails[] $details - * + * * @return $this */ public function setDetails($details) @@ -213,11 +169,107 @@ class Error extends PayPalModel ); } + /** + * response codes returned from a payment processor such as avs, cvv, etc. Only supported when the `payment_method` is set to `credit_card`. + * + * @deprecated Not publicly available + * @param \PayPal\Api\ProcessorResponse $processor_response + * + * @return $this + */ + public function setProcessorResponse($processor_response) + { + $this->processor_response = $processor_response; + return $this; + } + + /** + * response codes returned from a payment processor such as avs, cvv, etc. Only supported when the `payment_method` is set to `credit_card`. + * + * @deprecated Not publicly available + * @return \PayPal\Api\ProcessorResponse + */ + public function getProcessorResponse() + { + return $this->processor_response; + } + + /** + * Fraud filter details. Only supported when the `payment_method` is set to `credit_card` + * + * @deprecated Not publicly available + * @param \PayPal\Api\FmfDetails $fmf_details + * + * @return $this + */ + public function setFmfDetails($fmf_details) + { + $this->fmf_details = $fmf_details; + return $this; + } + + /** + * Fraud filter details. Only supported when the `payment_method` is set to `credit_card` + * + * @deprecated Not publicly available + * @return \PayPal\Api\FmfDetails + */ + public function getFmfDetails() + { + return $this->fmf_details; + } + + /** + * URI for detailed information related to this error for the developer. + * + * @param string $information_link + * + * @return $this + */ + public function setInformationLink($information_link) + { + $this->information_link = $information_link; + return $this; + } + + /** + * URI for detailed information related to this error for the developer. + * + * @return string + */ + public function getInformationLink() + { + return $this->information_link; + } + + /** + * PayPal internal identifier used for correlation purposes. + * + * @param string $debug_id + * + * @return $this + */ + public function setDebugId($debug_id) + { + $this->debug_id = $debug_id; + return $this; + } + + /** + * PayPal internal identifier used for correlation purposes. + * + * @return string + */ + public function getDebugId() + { + return $this->debug_id; + } + /** * Sets Links * * @param \PayPal\Api\Links[] $links - * + * * @return $this */ public function setLinks($links) diff --git a/lib/PayPal/Api/ErrorDetails.php b/lib/PayPal/Api/ErrorDetails.php index 99158da..2885a2e 100644 --- a/lib/PayPal/Api/ErrorDetails.php +++ b/lib/PayPal/Api/ErrorDetails.php @@ -13,8 +13,6 @@ use PayPal\Common\PayPalModel; * * @property string field * @property string issue - * @property string purchase_unit_reference_id - * @property string code */ class ErrorDetails extends PayPalModel { @@ -22,7 +20,7 @@ class ErrorDetails extends PayPalModel * Name of the field that caused the error. * * @param string $field - * + * * @return $this */ public function setField($field) @@ -45,7 +43,7 @@ class ErrorDetails extends PayPalModel * Reason for the error. * * @param string $issue - * + * * @return $this */ public function setIssue($issue) @@ -67,8 +65,9 @@ class ErrorDetails extends PayPalModel /** * 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) @@ -80,6 +79,7 @@ class ErrorDetails extends PayPalModel /** * Reference ID of the purchase_unit associated with this error * + * @deprecated Not publicly available * @return string */ public function getPurchaseUnitReferenceId() @@ -90,8 +90,9 @@ class ErrorDetails extends PayPalModel /** * PayPal internal error code. * + * @deprecated Not publicly available * @param string $code - * + * * @return $this */ public function setCode($code) @@ -103,6 +104,7 @@ class ErrorDetails extends PayPalModel /** * PayPal internal error code. * + * @deprecated Not publicly available * @return string */ public function getCode() diff --git a/lib/PayPal/Api/ExtendedBankAccount.php b/lib/PayPal/Api/ExtendedBankAccount.php index a49c4a5..ce771b2 100644 --- a/lib/PayPal/Api/ExtendedBankAccount.php +++ b/lib/PayPal/Api/ExtendedBankAccount.php @@ -9,15 +9,15 @@ namespace PayPal\Api; * * @package PayPal\Api * - * @property string mandate_reference_number */ -class ExtendedBankAccount extends BankAccount +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) @@ -29,6 +29,7 @@ class ExtendedBankAccount extends BankAccount /** * Identifier of the direct debit mandate to validate. Currently supported only for EU bank accounts(SEPA). * + * @deprecated Not publicly available * @return string */ public function getMandateReferenceNumber() diff --git a/lib/PayPal/Api/ExternalFunding.php b/lib/PayPal/Api/ExternalFunding.php new file mode 100644 index 0000000..67eb2b9 --- /dev/null +++ b/lib/PayPal/Api/ExternalFunding.php @@ -0,0 +1,137 @@ +reference_id = $reference_id; + return $this; + } + + /** + * Unique identifier for the external funding + * + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + + /** + * Generic identifier for the external funding + * + * @param string $code + * + * @return $this + */ + public function setCode($code) + { + $this->code = $code; + return $this; + } + + /** + * Generic identifier for the external funding + * + * @return string + */ + public function getCode() + { + return $this->code; + } + + /** + * Encrypted PayPal Account identifier for the funding account + * + * @param string $funding_account_id + * + * @return $this + */ + public function setFundingAccountId($funding_account_id) + { + $this->funding_account_id = $funding_account_id; + return $this; + } + + /** + * Encrypted PayPal Account identifier for the funding account + * + * @return string + */ + public function getFundingAccountId() + { + return $this->funding_account_id; + } + + /** + * Description of the external funding being applied + * + * @param string $display_text + * + * @return $this + */ + public function setDisplayText($display_text) + { + $this->display_text = $display_text; + return $this; + } + + /** + * Description of the external funding being applied + * + * @return string + */ + public function getDisplayText() + { + return $this->display_text; + } + + /** + * Amount being funded by the external funding account + * + * @param \PayPal\Api\Amount $amount + * + * @return $this + */ + public function setAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** + * Amount being funded by the external funding account + * + * @return \PayPal\Api\Amount + */ + public function getAmount() + { + return $this->amount; + } + +} diff --git a/lib/PayPal/Api/FmfDetails.php b/lib/PayPal/Api/FmfDetails.php index 018ea26..0d58cef 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) @@ -44,10 +44,10 @@ class FmfDetails extends PayPalModel /** * Filter Identifier. - * 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_MATCH", "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"] + * 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 @@ class FmfDetails extends PayPalModel * Name of the filter * * @param string $name - * + * * @return $this */ public function setName($name) @@ -93,7 +93,7 @@ class FmfDetails extends PayPalModel * 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 aa916e4..00bad31 100644 --- a/lib/PayPal/Api/FundingDetail.php +++ b/lib/PayPal/Api/FundingDetail.php @@ -13,6 +13,8 @@ use PayPal\Common\PayPalModel; * * @property string clearing_time * @property string payment_hold_date + * @property string payment_debit_date + * @property string processing_type */ class FundingDetail extends PayPalModel { @@ -20,7 +22,7 @@ class FundingDetail extends PayPalModel * Expected clearing time * * @param string $clearing_time - * + * * @return $this */ public function setClearingTime($clearing_time) @@ -40,10 +42,10 @@ class FundingDetail extends PayPalModel } /** - * Hold-off duration of the payment + * [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) @@ -53,7 +55,7 @@ class FundingDetail extends PayPalModel } /** - * Hold-off duration of the payment + * @deprecated [DEPRECATED] Hold-off duration of the payment. payment_debit_date should be used instead. * * @return string */ @@ -62,4 +64,51 @@ class FundingDetail extends PayPalModel return $this->payment_hold_date; } + /** + * Date when funds will be debited from the payer's account + * + * @param string $payment_debit_date + * + * @return $this + */ + public function setPaymentDebitDate($payment_debit_date) + { + $this->payment_debit_date = $payment_debit_date; + return $this; + } + + /** + * Date when funds will be debited from the payer's account + * + * @return string + */ + public function getPaymentDebitDate() + { + return $this->payment_debit_date; + } + + /** + * Processing type of the payment card + * Valid Values: ["PINLESS_DEBIT"] + * + * @param string $processing_type + * + * @return $this + */ + public function setProcessingType($processing_type) + { + $this->processing_type = $processing_type; + return $this; + } + + /** + * Processing type of the payment card + * + * @return string + */ + public function getProcessingType() + { + return $this->processing_type; + } + } diff --git a/lib/PayPal/Api/FundingInstrument.php b/lib/PayPal/Api/FundingInstrument.php index 19cddcd..1890730 100644 --- a/lib/PayPal/Api/FundingInstrument.php +++ b/lib/PayPal/Api/FundingInstrument.php @@ -7,28 +7,21 @@ use PayPal\Common\PayPalModel; /** * Class FundingInstrument * - * A resource representing a Payer's funding instrument. + * A resource representing a Payer's funding instrument. An instance of this schema is valid if and only if it is valid against exactly one of these supported properties * * @package PayPal\Api * - * @property \PayPal\Api\CreditCard credit_card - * @property \PayPal\Api\ExtendedBankAccount bank_account + * @property \PayPal\Api\CreditCard credit_card * @property \PayPal\Api\CreditCardToken credit_card_token - * @property \PayPal\Api\Incentive incentive - * @property \PayPal\Api\PaymentCard payment_card - * @property \PayPal\Api\PaymentCardToken payment_card_token - * @property \PayPal\Api\BankToken bank_account_token - * @property \PayPal\Api\Credit credit - * @property \PayPal\Api\CarrierAccountToken carrier_account_token - * + * @property \PayPal\Api\Billing billing */ class FundingInstrument extends PayPalModel { /** - * Credit Card information. + * Credit Card instrument. * * @param \PayPal\Api\CreditCard $credit_card - * + * * @return $this */ public function setCreditCard($credit_card) @@ -38,7 +31,7 @@ class FundingInstrument extends PayPalModel } /** - * Credit Card information. + * Credit Card instrument. * * @return \PayPal\Api\CreditCard */ @@ -48,10 +41,10 @@ class FundingInstrument extends PayPalModel } /** - * Credit Card information. + * PayPal vaulted credit Card instrument. * * @param \PayPal\Api\CreditCardToken $credit_card_token - * + * * @return $this */ public function setCreditCardToken($credit_card_token) @@ -61,7 +54,7 @@ class FundingInstrument extends PayPalModel } /** - * Credit Card information. + * PayPal vaulted credit Card instrument. * * @return \PayPal\Api\CreditCardToken */ @@ -73,8 +66,9 @@ class FundingInstrument extends PayPalModel /** * Payment Card information. * + * @deprecated Not publicly available * @param \PayPal\Api\PaymentCard $payment_card - * + * * @return $this */ public function setPaymentCard($payment_card) @@ -86,6 +80,7 @@ class FundingInstrument extends PayPalModel /** * Payment Card information. * + * @deprecated Not publicly available * @return \PayPal\Api\PaymentCard */ public function getPaymentCard() @@ -93,34 +88,12 @@ class FundingInstrument extends PayPalModel return $this->payment_card; } - /** - * Payment card token information. - * - * @param \PayPal\Api\PaymentCardToken $payment_card_token - * - * @return $this - */ - public function setPaymentCardToken($payment_card_token) - { - $this->payment_card_token = $payment_card_token; - return $this; - } - - /** - * Payment card token information. - * - * @return \PayPal\Api\PaymentCardToken - */ - public function getPaymentCardToken() - { - return $this->payment_card_token; - } - /** * Bank Account information. * + * @deprecated Not publicly available * @param \PayPal\Api\ExtendedBankAccount $bank_account - * + * * @return $this */ public function setBankAccount($bank_account) @@ -132,6 +105,7 @@ class FundingInstrument extends PayPalModel /** * Bank Account information. * + * @deprecated Not publicly available * @return \PayPal\Api\ExtendedBankAccount */ public function getBankAccount() @@ -140,10 +114,11 @@ class FundingInstrument extends PayPalModel } /** - * Bank Account information. + * Vaulted bank account instrument. * + * @deprecated Not publicly available * @param \PayPal\Api\BankToken $bank_account_token - * + * * @return $this */ public function setBankAccountToken($bank_account_token) @@ -153,8 +128,9 @@ class FundingInstrument extends PayPalModel } /** - * Bank Account information. + * Vaulted bank account instrument. * + * @deprecated Not publicly available * @return \PayPal\Api\BankToken */ public function getBankAccountToken() @@ -163,10 +139,11 @@ class FundingInstrument extends PayPalModel } /** - * Credit funding information. + * PayPal credit funding instrument. * + * @deprecated Not publicly available * @param \PayPal\Api\Credit $credit - * + * * @return $this */ public function setCredit($credit) @@ -176,8 +153,9 @@ class FundingInstrument extends PayPalModel } /** - * Credit funding information. + * PayPal credit funding instrument. * + * @deprecated Not publicly available * @return \PayPal\Api\Credit */ public function getCredit() @@ -186,8 +164,9 @@ class FundingInstrument extends PayPalModel } /** - * Incentive funding information. + * Incentive funding instrument. * + * @deprecated Not publicly available * @param \PayPal\Api\Incentive $incentive * * @return $this @@ -199,8 +178,9 @@ class FundingInstrument extends PayPalModel } /** - * Incentive funding information. + * Incentive funding instrument. * + * @deprecated Not publicly available * @return \PayPal\Api\Incentive */ public function getIncentive() @@ -209,8 +189,34 @@ class FundingInstrument extends PayPalModel } /** - * Carrier account token information. + * External funding instrument. * + * @deprecated Not publicly available + * @param \PayPal\Api\ExternalFunding $external_funding + * + * @return $this + */ + public function setExternalFunding($external_funding) + { + $this->external_funding = $external_funding; + return $this; + } + + /** + * External funding instrument. + * + * @deprecated Not publicly available + * @return \PayPal\Api\ExternalFunding + */ + public function getExternalFunding() + { + return $this->external_funding; + } + + /** + * Carrier account token instrument. + * + * @deprecated Not publicly available * @param \PayPal\Api\CarrierAccountToken $carrier_account_token * * @return $this @@ -222,8 +228,9 @@ class FundingInstrument extends PayPalModel } /** - * Carrier account token information. + * Carrier account token instrument. * + * @deprecated Not publicly available * @return \PayPal\Api\CarrierAccountToken */ public function getCarrierAccountToken() @@ -231,4 +238,102 @@ class FundingInstrument extends PayPalModel return $this->carrier_account_token; } + /** + * Carrier account instrument + * + * @deprecated Not publicly available + * @param \PayPal\Api\CarrierAccount $carrier_account + * + * @return $this + */ + public function setCarrierAccount($carrier_account) + { + $this->carrier_account = $carrier_account; + return $this; + } + + /** + * Carrier account instrument + * + * @deprecated Not publicly available + * @return \PayPal\Api\CarrierAccount + */ + public function getCarrierAccount() + { + return $this->carrier_account; + } + + /** + * 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 + * + * @return $this + */ + public function setPrivateLabelCard($private_label_card) + { + $this->private_label_card = $private_label_card; + return $this; + } + + /** + * 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 + */ + public function getPrivateLabelCard() + { + return $this->private_label_card; + } + + /** + * Billing instrument that references pre-approval information for the payment + * + * @param \PayPal\Api\Billing $billing + * + * @return $this + */ + public function setBilling($billing) + { + $this->billing = $billing; + return $this; + } + + /** + * Billing instrument that references pre-approval information for the payment + * + * @return \PayPal\Api\Billing + */ + public function getBilling() + { + return $this->billing; + } + + /** + * Alternate Payment information - Mostly regional payment providers. For e.g iDEAL in Netherlands + * + * @deprecated Not publicly available + * @param \PayPal\Api\AlternatePayment $alternate_payment + * + * @return $this + */ + public function setAlternatePayment($alternate_payment) + { + $this->alternate_payment = $alternate_payment; + return $this; + } + + /** + * Alternate Payment information - Mostly regional payment providers. For e.g iDEAL in Netherlands + * + * @deprecated Not publicly available + * @return \PayPal\Api\AlternatePayment + */ + public function getAlternatePayment() + { + return $this->alternate_payment; + } + } diff --git a/lib/PayPal/Api/FundingSource.php b/lib/PayPal/Api/FundingSource.php index e6decf5..5b39be6 100644 --- a/lib/PayPal/Api/FundingSource.php +++ b/lib/PayPal/Api/FundingSource.php @@ -11,15 +11,16 @@ use PayPal\Common\PayPalModel; * * @package PayPal\Api * - * @property string funding_mode - * @property string funding_instrument_type - * @property string soft_descriptor - * @property \PayPal\Api\Currency amount - * @property string legal_text - * @property \PayPal\Api\FundingDetail funding_detail - * @property string additional_text + * @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 \PayPal\Api\Links[] links */ class FundingSource extends PayPalModel { @@ -28,7 +29,7 @@ class FundingSource extends PayPalModel * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $funding_mode - * + * * @return $this */ public function setFundingMode($funding_mode) @@ -52,7 +53,7 @@ class FundingSource extends PayPalModel * Valid Values: ["BALANCE", "PAYMENT_CARD", "BANK_ACCOUNT", "CREDIT", "INCENTIVE"] * * @param string $funding_instrument_type - * + * * @return $this */ public function setFundingInstrumentType($funding_instrument_type) @@ -75,7 +76,7 @@ class FundingSource extends PayPalModel * Soft descriptor used when charging this funding source. * * @param string $soft_descriptor - * + * * @return $this */ public function setSoftDescriptor($soft_descriptor) @@ -98,7 +99,7 @@ class FundingSource extends PayPalModel * Total anticipated amount of money to be pulled from instrument. * * @param \PayPal\Api\Currency $amount - * + * * @return $this */ public function setAmount($amount) @@ -117,11 +118,34 @@ class FundingSource extends PayPalModel return $this->amount; } + /** + * Additional amount to be pulled from the instrument to recover a negative balance on the buyer + * + * @param \PayPal\Api\Currency $amount + * + * @return $this + */ + public function setNegativeBalanceAmount($amount) + { + $this->amount = $amount; + return $this; + } + + /** + * Additional amount to be pulled from the instrument to recover a negative balance on the buyer + * + * @return \PayPal\Api\Currency + */ + public function getNegativeBalanceAmount() + { + return $this->amount; + } + /** * Localized legal text relevant to funding source. * * @param string $legal_text - * + * * @return $this */ public function setLegalText($legal_text) @@ -144,7 +168,7 @@ class FundingSource extends PayPalModel * Additional detail of the funding. * * @param \PayPal\Api\FundingDetail $funding_detail - * + * * @return $this */ public function setFundingDetail($funding_detail) @@ -167,7 +191,7 @@ class FundingSource extends PayPalModel * Additional text relevant to funding source. * * @param string $additional_text - * + * * @return $this */ public function setAdditionalText($additional_text) @@ -190,7 +214,7 @@ class FundingSource extends PayPalModel * Sets Extends * * @param \PayPal\Api\FundingInstrument $extends - * + * * @return $this */ public function setExtends($extends) @@ -213,7 +237,7 @@ class FundingSource extends PayPalModel * 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 e4902fd..017a34d 100644 --- a/lib/PayPal/Api/Incentive.php +++ b/lib/PayPal/Api/Incentive.php @@ -12,15 +12,15 @@ use PayPal\Validation\UrlValidator; * * @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 @@ class Incentive extends PayPalModel * Code that identifies the incentive. * * @param string $code - * + * * @return $this */ public function setCode($code) @@ -74,7 +74,7 @@ class Incentive extends PayPalModel * Name of the incentive. * * @param string $name - * + * * @return $this */ public function setName($name) @@ -97,7 +97,7 @@ class Incentive extends PayPalModel * Description of the incentive. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -120,7 +120,7 @@ class Incentive extends PayPalModel * 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 @@ class Incentive extends PayPalModel * expiry date of the incentive. * * @param string $expiry_date - * + * * @return $this */ public function setExpiryDate($expiry_date) @@ -188,10 +188,10 @@ class Incentive extends PayPalModel /** * Specifies type of incentive - * Valid Values: ["COUPON", "GIFT_CARD", "MERCHANT_SPECIFIC_BALANCE"] + * Valid Values: ["COUPON", "GIFT_CARD", "MERCHANT_SPECIFIC_BALANCE", "VOUCHER"] * * @param string $type - * + * * @return $this */ public function setType($type) @@ -214,7 +214,7 @@ class Incentive extends PayPalModel * 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 78d1767..43342b7 100644 --- a/lib/PayPal/Api/InstallmentOption.php +++ b/lib/PayPal/Api/InstallmentOption.php @@ -3,8 +3,6 @@ namespace PayPal\Api; use PayPal\Common\PayPalModel; -use PayPal\Converter\FormatConverter; -use PayPal\Validation\NumericValidator; /** * Class InstallmentOption @@ -13,9 +11,9 @@ use PayPal\Validation\NumericValidator; * * @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 @@ -24,7 +22,7 @@ class InstallmentOption extends PayPalModel * Number of installments * * @param int $term - * + * * @return $this */ public function setTerm($term) @@ -47,7 +45,7 @@ class InstallmentOption extends PayPalModel * Monthly payment * * @param \PayPal\Api\Currency $monthly_payment - * + * * @return $this */ public function setMonthlyPayment($monthly_payment) @@ -70,7 +68,7 @@ class InstallmentOption extends PayPalModel * Discount amount applied to the payment, if any * * @param \PayPal\Api\Currency $discount_amount - * + * * @return $this */ public function setDiscountAmount($discount_amount) @@ -93,13 +91,11 @@ class InstallmentOption extends PayPalModel * Discount percentage applied to the payment, if any * * @param string $discount_percentage - * + * * @return $this */ public function setDiscountPercentage($discount_percentage) { - NumericValidator::validate($discount_percentage, "Discount Percentage"); - $discount_percentage = FormatConverter::formatToPrice($discount_percentage); $this->discount_percentage = $discount_percentage; return $this; } @@ -114,5 +110,4 @@ class InstallmentOption extends PayPalModel return $this->discount_percentage; } - } diff --git a/lib/PayPal/Api/Item.php b/lib/PayPal/Api/Item.php index cef1d1a..4c647ab 100644 --- a/lib/PayPal/Api/Item.php +++ b/lib/PayPal/Api/Item.php @@ -10,56 +10,50 @@ use PayPal\Validation\UrlValidator; /** * Class Item * - * An item being paid for. + * Item details. * * @package PayPal\Api * - * @property string quantity + * @property string sku * @property string name * @property string description + * @property string quantity * @property string price - * @property string tax * @property string currency - * @property string sku + * @property string tax * @property string url * @property string category - * @property \PayPal\Api\Measurement weight - * @property \PayPal\Api\Measurement length - * @property \PayPal\Api\Measurement height - * @property \PayPal\Api\Measurement width - * @property \PayPal\Api\NameValuePair[] supplementary_data - * @property \PayPal\Api\NameValuePair[] postback_data */ class Item extends PayPalModel { /** - * Number of items. + * Stock keeping unit corresponding (SKU) to item. + * + * @param string $sku * - * @param string $quantity - * * @return $this */ - public function setQuantity($quantity) + public function setSku($sku) { - $this->quantity = $quantity; + $this->sku = $sku; return $this; } /** - * Number of items. + * Stock keeping unit corresponding (SKU) to item. * * @return string */ - public function getQuantity() + public function getSku() { - return $this->quantity; + return $this->sku; } /** - * Name of the item. + * Item name. 127 characters max. * * @param string $name - * + * * @return $this */ public function setName($name) @@ -69,7 +63,7 @@ class Item extends PayPalModel } /** - * Name of the item. + * Item name. 127 characters max. * * @return string */ @@ -79,10 +73,10 @@ class Item extends PayPalModel } /** - * Description of the item. + * Description of the item. Only supported when the `payment_method` is set to `paypal`. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -92,7 +86,7 @@ class Item extends PayPalModel } /** - * Description of the item. + * Description of the item. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -102,10 +96,33 @@ class Item extends PayPalModel } /** - * Cost of the item. + * Number of a particular item. 10 characters max. + * + * @param string $quantity + * + * @return $this + */ + public function setQuantity($quantity) + { + $this->quantity = $quantity; + return $this; + } + + /** + * Number of a particular item. 10 characters max. + * + * @return string + */ + public function getQuantity() + { + return $this->quantity; + } + + /** + * Item cost. 10 characters max. * * @param string|double $price - * + * * @return $this */ public function setPrice($price) @@ -117,7 +134,7 @@ class Item extends PayPalModel } /** - * Cost of the item. + * Item cost. 10 characters max. * * @return string */ @@ -127,10 +144,33 @@ class Item extends PayPalModel } /** - * tax of the item. + * 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) + { + $this->currency = $currency; + return $this; + } + + /** + * 3-letter [currency code](https://developer.paypal.com/docs/integration/direct/rest_api_payment_country_currency_support/). + * + * @return string + */ + public function getCurrency() + { + return $this->currency; + } + + /** + * Tax of the item. Only supported when the `payment_method` is set to `paypal`. * * @param string|double $tax - * + * * @return $this */ public function setTax($tax) @@ -142,7 +182,7 @@ class Item extends PayPalModel } /** - * tax of the item. + * Tax of the item. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -151,52 +191,6 @@ class Item extends PayPalModel return $this->tax; } - /** - * 3-letter Currency Code - * - * @param string $currency - * - * @return $this - */ - public function setCurrency($currency) - { - $this->currency = $currency; - return $this; - } - - /** - * 3-letter Currency Code - * - * @return string - */ - public function getCurrency() - { - return $this->currency; - } - - /** - * Number or code to identify the item in your catalog/records. - * - * @param string $sku - * - * @return $this - */ - public function setSku($sku) - { - $this->sku = $sku; - return $this; - } - - /** - * Number or code to identify the item in your catalog/records. - * - * @return string - */ - public function getSku() - { - return $this->sku; - } - /** * URL linking to item information. Available to payer in transaction history. * @@ -226,7 +220,7 @@ class Item extends PayPalModel * Valid Values: ["DIGITAL", "PHYSICAL"] * * @param string $category - * + * * @return $this */ public function setCategory($category) @@ -248,8 +242,9 @@ class Item extends PayPalModel /** * Weight of the item. * + * @deprecated Not publicly available * @param \PayPal\Api\Measurement $weight - * + * * @return $this */ public function setWeight($weight) @@ -261,6 +256,7 @@ class Item extends PayPalModel /** * Weight of the item. * + * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getWeight() @@ -271,8 +267,9 @@ class Item extends PayPalModel /** * Length of the item. * + * @deprecated Not publicly available * @param \PayPal\Api\Measurement $length - * + * * @return $this */ public function setLength($length) @@ -284,6 +281,7 @@ class Item extends PayPalModel /** * Length of the item. * + * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getLength() @@ -294,8 +292,9 @@ class Item extends PayPalModel /** * Height of the item. * + * @deprecated Not publicly available * @param \PayPal\Api\Measurement $height - * + * * @return $this */ public function setHeight($height) @@ -307,6 +306,7 @@ class Item extends PayPalModel /** * Height of the item. * + * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getHeight() @@ -317,8 +317,9 @@ class Item extends PayPalModel /** * Width of the item. * + * @deprecated Not publicly available * @param \PayPal\Api\Measurement $width - * + * * @return $this */ public function setWidth($width) @@ -330,6 +331,7 @@ class Item extends PayPalModel /** * Width of the item. * + * @deprecated Not publicly available * @return \PayPal\Api\Measurement */ public function getWidth() @@ -340,8 +342,9 @@ class Item extends PayPalModel /** * 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) @@ -353,6 +356,7 @@ class Item extends PayPalModel /** * Set of optional data used for PayPal risk determination. * + * @deprecated Not publicly available * @return \PayPal\Api\NameValuePair[] */ public function getSupplementaryData() @@ -363,6 +367,7 @@ class Item extends PayPalModel /** * Append SupplementaryData to the list. * + * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ @@ -380,6 +385,7 @@ class Item extends PayPalModel /** * Remove SupplementaryData from the list. * + * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ @@ -393,8 +399,9 @@ class Item extends PayPalModel /** * 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) @@ -406,6 +413,7 @@ class Item extends PayPalModel /** * Set of optional data used for PayPal post-transaction notifications. * + * @deprecated Not publicly available * @return \PayPal\Api\NameValuePair[] */ public function getPostbackData() @@ -416,6 +424,7 @@ class Item extends PayPalModel /** * Append PostbackData to the list. * + * @deprecated Not publicly available * @param \PayPal\Api\NameValuePair $nameValuePair * @return $this */ @@ -433,6 +442,7 @@ class Item extends PayPalModel /** * 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 271895d..3b674ad 100644 --- a/lib/PayPal/Api/ItemList.php +++ b/lib/PayPal/Api/ItemList.php @@ -7,29 +7,22 @@ use PayPal\Common\PayPalModel; /** * Class ItemList * - * List of items being paid for. + * Items and related shipping address within a transaction. * * @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_method + * @property string shipping_phone_number */ class ItemList extends PayPalModel { - /** - * Is this list empty? - */ - public function isEmpty() - { - return empty($this->items); - } - /** * List of items. * * @param \PayPal\Api\Item[] $items - * + * * @return $this */ public function setItems($items) @@ -79,10 +72,10 @@ class ItemList extends PayPalModel } /** - * Shipping address. + * Shipping address, if different than the payer address. * * @param \PayPal\Api\ShippingAddress $shipping_address - * + * * @return $this */ public function setShippingAddress($shipping_address) @@ -92,7 +85,7 @@ class ItemList extends PayPalModel } /** - * Shipping address. + * Shipping address, if different than the payer address. * * @return \PayPal\Api\ShippingAddress */ @@ -105,7 +98,7 @@ class ItemList extends PayPalModel * Shipping method used for this payment like USPSParcel etc. * * @param string $shipping_method - * + * * @return $this */ public function setShippingMethod($shipping_method) @@ -124,4 +117,27 @@ class ItemList extends PayPalModel return $this->shipping_method; } + /** + * 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) + { + $this->shipping_phone_number = $shipping_phone_number; + return $this; + } + + /** + * 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 + * + * @return string + */ + public function getShippingPhoneNumber() + { + return $this->shipping_phone_number; + } + } diff --git a/lib/PayPal/Api/Order.php b/lib/PayPal/Api/Order.php index d8153db..f611ff7 100644 --- a/lib/PayPal/Api/Order.php +++ b/lib/PayPal/Api/Order.php @@ -4,7 +4,6 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** @@ -14,19 +13,20 @@ use PayPal\Validation\ArgumentValidator; * * @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 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 \PayPal\Api\FmfDetails fmf_details - * @property string create_time - * @property string update_time + * @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) @@ -57,7 +57,7 @@ class Order extends PayPalResourceModel * Identifier to the purchase unit associated with this object. Obsolete. Use one in cart_base. * * @param string $purchase_unit_reference_id - * + * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) @@ -80,7 +80,7 @@ class Order extends PayPalResourceModel * Amount being collected. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -104,7 +104,7 @@ class Order extends PayPalResourceModel * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $payment_mode - * + * * @return $this */ public function setPaymentMode($payment_mode) @@ -128,7 +128,7 @@ class Order extends PayPalResourceModel * Valid Values: ["pending", "completed", "refunded", "partially_refunded", "voided"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -148,11 +148,11 @@ class Order extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually + * Reason code for the transaction state being Pending or Reversed. 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 +162,7 @@ class Order extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending or Reversed. This field will replace pending_reason field eventually + * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -172,11 +172,11 @@ class Order extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending. Obsolete. Retained for backward compatability. Use reason_code field above instead. + * [DEPRECATED] Reason the transaction is in pending state. 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 +186,7 @@ class Order extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending. Obsolete. Retained for backward compatability. Use reason_code field above instead. + * @deprecated [DEPRECATED] Reason the transaction is in pending state. Use reason_code field above instead. * * @return string */ @@ -196,58 +196,58 @@ class Order extends PayPalResourceModel } /** - * Protection Eligibility of the Payer + * The level of seller protection in force for the transaction. * Valid Values: ["ELIGIBLE", "PARTIALLY_ELIGIBLE", "INELIGIBLE"] * * @param string $protection_eligibility - * + * * @return $this */ public function setProtectionEligibility($protection_eligibility) { - $this->{"protection-eligibility"} = $protection_eligibility; + $this->protection_eligibility = $protection_eligibility; return $this; } /** - * Protection Eligibility of the Payer + * The level of seller protection in force for the transaction. * * @return string */ public function getProtectionEligibility() { - return $this->{"protection-eligibility"}; + return $this->protection_eligibility; } /** - * Protection Eligibility Type of the Payer - * Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"] + * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:
`ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.
`UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.
One or both of the allowed values can be returned. + * 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) { - $this->{"protection-eligibility_type"} = $protection_eligibility_type; + $this->protection_eligibility_type = $protection_eligibility_type; return $this; } /** - * Protection Eligibility Type of the Payer + * The kind of seller protection in force for the transaction. This property is returned only when the `protection_eligibility` property is set to `ELIGIBLE`or `PARTIALLY_ELIGIBLE`. Only supported when the `payment_method` is set to `paypal`. Allowed values:
`ITEM_NOT_RECEIVED_ELIGIBLE`- Sellers are protected against claims for items not received.
`UNAUTHORIZED_PAYMENT_ELIGIBLE`- Sellers are protected against claims for unauthorized payments.
One or both of the allowed values can be returned. * * @return string */ public function getProtectionEligibilityType() { - return $this->{"protection-eligibility_type"}; + return $this->protection_eligibility_type; } /** * ID of the Payment resource that this transaction is based on. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -270,7 +270,7 @@ class Order extends PayPalResourceModel * 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 +293,7 @@ class Order extends PayPalResourceModel * Time the resource was created in UTC ISO8601 format. * * @param string $create_time - * + * * @return $this */ public function setCreateTime($create_time) @@ -316,7 +316,7 @@ class Order extends PayPalResourceModel * Time the resource was last updated in UTC ISO8601 format. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -338,9 +338,9 @@ class Order extends PayPalResourceModel /** * Retrieve details about an order by passing the order_id in the request URI. * - * @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 +361,11 @@ class Order extends PayPalResourceModel } /** - * Capture a payment on an order by passing the order_id in the request URI. 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. To issue this request, an original payment call must specify an intent of order. + * 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. * - * @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) @@ -389,8 +389,8 @@ class Order extends PayPalResourceModel /** * 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. * - * @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) @@ -413,8 +413,8 @@ class Order extends PayPalResourceModel * 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. * * @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 739ff9c..152f92c 100644 --- a/lib/PayPal/Api/Patch.php +++ b/lib/PayPal/Api/Patch.php @@ -7,13 +7,13 @@ use PayPal\Common\PayPalModel; /** * Class Patch * - * A JSON Patch object used for doing partial updates to resources. + * A JSON patch object used for applying partial updates to resources. * * @package PayPal\Api * * @property string op * @property string path - * @property mixed value + * @property mixed value * @property string from */ class Patch extends PayPalModel @@ -23,7 +23,7 @@ class Patch extends PayPalModel * Valid Values: ["add", "remove", "replace", "move", "copy", "test"] * * @param string $op - * + * * @return $this */ public function setOp($op) @@ -43,10 +43,10 @@ class Patch extends PayPalModel } /** - * String containing a JSON-Pointer value that references a location within the target document where the operation is performed. + * String containing a JSON Pointer value that references a location within the target document where the operation is performed. * * @param string $path - * + * * @return $this */ public function setPath($path) @@ -56,7 +56,7 @@ class Patch extends PayPalModel } /** - * String containing a JSON-Pointer value that references a location within the target document where the operation is performed. + * String containing a JSON Pointer value that references a location within the target document where the operation is performed. * * @return string */ @@ -69,7 +69,7 @@ class Patch extends PayPalModel * New value to apply based on the operation. * * @param mixed $value - * + * * @return $this */ public function setValue($value) @@ -89,10 +89,10 @@ class Patch extends PayPalModel } /** - * A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move. + * A string containing a JSON Pointer value that references the location in the target document to move the value from. * * @param string $from - * + * * @return $this */ public function setFrom($from) @@ -102,7 +102,7 @@ class Patch extends PayPalModel } /** - * A string containing a JSON Pointer value that references the location in the target document from which to move the value. Required for use where op=move. + * A string containing a JSON Pointer value that references the location in the target document to move the value from. * * @return string */ diff --git a/lib/PayPal/Api/Payee.php b/lib/PayPal/Api/Payee.php index 6225f6b..c0fde8f 100644 --- a/lib/PayPal/Api/Payee.php +++ b/lib/PayPal/Api/Payee.php @@ -7,22 +7,20 @@ use PayPal\Common\PayPalModel; /** * Class Payee * - * A resource representing a Payee that received the funds and fulfills the order. Only one of the following identifiers need to be supplied. + * A resource representing a Payee who receives the funds and fulfills the order. * * @package PayPal\Api * * @property string email * @property string merchant_id - * @property \PayPal\Api\Phone phone */ 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. - * * * @param string $email - * + * * @return $this */ public function setEmail($email) @@ -42,11 +40,10 @@ class Payee extends PayPalModel } /** - * Encrypted PayPal Account identifier for the Payee. - * + * Encrypted PayPal account identifier for the Payee. * * @param string $merchant_id - * + * * @return $this */ public function setMerchantId($merchant_id) @@ -56,7 +53,7 @@ class Payee extends PayPalModel } /** - * Encrypted PayPal Account identifier for the Payee. + * Encrypted PayPal account identifier for the Payee. * * @return string */ @@ -66,11 +63,86 @@ class Payee extends PayPalModel } /** - * 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. - * + * First Name of the Payee. * + * @deprecated Not publicly available + * @param string $first_name + * + * @return $this + */ + public function setFirstName($first_name) + { + $this->first_name = $first_name; + return $this; + } + + /** + * First Name of the Payee. + * + * @deprecated Not publicly available + * @return string + */ + public function getFirstName() + { + return $this->first_name; + } + + /** + * Last Name of the Payee. + * + * @deprecated Not publicly available + * @param string $last_name + * + * @return $this + */ + public function setLastName($last_name) + { + $this->last_name = $last_name; + return $this; + } + + /** + * Last Name of the Payee. + * + * @deprecated Not publicly available + * @return string + */ + public function getLastName() + { + return $this->last_name; + } + + /** + * Unencrypted PayPal account Number of the Payee + * + * @deprecated Not publicly available + * @param string $account_number + * + * @return $this + */ + public function setAccountNumber($account_number) + { + $this->account_number = $account_number; + return $this; + } + + /** + * Unencrypted PayPal account Number of the Payee + * + * @deprecated Not publicly available + * @return string + */ + public function getAccountNumber() + { + return $this->account_number; + } + + /** + * 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. + * + * @deprecated Not publicly available * @param \PayPal\Api\Phone $phone - * + * * @return $this */ public function setPhone($phone) @@ -80,8 +152,9 @@ class Payee extends PayPalModel } /** - * 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 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. * + * @deprecated Not publicly available * @return \PayPal\Api\Phone */ public function getPhone() diff --git a/lib/PayPal/Api/Payer.php b/lib/PayPal/Api/Payer.php index 2aa9eb5..860d095 100644 --- a/lib/PayPal/Api/Payer.php +++ b/lib/PayPal/Api/Payer.php @@ -11,24 +11,20 @@ use PayPal\Common\PayPalModel; * * @package PayPal\Api * - * @property string payment_method - * @property string status - * @property string account_type - * @property string account_age + * @property string payment_method + * @property string status * @property \PayPal\Api\FundingInstrument[] funding_instruments - * @property string funding_option_id - * @property \PayPal\Api\FundingOption funding_option - * @property \PayPal\Api\FundingOption related_funding_option - * @property \PayPal\Api\PayerInfo payer_info + * @property string funding_option_id + * @property \PayPal\Api\PayerInfo payer_info */ class Payer extends PayPalModel { /** * Payment method being used - PayPal Wallet payment, Bank Direct Debit or Direct Credit card. - * Valid Values: ["credit_card", "bank", "paypal", "pay_upon_invoice", "carrier"] + * Valid Values: ["credit_card", "bank", "paypal", "pay_upon_invoice", "carrier", "alternate_payment"] * * @param string $payment_method - * + * * @return $this */ public function setPaymentMethod($payment_method) @@ -52,7 +48,7 @@ class Payer extends PayPalModel * Valid Values: ["VERIFIED", "UNVERIFIED"] * * @param string $status - * + * * @return $this */ public function setStatus($status) @@ -75,8 +71,9 @@ class Payer extends PayPalModel * 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) @@ -88,6 +85,7 @@ class Payer extends PayPalModel /** * Type of account relationship payer has with PayPal. * + * @deprecated Not publicly available * @return string */ public function getAccountType() @@ -98,8 +96,9 @@ class Payer extends PayPalModel /** * 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) @@ -111,6 +110,7 @@ class Payer extends PayPalModel /** * Duration since the payer established account relationship with PayPal in days. * + * @deprecated Not publicly available * @return string */ public function getAccountAge() @@ -119,10 +119,10 @@ class Payer extends PayPalModel } /** - * List of funding instruments to fund the payment. + * 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) @@ -132,7 +132,7 @@ class Payer extends PayPalModel } /** - * List of funding instruments to fund the payment. + * 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. * * @return \PayPal\Api\FundingInstrument[] */ @@ -172,10 +172,10 @@ class Payer extends PayPalModel } /** - * Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present + * 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. * * @param string $funding_option_id - * + * * @return $this */ public function setFundingOptionId($funding_option_id) @@ -185,7 +185,7 @@ class Payer extends PayPalModel } /** - * Id of user selected funding option for the payment. 'OneOf' funding_instruments or funding_option_id to be present + * 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. * * @return string */ @@ -195,10 +195,11 @@ class Payer extends PayPalModel } /** - * 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) @@ -208,8 +209,9 @@ class Payer extends PayPalModel } /** - * Default funding option available for the payment + * Default funding option available for the payment * + * @deprecated Not publicly available * @return \PayPal\Api\FundingOption */ public function getFundingOption() @@ -220,8 +222,9 @@ class Payer extends PayPalModel /** * 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) @@ -233,6 +236,7 @@ class Payer extends PayPalModel /** * Funding option related to default funding option. * + * @deprecated Not publicly available * @return \PayPal\Api\FundingOption */ public function getRelatedFundingOption() @@ -241,10 +245,10 @@ class Payer extends PayPalModel } /** - * Information related to the Payer. + * Information related to the Payer. * * @param \PayPal\Api\PayerInfo $payer_info - * + * * @return $this */ public function setPayerInfo($payer_info) @@ -254,7 +258,7 @@ class Payer extends PayPalModel } /** - * 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 ff245ec..39cbfda 100644 --- a/lib/PayPal/Api/PayerInfo.php +++ b/lib/PayPal/Api/PayerInfo.php @@ -11,31 +11,30 @@ use PayPal\Common\PayPalModel; * * @package PayPal\Api * - * @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 + * @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 */ class PayerInfo extends PayPalModel { /** - * Email address representing the Payer. + * Email address representing the payer. 127 characters max. * * @param string $email - * + * * @return $this */ public function setEmail($email) @@ -45,7 +44,7 @@ class PayerInfo extends PayPalModel } /** - * Email address representing the Payer. + * Email address representing the payer. 127 characters max. * * @return string */ @@ -55,10 +54,10 @@ class PayerInfo extends PayPalModel } /** - * External Remember Me id representing the Payer + * External Remember Me id representing the payer * * @param string $external_remember_me_id - * + * * @return $this */ public function setExternalRememberMeId($external_remember_me_id) @@ -68,7 +67,7 @@ class PayerInfo extends PayPalModel } /** - * External Remember Me id representing the Payer + * External Remember Me id representing the payer * * @return string */ @@ -80,31 +79,33 @@ class PayerInfo extends PayPalModel /** * Account Number representing the Payer * - * @param string $buyer_account_number - * + * @deprecated Not publicly available + * @param string $account_number + * * @return $this */ - public function setBuyerAccountNumber($buyer_account_number) + public function setAccountNumber($account_number) { - $this->buyer_account_number = $buyer_account_number; + $this->account_number = $account_number; return $this; } /** * Account Number representing the Payer * + * @deprecated Not publicly available * @return string */ - public function getBuyerAccountNumber() + public function getAccountNumber() { - return $this->buyer_account_number; + return $this->account_number; } /** - * Salutation of the Payer. + * Salutation of the payer. * * @param string $salutation - * + * * @return $this */ public function setSalutation($salutation) @@ -114,7 +115,7 @@ class PayerInfo extends PayPalModel } /** - * Salutation of the Payer. + * Salutation of the payer. * * @return string */ @@ -124,10 +125,10 @@ class PayerInfo extends PayPalModel } /** - * First Name of the Payer. + * First name of the payer. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -137,7 +138,7 @@ class PayerInfo extends PayPalModel } /** - * First Name of the Payer. + * First name of the payer. * * @return string */ @@ -147,10 +148,10 @@ class PayerInfo extends PayPalModel } /** - * Middle Name of the Payer. + * Middle name of the payer. * * @param string $middle_name - * + * * @return $this */ public function setMiddleName($middle_name) @@ -160,7 +161,7 @@ class PayerInfo extends PayPalModel } /** - * Middle Name of the Payer. + * Middle name of the payer. * * @return string */ @@ -170,10 +171,10 @@ class PayerInfo extends PayPalModel } /** - * Last Name of the Payer. + * Last name of the payer. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -183,7 +184,7 @@ class PayerInfo extends PayPalModel } /** - * Last Name of the Payer. + * Last name of the payer. * * @return string */ @@ -193,10 +194,10 @@ class PayerInfo extends PayPalModel } /** - * Suffix of the Payer. + * Suffix of the payer. * * @param string $suffix - * + * * @return $this */ public function setSuffix($suffix) @@ -206,7 +207,7 @@ class PayerInfo extends PayPalModel } /** - * Suffix of the Payer. + * Suffix of the payer. * * @return string */ @@ -216,10 +217,10 @@ class PayerInfo extends PayPalModel } /** - * PayPal assigned Payer ID. + * PayPal assigned encrypted Payer ID. * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -229,7 +230,7 @@ class PayerInfo extends PayPalModel } /** - * PayPal assigned Payer ID. + * PayPal assigned encrypted Payer ID. * * @return string */ @@ -239,10 +240,10 @@ class PayerInfo extends PayPalModel } /** - * Phone number representing the Payer. + * Phone number representing the payer. 20 characters max. * * @param string $phone - * + * * @return $this */ public function setPhone($phone) @@ -252,7 +253,7 @@ class PayerInfo extends PayPalModel } /** - * Phone number representing the Payer. + * Phone number representing the payer. 20 characters max. * * @return string */ @@ -266,7 +267,7 @@ class PayerInfo extends PayPalModel * Valid Values: ["HOME", "WORK", "MOBILE", "OTHER"] * * @param string $phone_type - * + * * @return $this */ public function setPhoneType($phone_type) @@ -289,7 +290,7 @@ class PayerInfo extends PayPalModel * Birth date of the Payer in ISO8601 format (yyyy-mm-dd). * * @param string $birth_date - * + * * @return $this */ public function setBirthDate($birth_date) @@ -309,10 +310,10 @@ class PayerInfo extends PayPalModel } /** - * Payer's tax ID. + * 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) @@ -322,7 +323,7 @@ class PayerInfo extends PayPalModel } /** - * Payer's tax ID. + * Payer’s tax ID. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -332,11 +333,11 @@ class PayerInfo extends PayPalModel } /** - * Payer's tax ID type. + * Payer’s tax ID type. Allowed values: `BR_CPF` or `BR_CNPJ`. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["BR_CPF", "BR_CNPJ"] * * @param string $tax_id_type - * + * * @return $this */ public function setTaxIdType($tax_id_type) @@ -346,7 +347,7 @@ class PayerInfo extends PayPalModel } /** - * Payer's tax ID type. + * Payer’s tax ID type. Allowed values: `BR_CPF` or `BR_CNPJ`. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -356,10 +357,10 @@ class PayerInfo extends PayPalModel } /** - * 2 letter registered country code of the payer to identify the buyer country + * Two-letter registered country code of the payer to identify the buyer country. * * @param string $country_code - * + * * @return $this */ public function setCountryCode($country_code) @@ -369,7 +370,7 @@ class PayerInfo extends PayPalModel } /** - * 2 letter registered country code of the payer to identify the buyer country + * Two-letter registered country code of the payer to identify the buyer country. * * @return string */ @@ -382,7 +383,7 @@ class PayerInfo extends PayPalModel * Billing address of the Payer. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -402,10 +403,10 @@ class PayerInfo extends PayPalModel } /** - * Obsolete. Use shipping address present in purchase unit. + * Shipping address of payer PayPal account. * * @param \PayPal\Api\ShippingAddress $shipping_address - * + * * @return $this */ public function setShippingAddress($shipping_address) @@ -415,7 +416,7 @@ class PayerInfo extends PayPalModel } /** - * Obsolete. Use shipping address present in purchase unit. + * Shipping address of payer PayPal account. * * @return \PayPal\Api\ShippingAddress */ diff --git a/lib/PayPal/Api/Payment.php b/lib/PayPal/Api/Payment.php index 968170e..13229d5 100644 --- a/lib/PayPal/Api/Payment.php +++ b/lib/PayPal/Api/Payment.php @@ -15,27 +15,30 @@ use PayPal\Validation\ArgumentValidator; * * @package PayPal\Api * - * @property string id - * @property string create_time - * @property string update_time - * @property string intent - * @property \PayPal\Api\Payer payer - * @property \PayPal\Api\Payee payee - * @property string cart - * @property \PayPal\Api\Transaction[] transactions - * @property \PayPal\Api\Error[] failed_transactions - * @property \PayPal\Api\PaymentInstruction payment_instruction - * @property string state - * @property \PayPal\Api\RedirectUrls redirect_urls - * @property string experience_profile_id + * @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 */ class Payment extends PayPalResourceModel { /** - * Identifier of the payment resource created. + * ID of the created payment, the 'transaction ID' * * @param string $id - * + * * @return $this */ public function setId($id) @@ -45,7 +48,7 @@ class Payment extends PayPalResourceModel } /** - * Identifier of the payment resource created. + * ID of the created payment, the 'transaction ID' * * @return string */ @@ -55,11 +58,11 @@ class Payment extends PayPalResourceModel } /** - * Intent of the payment - Sale or Authorization or Order. + * Payment intent. * Valid Values: ["sale", "authorize", "order"] * * @param string $intent - * + * * @return $this */ public function setIntent($intent) @@ -69,7 +72,7 @@ class Payment extends PayPalResourceModel } /** - * Intent of the payment - Sale or Authorization or Order. + * Payment intent. * * @return string */ @@ -82,7 +85,7 @@ class Payment extends PayPalResourceModel * 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) @@ -102,10 +105,33 @@ class Payment extends PayPalResourceModel } /** - * . + * 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. + * + * @param \PayPal\Api\PotentialPayerInfo $potential_payer_info + * + * @return $this + */ + public function setPotentialPayerInfo($potential_payer_info) + { + $this->potential_payer_info = $potential_payer_info; + return $this; + } + + /** + * 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. + * + * @return \PayPal\Api\PotentialPayerInfo + */ + public function getPotentialPayerInfo() + { + return $this->potential_payer_info; + } + + /** + * Receiver of funds for this payment. **Readonly for PayPal external REST payments.** * * @param \PayPal\Api\Payee $payee - * + * * @return $this */ public function setPayee($payee) @@ -115,7 +141,7 @@ class Payment extends PayPalResourceModel } /** - * . + * Receiver of funds for this payment. **Readonly for PayPal external REST payments.** * * @return \PayPal\Api\Payee */ @@ -127,8 +153,9 @@ class Payment extends PayPalResourceModel /** * ID of the cart to execute the payment. * + * @deprecated Not publicly available * @param string $cart - * + * * @return $this */ public function setCart($cart) @@ -140,6 +167,7 @@ class Payment extends PayPalResourceModel /** * ID of the cart to execute the payment. * + * @deprecated Not publicly available * @return string */ public function getCart() @@ -148,10 +176,10 @@ class Payment extends PayPalResourceModel } /** - * A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee + * Transactional details including the amount and item details. * * @param \PayPal\Api\Transaction[] $transactions - * + * * @return $this */ public function setTransactions($transactions) @@ -161,7 +189,7 @@ class Payment extends PayPalResourceModel } /** - * A payment can have more than one transaction, with each transaction establishing a contract between the payer and a payee + * Transactional details including the amount and item details. * * @return \PayPal\Api\Transaction[] */ @@ -203,8 +231,9 @@ class Payment extends PayPalResourceModel /** * 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) @@ -216,6 +245,7 @@ class Payment extends PayPalResourceModel /** * Applicable for advanced payments like multi seller payment (MSP) to support partial failures * + * @deprecated Not publicly available * @return \PayPal\Api\Error[] */ public function getFailedTransactions() @@ -226,6 +256,7 @@ class Payment extends PayPalResourceModel /** * Append FailedTransactions to the list. * + * @deprecated Not publicly available * @param \PayPal\Api\Error $error * @return $this */ @@ -243,6 +274,7 @@ class Payment extends PayPalResourceModel /** * Remove FailedTransactions from the list. * + * @deprecated Not publicly available * @param \PayPal\Api\Error $error * @return $this */ @@ -254,10 +286,88 @@ class Payment extends PayPalResourceModel } /** - * A payment instruction resource + * Collection of PayPal generated billing agreement tokens. + * + * @param string[] $billing_agreement_tokens + * + * @return $this + */ + public function setBillingAgreementTokens($billing_agreement_tokens) + { + $this->billing_agreement_tokens = $billing_agreement_tokens; + return $this; + } + + /** + * Collection of PayPal generated billing agreement tokens. + * + * @return string[] + */ + public function getBillingAgreementTokens() + { + return $this->billing_agreement_tokens; + } + + /** + * Append BillingAgreementTokens to the list. + * + * @param string $billingAgreementToken + * @return $this + */ + public function addBillingAgreementToken($billingAgreementToken) + { + if (!$this->getBillingAgreementTokens()) { + return $this->setBillingAgreementTokens(array($billingAgreementToken)); + } else { + return $this->setBillingAgreementTokens( + array_merge($this->getBillingAgreementTokens(), array($billingAgreementToken)) + ); + } + } + + /** + * Remove BillingAgreementTokens from the list. + * + * @param string $billingAgreementToken + * @return $this + */ + public function removeBillingAgreementToken($billingAgreementToken) + { + return $this->setBillingAgreementTokens( + array_diff($this->getBillingAgreementTokens(), array($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) + { + $this->credit_financing_offered = $credit_financing_offered; + return $this; + } + + /** + * Credit financing offered to payer on PayPal side. Returned in payment after payer opts-in + * + * @deprecated Not publicly available + * @return \PayPal\Api\CreditFinancingOffered + */ + public function getCreditFinancingOffered() + { + return $this->credit_financing_offered; + } + + /** + * Instructions for the payer to complete this payment. * * @param \PayPal\Api\PaymentInstruction $payment_instruction - * + * * @return $this */ public function setPaymentInstruction($payment_instruction) @@ -267,7 +377,7 @@ class Payment extends PayPalResourceModel } /** - * A payment instruction resource + * Instructions for the payer to complete this payment. * * @return \PayPal\Api\PaymentInstruction */ @@ -277,11 +387,11 @@ class Payment extends PayPalResourceModel } /** - * state of the payment - * Valid Values: ["created", "approved", "completed", "partially_completed", "failed", "canceled", "expired", "in_progress"] + * Payment state. + * Valid Values: ["created", "approved", "failed", "partially_completed", "in_progress"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -291,7 +401,7 @@ class Payment extends PayPalResourceModel } /** - * state of the payment + * Payment state. * * @return string */ @@ -301,10 +411,10 @@ class Payment extends PayPalResourceModel } /** - * Identifier for the payment experience. + * 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. * * @param string $experience_profile_id - * + * * @return $this */ public function setExperienceProfileId($experience_profile_id) @@ -314,7 +424,7 @@ class Payment extends PayPalResourceModel } /** - * Identifier for the payment experience. + * 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. * * @return string */ @@ -324,10 +434,33 @@ class Payment extends PayPalResourceModel } /** - * Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls. + * 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) + { + $this->note_to_payer = $note_to_payer; + return $this; + } + + /** + * free-form field for the use of clients to pass in a message to the payer + * + * @return string + */ + public function getNoteToPayer() + { + return $this->note_to_payer; + } + + /** + * Set of redirect URLs you provide only for PayPal-based payments. * * @param \PayPal\Api\RedirectUrls $redirect_urls - * + * * @return $this */ public function setRedirectUrls($redirect_urls) @@ -337,7 +470,7 @@ class Payment extends PayPalResourceModel } /** - * Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls. + * Set of redirect URLs you provide only for PayPal-based payments. * * @return \PayPal\Api\RedirectUrls */ @@ -347,10 +480,34 @@ class Payment extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * Failure reason code returned when the payment failed for some valid reasons. + * 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) + { + $this->failure_reason = $failure_reason; + return $this; + } + + /** + * Failure reason code returned when the payment failed for some valid reasons. + * + * @return string + */ + public function getFailureReason() + { + return $this->failure_reason; + } + + /** + * 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) @@ -360,7 +517,7 @@ class Payment extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * Payment creation time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ @@ -370,10 +527,10 @@ class Payment extends PayPalResourceModel } /** - * Time the resource was last updated in UTC ISO8601 format. + * 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) @@ -383,7 +540,7 @@ class Payment extends PayPalResourceModel } /** - * Time the resource was last updated in UTC ISO8601 format. + * Payment update time as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ @@ -405,8 +562,8 @@ class Payment extends PayPalResourceModel /** * 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. * - * @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) @@ -427,9 +584,9 @@ class Payment extends PayPalResourceModel /** * Look up a particular payment resource by passing the payment_id in the request URI. * - * @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) @@ -450,11 +607,11 @@ class Payment extends PayPalResourceModel } /** - * Partially update a payment resource by by passing the payment_id in the request URI. In addition, pass a patch_request_object in the body of the request JSON that specifies the operation to perform, path of the target location, and new value to apply. Please note that it is not possible to use patch after execute has been called. + * 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. * - * @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) @@ -474,11 +631,11 @@ class Payment extends PayPalResourceModel } /** - * Execute (complete) a PayPal payment that has been approved by the payer by passing the payment_id in the request URI. This request only works after a buyer has approved the payment using the provided PayPal approval URL. Optionally update transaction information when executing the payment by passing in one or more transactions. + * Execute (complete) a PayPal payment that has been approved by the payer. Optionally update selective payment information when executing the 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) @@ -501,9 +658,9 @@ class Payment extends PayPalResourceModel /** * List payments in any state (created, approved, failed, etc.). Payments returned are the payments made to the merchant issuing the request. * - * @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) diff --git a/lib/PayPal/Api/PaymentCard.php b/lib/PayPal/Api/PaymentCard.php index 26a89e5..3e6c7b4 100644 --- a/lib/PayPal/Api/PaymentCard.php +++ b/lib/PayPal/Api/PaymentCard.php @@ -11,21 +11,22 @@ use PayPal\Common\PayPalModel; * * @package PayPal\Api * - * @property string id - * @property string number - * @property string type - * @property int expire_month - * @property int 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 external_customer_id + * @property string status + * @property string valid_until + * @property string issue_number * @property \PayPal\Api\Links[] links */ class PaymentCard extends PayPalModel @@ -34,7 +35,7 @@ class PaymentCard extends PayPalModel * ID of the credit card being saved for later use. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -57,7 +58,7 @@ class PaymentCard extends PayPalModel * Card number. * * @param string $number - * + * * @return $this */ public function setNumber($number) @@ -81,7 +82,7 @@ class PaymentCard extends PayPalModel * 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) @@ -103,8 +104,8 @@ class PaymentCard extends PayPalModel /** * 2 digit card expiry month. * - * @param int $expire_month - * + * @param string $expire_month + * * @return $this */ public function setExpireMonth($expire_month) @@ -116,7 +117,7 @@ class PaymentCard extends PayPalModel /** * 2 digit card expiry month. * - * @return int + * @return string */ public function getExpireMonth() { @@ -126,8 +127,8 @@ class PaymentCard extends PayPalModel /** * 4 digit card expiry year * - * @param int $expire_year - * + * @param string $expire_year + * * @return $this */ public function setExpireYear($expire_year) @@ -139,7 +140,7 @@ class PaymentCard extends PayPalModel /** * 4 digit card expiry year * - * @return int + * @return string */ public function getExpireYear() { @@ -147,10 +148,10 @@ class PaymentCard extends PayPalModel } /** - * 2 digit card start month. + * 2 digit card start month. Needed for UK Maestro Card. * * @param string $start_month - * + * * @return $this */ public function setStartMonth($start_month) @@ -160,7 +161,7 @@ class PaymentCard extends PayPalModel } /** - * 2 digit card start month. + * 2 digit card start month. Needed for UK Maestro Card. * * @return string */ @@ -170,10 +171,10 @@ class PaymentCard extends PayPalModel } /** - * 4 digit card start year. + * 4 digit card start year. Needed for UK Maestro Card. * * @param string $start_year - * + * * @return $this */ public function setStartYear($start_year) @@ -183,7 +184,7 @@ class PaymentCard extends PayPalModel } /** - * 4 digit card start year. + * 4 digit card start year. Needed for UK Maestro Card. * * @return string */ @@ -196,7 +197,7 @@ class PaymentCard extends PayPalModel * Card validation code. Only supported when making a Payment but not when saving a payment card for future use. * * @param string $cvv2 - * + * * @return $this */ public function setCvv2($cvv2) @@ -219,7 +220,7 @@ class PaymentCard extends PayPalModel * Card holder's first name. * * @param string $first_name - * + * * @return $this */ public function setFirstName($first_name) @@ -242,7 +243,7 @@ class PaymentCard extends PayPalModel * Card holder's last name. * * @param string $last_name - * + * * @return $this */ public function setLastName($last_name) @@ -265,7 +266,7 @@ class PaymentCard extends PayPalModel * 2 letter country code * * @param string $billing_country - * + * * @return $this */ public function setBillingCountry($billing_country) @@ -288,7 +289,7 @@ class PaymentCard extends PayPalModel * Billing Address associated with this card. * * @param \PayPal\Api\Address $billing_address - * + * * @return $this */ public function setBillingAddress($billing_address) @@ -311,7 +312,7 @@ class PaymentCard extends PayPalModel * 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. * * @param string $external_customer_id - * + * * @return $this */ public function setExternalCustomerId($external_customer_id) @@ -335,7 +336,7 @@ class PaymentCard extends PayPalModel * Valid Values: ["EXPIRED", "ACTIVE"] * * @param string $status - * + * * @return $this */ public function setStatus($status) @@ -358,7 +359,7 @@ class PaymentCard extends PayPalModel * Date/Time until this resource can be used fund a payment. * * @param string $valid_until - * + * * @return $this */ public function setValidUntil($valid_until) @@ -377,11 +378,34 @@ class PaymentCard extends PayPalModel return $this->valid_until; } + /** + * 1-2 digit card issue number. Needed for UK Maestro Card. + * + * @param string $issue_number + * + * @return $this + */ + public function setIssueNumber($issue_number) + { + $this->issue_number = $issue_number; + return $this; + } + + /** + * 1-2 digit card issue number. Needed for UK Maestro Card. + * + * @return string + */ + public function getIssueNumber() + { + return $this->issue_number; + } + /** * 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 b98ce42..327731b 100644 --- a/lib/PayPal/Api/PaymentExecution.php +++ b/lib/PayPal/Api/PaymentExecution.php @@ -11,16 +11,17 @@ use PayPal\Common\PayPalModel; * * @package PayPal\Api * - * @property string payer_id + * @property string payer_id + * @property string carrier_account_id * @property \PayPal\Api\Transaction[] transactions */ class PaymentExecution extends PayPalModel { /** - * PayPal assigned Payer ID returned in the approval return url. + * The ID of the Payer, passed in the `return_url` by PayPal. * * @param string $payer_id - * + * * @return $this */ public function setPayerId($payer_id) @@ -30,7 +31,7 @@ class PaymentExecution extends PayPalModel } /** - * PayPal assigned Payer ID returned in the approval return url. + * The ID of the Payer, passed in the `return_url` by PayPal. * * @return string */ @@ -40,10 +41,33 @@ class PaymentExecution extends PayPalModel } /** - * Transaction information to be used at the time of execute payment. Only amount and shipping_address can be updated in execute payment + * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable. + * + * @param string $carrier_account_id + * + * @return $this + */ + public function setCarrierAccountId($carrier_account_id) + { + $this->carrier_account_id = $carrier_account_id; + return $this; + } + + /** + * Carrier account id for a carrier billing payment. For a carrier billing payment, payer_id is not applicable. + * + * @return string + */ + public function getCarrierAccountId() + { + return $this->carrier_account_id; + } + + /** + * Transactional details including the amount and item details. * * @param \PayPal\Api\Transaction[] $transactions - * + * * @return $this */ public function setTransactions($transactions) @@ -53,7 +77,7 @@ class PaymentExecution extends PayPalModel } /** - * Transaction information to be used at the time of execute payment. Only amount and shipping_address can be updated in execute payment + * Transactional details including the amount and item details. * * @return \PayPal\Api\Transaction[] */ diff --git a/lib/PayPal/Api/PaymentInstruction.php b/lib/PayPal/Api/PaymentInstruction.php index 1222c31..152d83f 100644 --- a/lib/PayPal/Api/PaymentInstruction.php +++ b/lib/PayPal/Api/PaymentInstruction.php @@ -4,23 +4,22 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** * Class PaymentInstruction * - * Object used to represent payment instruction. + * Contain details of how and when the payment should be made to PayPal in cases of manual bank transfer. * * @package PayPal\Api * - * @property string reference_number - * @property string instruction_type + * @property string reference_number + * @property string instruction_type * @property \PayPal\Api\RecipientBankingInstruction recipient_banking_instruction - * @property \PayPal\Api\Currency amount - * @property string payment_due_date - * @property string note - * @property \PayPal\Api\Links[] links + * @property \PayPal\Api\Currency amount + * @property string payment_due_date + * @property string note + * @property \PayPal\Api\Links[] links */ class PaymentInstruction extends PayPalResourceModel { @@ -28,7 +27,7 @@ class PaymentInstruction extends PayPalResourceModel * ID of payment instruction * * @param string $reference_number - * + * * @return $this */ public function setReferenceNumber($reference_number) @@ -46,12 +45,13 @@ class PaymentInstruction extends PayPalResourceModel { return $this->reference_number; } + /** * Type of payment instruction * Valid Values: ["MANUAL_BANK_TRANSFER", "PAY_UPON_INVOICE"] * * @param string $instruction_type - * + * * @return $this */ public function setInstructionType($instruction_type) @@ -74,7 +74,7 @@ class PaymentInstruction extends PayPalResourceModel * Recipient bank Details. * * @param \PayPal\Api\RecipientBankingInstruction $recipient_banking_instruction - * + * * @return $this */ public function setRecipientBankingInstruction($recipient_banking_instruction) @@ -97,7 +97,7 @@ class PaymentInstruction extends PayPalResourceModel * Amount to be transferred * * @param \PayPal\Api\Currency $amount - * + * * @return $this */ public function setAmount($amount) @@ -120,7 +120,7 @@ class PaymentInstruction extends PayPalResourceModel * Date by which payment should be received * * @param string $payment_due_date - * + * * @return $this */ public function setPaymentDueDate($payment_due_date) @@ -143,7 +143,7 @@ class PaymentInstruction extends PayPalResourceModel * Additional text regarding payment handling * * @param string $note - * + * * @return $this */ public function setNote($note) @@ -165,9 +165,9 @@ class PaymentInstruction extends PayPalResourceModel /** * Retrieve a payment instruction by passing the payment_id in the request URI. Use this request if you are implementing a solution that includes delayed payment like Pay Upon Invoice (PUI). * - * @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 PaymentInstruction */ public static function get($paymentId, $apiContext = null, $restCall = null) diff --git a/lib/PayPal/Api/PaymentOptions.php b/lib/PayPal/Api/PaymentOptions.php index 6e64ddf..d81fe37 100644 --- a/lib/PayPal/Api/PaymentOptions.php +++ b/lib/PayPal/Api/PaymentOptions.php @@ -16,11 +16,11 @@ use PayPal\Common\PayPalModel; class PaymentOptions extends PayPalModel { /** - * Payment method requested for this purchase unit + * 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. * 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 @@ class PaymentOptions extends PayPalModel } /** - * Payment method requested for this purchase unit + * 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. * * @return string */ @@ -39,4 +39,54 @@ class PaymentOptions extends PayPalModel return $this->allowed_payment_method; } + /** + * 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) + { + $this->recurring_flag = $recurring_flag; + return $this; + } + + /** + * 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 + */ + public function getRecurringFlag() + { + return $this->recurring_flag; + } + + /** + * 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) + { + $this->skip_fmf = $skip_fmf; + return $this; + } + + /** + * 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 + */ + public function getSkipFmf() + { + return $this->skip_fmf; + } + } diff --git a/lib/PayPal/Api/PotentialPayerInfo.php b/lib/PayPal/Api/PotentialPayerInfo.php new file mode 100644 index 0000000..fc57e17 --- /dev/null +++ b/lib/PayPal/Api/PotentialPayerInfo.php @@ -0,0 +1,112 @@ +email = $email; + return $this; + } + + /** + * Email address representing the potential payer. + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + + /** + * ExternalRememberMe id representing the potential payer + * + * @param string $external_remember_me_id + * + * @return $this + */ + public function setExternalRememberMeId($external_remember_me_id) + { + $this->external_remember_me_id = $external_remember_me_id; + return $this; + } + + /** + * ExternalRememberMe id representing the potential payer + * + * @return string + */ + public function getExternalRememberMeId() + { + return $this->external_remember_me_id; + } + + /** + * Account Number representing the potential payer + * @deprecated Not publicly available + * @param string $account_number + * + * @return $this + */ + public function setAccountNumber($account_number) + { + $this->account_number = $account_number; + return $this; + } + + /** + * Account Number representing the potential payer + * @deprecated Not publicly available + * @return string + */ + public function getAccountNumber() + { + return $this->account_number; + } + + /** + * Billing address of the potential payer. + * + * @param \PayPal\Api\Address $billing_address + * + * @return $this + */ + public function setBillingAddress($billing_address) + { + $this->billing_address = $billing_address; + return $this; + } + + /** + * Billing address of the potential payer. + * + * @return \PayPal\Api\Address + */ + public function getBillingAddress() + { + return $this->billing_address; + } + +} diff --git a/lib/PayPal/Api/PrivateLabelCard.php b/lib/PayPal/Api/PrivateLabelCard.php new file mode 100644 index 0000000..385a1cc --- /dev/null +++ b/lib/PayPal/Api/PrivateLabelCard.php @@ -0,0 +1,137 @@ +id = $id; + return $this; + } + + /** + * encrypted identifier of the private label card instrument. + * + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * last 4 digits of the card number. + * + * @param string $card_number + * + * @return $this + */ + public function setCardNumber($card_number) + { + $this->card_number = $card_number; + return $this; + } + + /** + * last 4 digits of the card number. + * + * @return string + */ + public function getCardNumber() + { + return $this->card_number; + } + + /** + * Merchants providing private label store cards have associated issuer account. This value indicates encrypted account number of the associated issuer account. + * + * @param string $issuer_id + * + * @return $this + */ + public function setIssuerId($issuer_id) + { + $this->issuer_id = $issuer_id; + return $this; + } + + /** + * Merchants providing private label store cards have associated issuer account. This value indicates encrypted account number of the associated issuer account. + * + * @return string + */ + public function getIssuerId() + { + return $this->issuer_id; + } + + /** + * Merchants providing private label store cards have associated issuer account. This value indicates name on the issuer account. + * + * @param string $issuer_name + * + * @return $this + */ + public function setIssuerName($issuer_name) + { + $this->issuer_name = $issuer_name; + return $this; + } + + /** + * Merchants providing private label store cards have associated issuer account. This value indicates name on the issuer account. + * + * @return string + */ + public function getIssuerName() + { + return $this->issuer_name; + } + + /** + * This value indicates URL to access PLCC program logo image + * + * @param string $image_key + * + * @return $this + */ + public function setImageKey($image_key) + { + $this->image_key = $image_key; + return $this; + } + + /** + * This value indicates URL to access PLCC program logo image + * + * @return string + */ + public function getImageKey() + { + return $this->image_key; + } + +} diff --git a/lib/PayPal/Api/ProcessorResponse.php b/lib/PayPal/Api/ProcessorResponse.php new file mode 100644 index 0000000..5854670 --- /dev/null +++ b/lib/PayPal/Api/ProcessorResponse.php @@ -0,0 +1,162 @@ +response_code = $response_code; + return $this; + } + + /** + * Paypal normalized response code, generated from the processor's specific response code + * + * @return string + */ + public function getResponseCode() + { + return $this->response_code; + } + + /** + * Address Verification System response code. https://developer.paypal.com/webapps/developer/docs/classic/api/AVSResponseCodes/ + * + * @param string $avs_code + * + * @return $this + */ + public function setAvsCode($avs_code) + { + $this->avs_code = $avs_code; + return $this; + } + + /** + * Address Verification System response code. https://developer.paypal.com/webapps/developer/docs/classic/api/AVSResponseCodes/ + * + * @return string + */ + public function getAvsCode() + { + return $this->avs_code; + } + + /** + * CVV System response code. https://developer.paypal.com/webapps/developer/docs/classic/api/AVSResponseCodes/ + * + * @param string $cvv_code + * + * @return $this + */ + public function setCvvCode($cvv_code) + { + $this->cvv_code = $cvv_code; + return $this; + } + + /** + * CVV System response code. https://developer.paypal.com/webapps/developer/docs/classic/api/AVSResponseCodes/ + * + * @return string + */ + public function getCvvCode() + { + return $this->cvv_code; + } + + /** + * Provides merchant advice on how to handle declines related to recurring payments + * Valid Values: ["01_NEW_ACCOUNT_INFORMATION", "02_TRY_AGAIN_LATER", "02_STOP_SPECIFIC_PAYMENT", "03_DO_NOT_TRY_AGAIN", "03_REVOKE_AUTHORIZATION_FOR_FUTURE_PAYMENT", "21_DO_NOT_TRY_AGAIN_CARD_HOLDER_CANCELLED_RECURRRING_CHARGE", "21_CANCEL_ALL_RECURRING_PAYMENTS"] + * + * @param string $advice_code + * + * @return $this + */ + public function setAdviceCode($advice_code) + { + $this->advice_code = $advice_code; + return $this; + } + + /** + * Provides merchant advice on how to handle declines related to recurring payments + * + * @return string + */ + public function getAdviceCode() + { + return $this->advice_code; + } + + /** + * Response back from the authorization. Provided by the processor + * + * @param string $eci_submitted + * + * @return $this + */ + public function setEciSubmitted($eci_submitted) + { + $this->eci_submitted = $eci_submitted; + return $this; + } + + /** + * Response back from the authorization. Provided by the processor + * + * @return string + */ + public function getEciSubmitted() + { + return $this->eci_submitted; + } + + /** + * Visa Payer Authentication Service status. Will be return from processor + * + * @param string $vpas + * + * @return $this + */ + public function setVpas($vpas) + { + $this->vpas = $vpas; + return $this; + } + + /** + * Visa Payer Authentication Service status. Will be return from processor + * + * @return string + */ + public function getVpas() + { + return $this->vpas; + } + +} diff --git a/lib/PayPal/Api/RedirectUrls.php b/lib/PayPal/Api/RedirectUrls.php index 1e7c010..5c97ba4 100644 --- a/lib/PayPal/Api/RedirectUrls.php +++ b/lib/PayPal/Api/RedirectUrls.php @@ -8,7 +8,7 @@ use PayPal\Validation\UrlValidator; /** * Class RedirectUrls * - * Redirect urls required only when using payment_method as PayPal - the only settings supported are return and cancel urls. + * Set of redirect URLs you provide only for PayPal-based payments. * * @package PayPal\Api * @@ -18,7 +18,7 @@ use PayPal\Validation\UrlValidator; class RedirectUrls extends PayPalModel { /** - * Url where the payer would be redirected to after approving the payment. + * Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.** * * @param string $return_url * @throws \InvalidArgumentException @@ -32,7 +32,7 @@ class RedirectUrls extends PayPalModel } /** - * Url where the payer would be redirected to after approving the payment. + * Url where the payer would be redirected to after approving the payment. **Required for PayPal account payments.** * * @return string */ @@ -42,7 +42,7 @@ class RedirectUrls extends PayPalModel } /** - * Url where the payer would be redirected to after canceling the payment. + * Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.** * * @param string $cancel_url * @throws \InvalidArgumentException @@ -56,7 +56,7 @@ class RedirectUrls extends PayPalModel } /** - * Url where the payer would be redirected to after canceling the payment. + * Url where the payer would be redirected to after canceling the payment. **Required for PayPal account payments.** * * @return string */ diff --git a/lib/PayPal/Api/Refund.php b/lib/PayPal/Api/Refund.php index ee26a15..dfddb0c 100644 --- a/lib/PayPal/Api/Refund.php +++ b/lib/PayPal/Api/Refund.php @@ -4,7 +4,6 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** @@ -14,25 +13,25 @@ use PayPal\Validation\ArgumentValidator; * * @package PayPal\Api * - * @property string id - * @property string create_time - * @property string update_time - * @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 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 \PayPal\Api\Links[] links */ class Refund extends PayPalResourceModel { /** - * Identifier of the refund transaction in UTC ISO8601 format. + * ID of the refund transaction. 17 characters max. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -42,7 +41,7 @@ class Refund extends PayPalResourceModel } /** - * Identifier of the refund transaction in UTC ISO8601 format. + * ID of the refund transaction. 17 characters max. * * @return string */ @@ -52,10 +51,10 @@ class Refund extends PayPalResourceModel } /** - * Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund. + * 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) @@ -65,7 +64,7 @@ class Refund extends PayPalResourceModel } /** - * Details including both refunded amount (to Payer) and refunded fee (to Payee).If amount is not specified, it's assumed to be full refund. + * Details including both refunded amount (to payer) and refunded fee (to payee). 10 characters max. * * @return \PayPal\Api\Amount */ @@ -75,11 +74,11 @@ class Refund extends PayPalResourceModel } /** - * State of the refund transaction. + * State of the refund. * Valid Values: ["pending", "completed", "failed"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -89,7 +88,7 @@ class Refund extends PayPalResourceModel } /** - * State of the refund transaction. + * State of the refund. * * @return string */ @@ -102,7 +101,7 @@ class Refund extends PayPalResourceModel * Reason description for the Sale transaction being refunded. * * @param string $reason - * + * * @return $this */ public function setReason($reason) @@ -122,10 +121,10 @@ class Refund extends PayPalResourceModel } /** - * ID of the Sale transaction being refunded. + * ID of the Sale transaction being refunded. * * @param string $sale_id - * + * * @return $this */ public function setSaleId($sale_id) @@ -135,7 +134,7 @@ class Refund extends PayPalResourceModel } /** - * ID of the Sale transaction being refunded. + * ID of the Sale transaction being refunded. * * @return string */ @@ -145,10 +144,10 @@ class Refund extends PayPalResourceModel } /** - * ID of the Capture transaction being refunded. + * ID of the sale transaction being refunded. * * @param string $capture_id - * + * * @return $this */ public function setCaptureId($capture_id) @@ -158,7 +157,7 @@ class Refund extends PayPalResourceModel } /** - * ID of the Capture transaction being refunded. + * ID of the sale transaction being refunded. * * @return string */ @@ -168,10 +167,10 @@ class Refund extends PayPalResourceModel } /** - * ID of the Payment resource that this transaction is based on. + * ID of the payment resource on which this transaction is based. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -181,7 +180,7 @@ class Refund extends PayPalResourceModel } /** - * ID of the Payment resource that this transaction is based on. + * ID of the payment resource on which this transaction is based. * * @return string */ @@ -194,7 +193,7 @@ class Refund extends PayPalResourceModel * Description of what is being refunded for. * * @param string $description - * + * * @return $this */ public function setDescription($description) @@ -214,10 +213,10 @@ class Refund extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * 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) @@ -227,7 +226,7 @@ class Refund extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * Time of refund as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6). * * @return string */ @@ -237,10 +236,10 @@ class Refund extends PayPalResourceModel } /** - * Time the resource was last updated in UTC ISO8601 format. + * Time that the resource was last updated. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -250,7 +249,7 @@ class Refund extends PayPalResourceModel } /** - * Time the resource was last updated in UTC ISO8601 format. + * Time that the resource was last updated. * * @return string */ @@ -262,9 +261,9 @@ class Refund extends PayPalResourceModel /** * Retrieve details about a specific refund by passing the refund_id in the request URI. * - * @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/RelatedResources.php b/lib/PayPal/Api/RelatedResources.php index f7f506a..e8f9719 100644 --- a/lib/PayPal/Api/RelatedResources.php +++ b/lib/PayPal/Api/RelatedResources.php @@ -11,17 +11,16 @@ use PayPal\Common\PayPalModel; * * @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 { /** - * A sale transaction - * + * Sale transaction * * @param \PayPal\Api\Sale $sale * @@ -34,7 +33,7 @@ class RelatedResources extends PayPalModel } /** - * A sale transaction + * Sale transaction * * @return \PayPal\Api\Sale */ @@ -44,8 +43,7 @@ class RelatedResources extends PayPalModel } /** - * An authorization transaction - * + * Authorization transaction * * @param \PayPal\Api\Authorization $authorization * @@ -58,7 +56,7 @@ class RelatedResources extends PayPalModel } /** - * An authorization transaction + * Authorization transaction * * @return \PayPal\Api\Authorization */ @@ -68,8 +66,7 @@ class RelatedResources extends PayPalModel } /** - * An order transaction - * + * Order transaction * * @param \PayPal\Api\Order $order * @@ -82,7 +79,7 @@ class RelatedResources extends PayPalModel } /** - * An order transaction + * Order transaction * * @return \PayPal\Api\Order */ @@ -92,8 +89,7 @@ class RelatedResources extends PayPalModel } /** - * A capture transaction - * + * Capture transaction * * @param \PayPal\Api\Capture $capture * @@ -106,7 +102,7 @@ class RelatedResources extends PayPalModel } /** - * A capture transaction + * Capture transaction * * @return \PayPal\Api\Capture */ @@ -116,8 +112,7 @@ class RelatedResources extends PayPalModel } /** - * A refund transaction - * + * Refund transaction * * @param \PayPal\Api\Refund $refund * @@ -130,7 +125,7 @@ class RelatedResources extends PayPalModel } /** - * A refund transaction + * Refund transaction * * @return \PayPal\Api\Refund */ diff --git a/lib/PayPal/Api/Sale.php b/lib/PayPal/Api/Sale.php index 9301b0d..856cbe4 100644 --- a/lib/PayPal/Api/Sale.php +++ b/lib/PayPal/Api/Sale.php @@ -4,7 +4,6 @@ namespace PayPal\Api; use PayPal\Common\PayPalResourceModel; use PayPal\Rest\ApiContext; -use PayPal\Transport\PayPalRestCall; use PayPal\Validation\ArgumentValidator; /** @@ -14,35 +13,36 @@ use PayPal\Validation\ArgumentValidator; * * @package PayPal\Api * - * @property string id - * @property string purchase_unit_reference_id - * @property string create_time - * @property string update_time - * @property \PayPal\Api\Amount amount - * @property string payment_mode - * @property string pending_reason - * @property string state - * @property string reason_code - * @property string protection_eligibility - * @property string protection_eligibility_type - * @property string clearing_time - * @property string recipient_fund_status - * @property string hold_reason - * @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\Links[] links + * @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 */ class Sale extends PayPalResourceModel { /** - * Identifier of the sale transaction. + * ID of the sale transaction. * * @param string $id - * + * * @return $this */ public function setId($id) @@ -52,7 +52,7 @@ class Sale extends PayPalResourceModel } /** - * Identifier of the sale transaction. + * ID of the sale transaction. * * @return string */ @@ -62,10 +62,10 @@ class Sale extends PayPalResourceModel } /** - * Identifier to the purchase unit corresponding to this sale transaction. + * Identifier of the purchased unit associated with this object. * * @param string $purchase_unit_reference_id - * + * * @return $this */ public function setPurchaseUnitReferenceId($purchase_unit_reference_id) @@ -75,7 +75,7 @@ class Sale extends PayPalResourceModel } /** - * Identifier to the purchase unit corresponding to this sale transaction. + * Identifier of the purchased unit associated with this object. * * @return string */ @@ -88,7 +88,7 @@ class Sale extends PayPalResourceModel * Amount being collected. * * @param \PayPal\Api\Amount $amount - * + * * @return $this */ public function setAmount($amount) @@ -108,11 +108,11 @@ class Sale extends PayPalResourceModel } /** - * specifies payment mode of the transaction + * Specifies payment mode of the transaction. Only supported when the `payment_method` is set to `paypal`. * Valid Values: ["INSTANT_TRANSFER", "MANUAL_BANK_TRANSFER", "DELAYED_TRANSFER", "ECHECK"] * * @param string $payment_mode - * + * * @return $this */ public function setPaymentMode($payment_mode) @@ -122,7 +122,7 @@ class Sale extends PayPalResourceModel } /** - * specifies payment mode of the transaction + * Specifies payment mode of the transaction. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -132,35 +132,11 @@ class Sale extends PayPalResourceModel } /** - * Reason of Pending transaction. - * - * - * - * @param string $pending_reason - * @return $this - */ - public function setPendingReason($pending_reason) - { - $this->pending_reason = $pending_reason; - return $this; - } - - /** - * Reason of Pending transaction. - * - * @return string - */ - public function getPendingReason() - { - return $this->pending_reason; - } - - /** - * State of the sale transaction. + * State of the sale. * Valid Values: ["completed", "partially_refunded", "pending", "refunded"] * * @param string $state - * + * * @return $this */ public function setState($state) @@ -170,7 +146,7 @@ class Sale extends PayPalResourceModel } /** - * State of the sale transaction. + * State of the sale. * * @return string */ @@ -180,11 +156,11 @@ class Sale extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending or Reversed. + * 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"] * * @param string $reason_code - * + * * @return $this */ public function setReasonCode($reason_code) @@ -194,7 +170,7 @@ class Sale extends PayPalResourceModel } /** - * Reason code for the transaction state being Pending or Reversed. + * Reason code for the transaction state being Pending or Reversed. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -204,11 +180,11 @@ class Sale extends PayPalResourceModel } /** - * Protection Eligibility of the Payer + * 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) @@ -218,7 +194,7 @@ class Sale extends PayPalResourceModel } /** - * Protection Eligibility of the Payer + * The level of seller protection in force for the transaction. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -228,11 +204,11 @@ class Sale extends PayPalResourceModel } /** - * Protection Eligibility Type of the Payer - * Valid Values: ["ELIGIBLE", "ITEM_NOT_RECEIVED_ELIGIBLE", "INELIGIBLE", "UNAUTHORIZED_PAYMENT_ELIGIBLE"] + * The kind of seller protection in force for the transaction. It is returned only when protection_eligibility is ELIGIBLE or PARTIALLY_ELIGIBLE. Only supported when the `payment_method` is set to `paypal`. + * 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) @@ -242,7 +218,7 @@ class Sale extends PayPalResourceModel } /** - * Protection Eligibility Type of the Payer + * The kind of seller protection in force for the transaction. It is returned only when protection_eligibility is ELIGIBLE or PARTIALLY_ELIGIBLE. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -252,10 +228,10 @@ class Sale extends PayPalResourceModel } /** - * Expected clearing time for eCheck Transactions + * Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`. * * @param string $clearing_time - * + * * @return $this */ public function setClearingTime($clearing_time) @@ -265,7 +241,7 @@ class Sale extends PayPalResourceModel } /** - * Expected clearing time for eCheck Transactions + * Expected clearing time for eCheck transactions. Only supported when the `payment_method` is set to `paypal`. * * @return string */ @@ -275,58 +251,87 @@ class Sale extends PayPalResourceModel } /** - * Indicates the credit status of fund to the recipient. It will be returned only when payment status is 'completed' - * Valid Values: ["COMPLETED", "HELD"] + * Status of the Recipient Fund. For now, it will be returned only when fund status is held + * Valid Values: ["HELD"] + * + * @param string $payment_hold_status * - * @param string $recipient_fund_status - * * @return $this */ - public function setRecipientFundStatus($recipient_fund_status) + public function setPaymentHoldStatus($payment_hold_status) { - $this->recipient_fund_status = $recipient_fund_status; + $this->payment_hold_status = $payment_hold_status; return $this; } /** - * Indicates the credit status of fund to the recipient. It will be returned only when payment status is 'completed' + * Status of the Recipient Fund. For now, it will be returned only when fund status is held * * @return string */ - public function getRecipientFundStatus() + public function getPaymentHoldStatus() { - return $this->recipient_fund_status; + return $this->payment_hold_status; } /** - * Reason for holding the funds. - * Valid Values: ["NEW_SELLER_PAYMENT_HOLD", "PAYMENT_HOLD"] + * Reasons for PayPal holding recipient fund. It is set only if payment hold status is held + * + * @param string[] $payment_hold_reasons * - * @param string $hold_reason - * * @return $this */ - public function setHoldReason($hold_reason) + public function setPaymentHoldReasons($payment_hold_reasons) { - $this->hold_reason = $hold_reason; + $this->payment_hold_reasons = $payment_hold_reasons; return $this; } /** - * Reason for holding the funds. + * Reasons for PayPal holding recipient fund. It is set only if payment hold status is held * - * @return string + * @return string[] */ - public function getHoldReason() + public function getPaymentHoldReasons() { - return $this->hold_reason; + return $this->payment_hold_reasons; } /** - * Transaction fee applicable for this payment. + * Append PaymentHoldReasons to the list. + * + * @param string $string + * @return $this + */ + public function addPaymentHoldReason($string) + { + if (!$this->getPaymentHoldReasons()) { + return $this->setPaymentHoldReasons(array($string)); + } else { + return $this->setPaymentHoldReasons( + array_merge($this->getPaymentHoldReasons(), array($string)) + ); + } + } + + /** + * Remove PaymentHoldReasons from the list. + * + * @param string $string + * @return $this + */ + public function removePaymentHoldReason($string) + { + return $this->setPaymentHoldReasons( + array_diff($this->getPaymentHoldReasons(), array($string)) + ); + } + + /** + * Transaction fee charged by PayPal for this transaction. * * @param \PayPal\Api\Currency $transaction_fee - * + * * @return $this */ public function setTransactionFee($transaction_fee) @@ -336,7 +341,7 @@ class Sale extends PayPalResourceModel } /** - * Transaction fee applicable for this payment. + * Transaction fee charged by PayPal for this transaction. * * @return \PayPal\Api\Currency */ @@ -346,10 +351,10 @@ class Sale extends PayPalResourceModel } /** - * Net amount payee receives for this transaction after deducting transaction fee. + * 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) @@ -359,7 +364,7 @@ class Sale extends PayPalResourceModel } /** - * Net amount payee receives for this transaction after deducting transaction fee. + * 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. * * @return \PayPal\Api\Currency */ @@ -369,10 +374,10 @@ class Sale extends PayPalResourceModel } /** - * Exchange rate applied for this transaction. + * 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) @@ -382,7 +387,7 @@ class Sale extends PayPalResourceModel } /** - * Exchange rate applied for this transaction. + * 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. * * @return string */ @@ -392,10 +397,10 @@ class Sale extends PayPalResourceModel } /** - * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. + * 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) @@ -405,7 +410,7 @@ class Sale extends PayPalResourceModel } /** - * Fraud Management Filter (FMF) details applied for the payment that could result in accept/deny/pending action. + * 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. * * @return \PayPal\Api\FmfDetails */ @@ -415,10 +420,10 @@ class Sale extends PayPalResourceModel } /** - * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment. + * 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) @@ -428,7 +433,7 @@ class Sale extends PayPalResourceModel } /** - * Receipt id is 16 digit number payment identification number returned for guest users to identify the payment. + * Receipt id is a payment identification number returned for guest users to identify the payment. * * @return string */ @@ -438,10 +443,10 @@ class Sale extends PayPalResourceModel } /** - * ID of the Payment resource that this transaction is based on. + * ID of the payment resource on which this transaction is based. * * @param string $parent_payment - * + * * @return $this */ public function setParentPayment($parent_payment) @@ -451,7 +456,7 @@ class Sale extends PayPalResourceModel } /** - * ID of the Payment resource that this transaction is based on. + * ID of the payment resource on which this transaction is based. * * @return string */ @@ -461,10 +466,56 @@ class Sale extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * 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) + { + $this->processor_response = $processor_response; + return $this; + } + + /** + * Response codes returned by the processor concerning the submitted payment. Only supported when the `payment_method` is set to `credit_card`. + * + * @return \PayPal\Api\ProcessorResponse + */ + public function getProcessorResponse() + { + return $this->processor_response; + } + + /** + * 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) + { + $this->billing_agreement_id = $billing_agreement_id; + return $this; + } + + /** + * ID of the billing agreement used as reference to execute this transaction. + * + * @return string + */ + public function getBillingAgreementId() + { + return $this->billing_agreement_id; + } + + /** + * 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) @@ -474,7 +525,7 @@ class Sale extends PayPalResourceModel } /** - * Time the resource was created in UTC ISO8601 format. + * Time of sale as defined in [RFC 3339 Section 5.6](http://tools.ietf.org/html/rfc3339#section-5.6) * * @return string */ @@ -487,7 +538,7 @@ class Sale extends PayPalResourceModel * Time the resource was last updated in UTC ISO8601 format. * * @param string $update_time - * + * * @return $this */ public function setUpdateTime($update_time) @@ -509,9 +560,9 @@ class Sale extends PayPalResourceModel /** * 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. * - * @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) @@ -534,9 +585,9 @@ class Sale extends PayPalResourceModel /** * 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. * - * @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 + * @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 * @return Refund */ public function refund($refund, $apiContext = null, $restCall = null) diff --git a/lib/PayPal/Api/ShippingInfo.php b/lib/PayPal/Api/ShippingInfo.php index ed4b2a7..6937b03 100644 --- a/lib/PayPal/Api/ShippingInfo.php +++ b/lib/PayPal/Api/ShippingInfo.php @@ -110,6 +110,28 @@ class ShippingInfo extends PayPalModel return $this->phone; } + /** + * + * + * @param string $email + * @return $this + */ + public function setEmail($email) + { + $this->email = $email; + return $this; + } + + /** + * + * + * @return string + */ + public function getEmail() + { + return $this->email; + } + /** * Address of the invoice recipient. * diff --git a/lib/PayPal/Api/Transaction.php b/lib/PayPal/Api/Transaction.php index 3598420..9623430 100644 --- a/lib/PayPal/Api/Transaction.php +++ b/lib/PayPal/Api/Transaction.php @@ -9,8 +9,6 @@ namespace PayPal\Api; * * @package PayPal\Api * - * @property string purchase_unit_reference_id - * @property Transaction transactions */ class Transaction extends TransactionBase { diff --git a/lib/PayPal/Validation/ModelAccessorValidator.php b/lib/PayPal/Validation/ModelAccessorValidator.php index bfcdde5..10b3d76 100644 --- a/lib/PayPal/Validation/ModelAccessorValidator.php +++ b/lib/PayPal/Validation/ModelAccessorValidator.php @@ -38,7 +38,7 @@ class ModelAccessorValidator elseif (!method_exists($class, $methodName)) { //Delegate the error based on the choice $className = is_object($class) ? get_class($class) : (string)$class; - $errorMessage = "Missing Accessor: $className:$methodName. You might be using older version of SDK. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues"; + $errorMessage = "It seems that $className:$methodName is a new field added to the API response. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues"; PayPalLoggingManager::getInstance(__CLASS__)->debug($errorMessage); if ($mode == 'strict') { trigger_error($errorMessage, E_USER_NOTICE); diff --git a/tests/PayPal/Test/Api/AddressTest.php b/tests/PayPal/Test/Api/AddressTest.php index c4ae25d..b3ebcf9 100644 --- a/tests/PayPal/Test/Api/AddressTest.php +++ b/tests/PayPal/Test/Api/AddressTest.php @@ -13,6 +13,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Address + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Address */ public static function getObject() @@ -32,6 +34,7 @@ class AddressTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Address */ public function testSerializationDeserialization() @@ -68,4 +71,5 @@ class AddressTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getStatus(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/AlternatePaymentTest.php b/tests/PayPal/Test/Api/AlternatePaymentTest.php new file mode 100644 index 0000000..3074ee7 --- /dev/null +++ b/tests/PayPal/Test/Api/AlternatePaymentTest.php @@ -0,0 +1,61 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getAlternatePaymentAccountId()); + $this->assertNotNull($obj->getExternalCustomerId()); + $this->assertNotNull($obj->getAlternatePaymentProviderId()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param AlternatePayment $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getAlternatePaymentAccountId(), "TestSample"); + $this->assertEquals($obj->getExternalCustomerId(), "TestSample"); + $this->assertEquals($obj->getAlternatePaymentProviderId(), "TestSample"); + } + + +} diff --git a/tests/PayPal/Test/Api/AmountTest.php b/tests/PayPal/Test/Api/AmountTest.php index 5efd7d5..ecd4061 100644 --- a/tests/PayPal/Test/Api/AmountTest.php +++ b/tests/PayPal/Test/Api/AmountTest.php @@ -13,15 +13,17 @@ class AmountTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Amount + * * @return string */ public static function getJson() { - return '{"currency":"TestSample","total":"12.34","details":' .DetailsTest::getJson() . '}'; + return '{"currency":"TestSample","total":"12.34","details":' . DetailsTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Amount */ public static function getObject() @@ -32,6 +34,7 @@ class AmountTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Amount */ public function testSerializationDeserialization() @@ -56,4 +59,5 @@ class AmountTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getDetails(), DetailsTest::getObject()); } + } diff --git a/tests/PayPal/Test/Api/AuthorizationTest.php b/tests/PayPal/Test/Api/AuthorizationTest.php index ef95265..91fa813 100644 --- a/tests/PayPal/Test/Api/AuthorizationTest.php +++ b/tests/PayPal/Test/Api/AuthorizationTest.php @@ -14,15 +14,17 @@ 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","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Authorization */ public static function getObject() @@ -33,6 +35,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Authorization */ public function testSerializationDeserialization() @@ -79,7 +82,6 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } - /** * @dataProvider mockProvider * @param Authorization $obj @@ -93,12 +95,13 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase $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 @@ -112,13 +115,14 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase $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 @@ -132,12 +136,13 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase $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 @@ -151,7 +156,7 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - self::getJson() + self::getJson() )); $result = $obj->reauthorize($mockApiContext, $mockPPRestCall); @@ -162,8 +167,8 @@ class AuthorizationTest extends \PHPUnit_Framework_TestCase { $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 0ca75a1..d97cc5f 100644 --- a/tests/PayPal/Test/Api/BankAccountTest.php +++ b/tests/PayPal/Test/Api/BankAccountTest.php @@ -13,15 +13,17 @@ 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() @@ -32,6 +34,7 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return BankAccount */ public function testSerializationDeserialization() @@ -98,93 +101,5 @@ class BankAccountTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } - /** - * @dataProvider mockProvider - * @param BankAccount $obj - */ - public function testCreate($obj, $mockApiContext) - { - $mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - $mockPayPalRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - self::getJson() - )); - - $result = $obj->create($mockApiContext, $mockPayPalRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param BankAccount $obj - */ - public function testGet($obj, $mockApiContext) - { - $mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPayPalRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - BankAccountTest::getJson() - )); - - $result = $obj->get("bankAccountId", $mockApiContext, $mockPayPalRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param BankAccount $obj - */ - public function testDelete($obj, $mockApiContext) - { - $mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPayPalRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - true - )); - - $result = $obj->delete($mockApiContext, $mockPayPalRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param BankAccount $obj - */ - public function testUpdate($obj, $mockApiContext) - { - $mockPayPalRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPayPalRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - self::getJson() - )); - $patchRequest = PatchRequestTest::getObject(); - - $result = $obj->update($patchRequest, $mockApiContext, $mockPayPalRestCall); - $this->assertNotNull($result); - } - - public function mockProvider() - { - $obj = self::getObject(); - $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); - return array( - array($obj, $mockApiContext), - array($obj, null) - ); - } } diff --git a/tests/PayPal/Test/Api/BankTokenTest.php b/tests/PayPal/Test/Api/BankTokenTest.php index ff1dcb4..659ff15 100644 --- a/tests/PayPal/Test/Api/BankTokenTest.php +++ b/tests/PayPal/Test/Api/BankTokenTest.php @@ -13,6 +13,7 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object BankToken + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return BankToken */ public static function getObject() @@ -32,6 +34,7 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return BankToken */ public function testSerializationDeserialization() @@ -56,4 +59,5 @@ class BankTokenTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getMandateReferenceNumber(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/BillingTest.php b/tests/PayPal/Test/Api/BillingTest.php new file mode 100644 index 0000000..30bb830 --- /dev/null +++ b/tests/PayPal/Test/Api/BillingTest.php @@ -0,0 +1,57 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getBillingAgreementId()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param Billing $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getBillingAgreementId(), "TestSample"); + } + + +} diff --git a/tests/PayPal/Test/Api/CaptureTest.php b/tests/PayPal/Test/Api/CaptureTest.php index 97aee4f..0313a2d 100644 --- a/tests/PayPal/Test/Api/CaptureTest.php +++ b/tests/PayPal/Test/Api/CaptureTest.php @@ -14,15 +14,17 @@ 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","parent_payment":"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() @@ -33,6 +35,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Capture */ public function testSerializationDeserialization() @@ -69,7 +72,6 @@ class CaptureTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } - /** * @dataProvider mockProvider * @param Capture $obj @@ -83,12 +85,13 @@ class CaptureTest extends \PHPUnit_Framework_TestCase $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 @@ -102,7 +105,7 @@ class CaptureTest extends \PHPUnit_Framework_TestCase $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - RefundTest::getJson() + RefundTest::getJson() )); $refund = RefundTest::getObject(); @@ -114,8 +117,8 @@ class CaptureTest extends \PHPUnit_Framework_TestCase { $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/CarrierAccountTest.php b/tests/PayPal/Test/Api/CarrierAccountTest.php new file mode 100644 index 0000000..bbaa6cd --- /dev/null +++ b/tests/PayPal/Test/Api/CarrierAccountTest.php @@ -0,0 +1,65 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getId()); + $this->assertNotNull($obj->getPhoneNumber()); + $this->assertNotNull($obj->getExternalCustomerId()); + $this->assertNotNull($obj->getPhoneSource()); + $this->assertNotNull($obj->getCountryCode()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param CarrierAccount $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getId(), "TestSample"); + $this->assertEquals($obj->getPhoneNumber(), "TestSample"); + $this->assertEquals($obj->getExternalCustomerId(), "TestSample"); + $this->assertEquals($obj->getPhoneSource(), "TestSample"); + $this->assertEquals($obj->getCountryCode(), CountryCodeTest::getObject()); + } + + +} diff --git a/tests/PayPal/Test/Api/CarrierAccountTokenTest.php b/tests/PayPal/Test/Api/CarrierAccountTokenTest.php index efc966d..dfb909a 100644 --- a/tests/PayPal/Test/Api/CarrierAccountTokenTest.php +++ b/tests/PayPal/Test/Api/CarrierAccountTokenTest.php @@ -13,6 +13,7 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object CarrierAccountToken + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return CarrierAccountToken */ public static function getObject() @@ -32,6 +34,7 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return CarrierAccountToken */ public function testSerializationDeserialization() @@ -53,4 +56,6 @@ class CarrierAccountTokenTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getCarrierAccountId(), "TestSample"); $this->assertEquals($obj->getExternalCustomerId(), "TestSample"); } + + } diff --git a/tests/PayPal/Test/Api/CartBaseTest.php b/tests/PayPal/Test/Api/CartBaseTest.php index 5d8161c..73ec0b3 100644 --- a/tests/PayPal/Test/Api/CartBaseTest.php +++ b/tests/PayPal/Test/Api/CartBaseTest.php @@ -13,15 +13,17 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object CartBase + * * @return string */ public static function getJson() { - return '{"amount":' .AmountTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"description":"TestSample","note_to_payee":"TestSample","custom":"TestSample","invoice_number":"TestSample","soft_descriptor":"TestSample","payment_options":' .PaymentOptionsTest::getJson() . ',"item_list":' .ItemListTest::getJson() . ',"notify_url":"http://www.google.com","order_url":"http://www.google.com"}'; + 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() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return CartBase */ public static function getObject() @@ -32,12 +34,14 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return CartBase */ public function testSerializationDeserialization() { $obj = new CartBase(self::getJson()); $this->assertNotNull($obj); + $this->assertNotNull($obj->getReferenceId()); $this->assertNotNull($obj->getAmount()); $this->assertNotNull($obj->getPayee()); $this->assertNotNull($obj->getDescription()); @@ -45,10 +49,12 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getCustom()); $this->assertNotNull($obj->getInvoiceNumber()); $this->assertNotNull($obj->getSoftDescriptor()); + $this->assertNotNull($obj->getSoftDescriptorCity()); $this->assertNotNull($obj->getPaymentOptions()); $this->assertNotNull($obj->getItemList()); $this->assertNotNull($obj->getNotifyUrl()); $this->assertNotNull($obj->getOrderUrl()); + $this->assertNotNull($obj->getExternalFunding()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -59,6 +65,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase */ public function testGetters($obj) { + $this->assertEquals($obj->getReferenceId(), "TestSample"); $this->assertEquals($obj->getAmount(), AmountTest::getObject()); $this->assertEquals($obj->getPayee(), PayeeTest::getObject()); $this->assertEquals($obj->getDescription(), "TestSample"); @@ -66,10 +73,12 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getCustom(), "TestSample"); $this->assertEquals($obj->getInvoiceNumber(), "TestSample"); $this->assertEquals($obj->getSoftDescriptor(), "TestSample"); + $this->assertEquals($obj->getSoftDescriptorCity(), "TestSample"); $this->assertEquals($obj->getPaymentOptions(), PaymentOptionsTest::getObject()); $this->assertEquals($obj->getItemList(), ItemListTest::getObject()); $this->assertEquals($obj->getNotifyUrl(), "http://www.google.com"); $this->assertEquals($obj->getOrderUrl(), "http://www.google.com"); + $this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject()); } /** @@ -81,6 +90,7 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase $obj = new CartBase(); $obj->setNotifyUrl(null); } + /** * @expectedException \InvalidArgumentException * @expectedExceptionMessage OrderUrl is not a fully qualified URL @@ -90,4 +100,5 @@ class CartBaseTest extends \PHPUnit_Framework_TestCase $obj = new CartBase(); $obj->setOrderUrl(null); } + } diff --git a/tests/PayPal/Test/Api/CountryCodeTest.php b/tests/PayPal/Test/Api/CountryCodeTest.php new file mode 100644 index 0000000..73e5b8f --- /dev/null +++ b/tests/PayPal/Test/Api/CountryCodeTest.php @@ -0,0 +1,57 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getCountryCode()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param CountryCode $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getCountryCode(), "TestSample"); + } + + +} diff --git a/tests/PayPal/Test/Api/CreditCardTest.php b/tests/PayPal/Test/Api/CreditCardTest.php index 0a6e485..0eb4f7c 100644 --- a/tests/PayPal/Test/Api/CreditCardTest.php +++ b/tests/PayPal/Test/Api/CreditCardTest.php @@ -3,7 +3,6 @@ namespace PayPal\Test\Api; use PayPal\Api\CreditCard; -use PayPal\Transport\PPRestCall; /** * Class CreditCard @@ -14,15 +13,17 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object CreditCard + * * @return string */ public static function getJson() { - return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_address":' .AddressTest::getJson() . ',"external_customer_id":"TestSample","merchant_id":"TestSample","payer_id":"TestSample","external_card_id":"TestSample","state":"TestSample","create_time":"TestSample","update_time":"TestSample","valid_until":"TestSample","links":' .LinksTest::getJson() . '}'; + return '{"id":"TestSample","number":"TestSample","type":"TestSample","expire_month":123,"expire_year":123,"cvv2":"TestSample","first_name":"TestSample","last_name":"TestSample","billing_address":' . AddressTest::getJson() . ',"external_customer_id":"TestSample","state":"TestSample","valid_until":"TestSample","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return CreditCard */ public static function getObject() @@ -33,6 +34,7 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return CreditCard */ public function testSerializationDeserialization() @@ -49,12 +51,7 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getLastName()); $this->assertNotNull($obj->getBillingAddress()); $this->assertNotNull($obj->getExternalCustomerId()); - $this->assertNotNull($obj->getMerchantId()); - $this->assertNotNull($obj->getPayerId()); - $this->assertNotNull($obj->getExternalCardId()); $this->assertNotNull($obj->getState()); - $this->assertNotNull($obj->getCreateTime()); - $this->assertNotNull($obj->getUpdateTime()); $this->assertNotNull($obj->getValidUntil()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); @@ -77,123 +74,10 @@ class CreditCardTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getLastName(), "TestSample"); $this->assertEquals($obj->getBillingAddress(), AddressTest::getObject()); $this->assertEquals($obj->getExternalCustomerId(), "TestSample"); - $this->assertEquals($obj->getMerchantId(), "TestSample"); - $this->assertEquals($obj->getPayerId(), "TestSample"); - $this->assertEquals($obj->getExternalCardId(), "TestSample"); $this->assertEquals($obj->getState(), "TestSample"); - $this->assertEquals($obj->getCreateTime(), "TestSample"); - $this->assertEquals($obj->getUpdateTime(), "TestSample"); $this->assertEquals($obj->getValidUntil(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } - /** - * @dataProvider mockProvider - * @param CreditCard $obj - */ - public function testCreate($obj, $mockApiContext) - { - $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - $mockPPRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - self::getJson() - )); - - $result = $obj->create($mockApiContext, $mockPPRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param CreditCard $obj - */ - public function testGet($obj, $mockApiContext) - { - $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPPRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - CreditCardTest::getJson() - )); - - $result = $obj->get("creditCardId", $mockApiContext, $mockPPRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param CreditCard $obj - */ - public function testDelete($obj, $mockApiContext) - { - $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPPRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - true - )); - - $result = $obj->delete($mockApiContext, $mockPPRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param CreditCard $obj - */ - public function testUpdate($obj, $mockApiContext) - { - $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPPRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - self::getJson() - )); - $patchRequest = PatchRequestTest::getObject(); - - $result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall); - $this->assertNotNull($result); - } - /** - * @dataProvider mockProvider - * @param CreditCard $obj - */ - public function testList($obj, $mockApiContext) - { - $mockPPRestCall = $this->getMockBuilder('\PayPal\Transport\PayPalRestCall') - ->disableOriginalConstructor() - ->getMock(); - - $mockPPRestCall->expects($this->any()) - ->method('execute') - ->will($this->returnValue( - CreditCardListTest::getJson() - )); - $params = array(); - - $result = $obj->all($params, $mockApiContext, $mockPPRestCall); - $this->assertNotNull($result); - } - - public function mockProvider() - { - $obj = self::getObject(); - $mockApiContext = $this->getMockBuilder('ApiContext') - ->disableOriginalConstructor() - ->getMock(); - return array( - array($obj, $mockApiContext), - array($obj, null) - ); - } } diff --git a/tests/PayPal/Test/Api/CreditCardTokenTest.php b/tests/PayPal/Test/Api/CreditCardTokenTest.php index a610878..21aa209 100644 --- a/tests/PayPal/Test/Api/CreditCardTokenTest.php +++ b/tests/PayPal/Test/Api/CreditCardTokenTest.php @@ -13,6 +13,7 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object CreditCardToken + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return CreditCardToken */ public static function getObject() @@ -32,6 +34,7 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return CreditCardToken */ public function testSerializationDeserialization() @@ -62,4 +65,5 @@ class CreditCardTokenTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getExpireYear(), 123); } + } diff --git a/tests/PayPal/Test/Api/CreditFinancingOfferedTest.php b/tests/PayPal/Test/Api/CreditFinancingOfferedTest.php new file mode 100644 index 0000000..752a565 --- /dev/null +++ b/tests/PayPal/Test/Api/CreditFinancingOfferedTest.php @@ -0,0 +1,67 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getTotalCost()); + $this->assertNotNull($obj->getTerm()); + $this->assertNotNull($obj->getMonthlyPayment()); + $this->assertNotNull($obj->getTotalInterest()); + $this->assertNotNull($obj->getPayerAcceptance()); + $this->assertNotNull($obj->getCartAmountImmutable()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param CreditFinancingOffered $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getTotalCost(), CurrencyTest::getObject()); + $this->assertEquals($obj->getTerm(), "12.34"); + $this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject()); + $this->assertEquals($obj->getTotalInterest(), CurrencyTest::getObject()); + $this->assertEquals($obj->getPayerAcceptance(), true); + $this->assertEquals($obj->getCartAmountImmutable(), true); + } + + +} diff --git a/tests/PayPal/Test/Api/CreditTest.php b/tests/PayPal/Test/Api/CreditTest.php index e058bd6..56cca3f 100644 --- a/tests/PayPal/Test/Api/CreditTest.php +++ b/tests/PayPal/Test/Api/CreditTest.php @@ -13,6 +13,7 @@ class CreditTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Credit + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class CreditTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Credit */ public static function getObject() @@ -32,6 +34,7 @@ class CreditTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Credit */ public function testSerializationDeserialization() @@ -54,4 +57,5 @@ class CreditTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getType(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/CurrencyConversionTest.php b/tests/PayPal/Test/Api/CurrencyConversionTest.php index 2aea917..9027f3b 100644 --- a/tests/PayPal/Test/Api/CurrencyConversionTest.php +++ b/tests/PayPal/Test/Api/CurrencyConversionTest.php @@ -13,15 +13,17 @@ class CurrencyConversionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object CurrencyConversion + * * @return string */ public static function getJson() { - return '{"conversion_date":"TestSample","from_currency":"TestSample","from_amount":"TestSample","to_currency":"TestSample","to_amount":"TestSample","conversion_type":"TestSample","conversion_type_changeable":true,"web_url":"http://www.google.com","links":' .LinksTest::getJson() . '}'; + return '{"conversion_date":"TestSample","from_currency":"TestSample","from_amount":"TestSample","to_currency":"TestSample","to_amount":"TestSample","conversion_type":"TestSample","conversion_type_changeable":true,"web_url":"http://www.google.com","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return CurrencyConversion */ public static function getObject() @@ -32,6 +34,7 @@ class CurrencyConversionTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return CurrencyConversion */ public function testSerializationDeserialization() diff --git a/tests/PayPal/Test/Api/CurrencyTest.php b/tests/PayPal/Test/Api/CurrencyTest.php index 478dcc5..19cc0cf 100644 --- a/tests/PayPal/Test/Api/CurrencyTest.php +++ b/tests/PayPal/Test/Api/CurrencyTest.php @@ -13,6 +13,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Currency + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Currency */ public static function getObject() @@ -32,6 +34,7 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Currency */ public function testSerializationDeserialization() @@ -54,4 +57,5 @@ class CurrencyTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getValue(), "12.34"); } + } diff --git a/tests/PayPal/Test/Api/DetailsTest.php b/tests/PayPal/Test/Api/DetailsTest.php index 4d55ac8..a1e708f 100644 --- a/tests/PayPal/Test/Api/DetailsTest.php +++ b/tests/PayPal/Test/Api/DetailsTest.php @@ -13,6 +13,7 @@ class DetailsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Details + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class DetailsTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Details */ public static function getObject() @@ -32,6 +34,7 @@ class DetailsTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Details */ public function testSerializationDeserialization() @@ -65,4 +68,6 @@ class DetailsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getGiftWrap(), "12.34"); $this->assertEquals($obj->getFee(), "12.34"); } + + } diff --git a/tests/PayPal/Test/Api/ErrorDetailsTest.php b/tests/PayPal/Test/Api/ErrorDetailsTest.php index 852c349..60b9e77 100644 --- a/tests/PayPal/Test/Api/ErrorDetailsTest.php +++ b/tests/PayPal/Test/Api/ErrorDetailsTest.php @@ -13,6 +13,7 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ErrorDetails + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return ErrorDetails */ public static function getObject() @@ -32,6 +34,7 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return ErrorDetails */ public function testSerializationDeserialization() @@ -58,4 +61,5 @@ class ErrorDetailsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getCode(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/ErrorTest.php b/tests/PayPal/Test/Api/ErrorTest.php index bd00f11..4d12f3f 100644 --- a/tests/PayPal/Test/Api/ErrorTest.php +++ b/tests/PayPal/Test/Api/ErrorTest.php @@ -13,15 +13,17 @@ class ErrorTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Error + * * @return string */ public static function getJson() { - return '{"name":"TestSample","purchase_unit_reference_id":"TestSample","debug_id":"TestSample","message":"TestSample","code":"TestSample","information_link":"TestSample","details":' .ErrorDetailsTest::getJson() . ',"links":' .LinksTest::getJson() . '}'; + return '{"name":"TestSample","purchase_unit_reference_id":"TestSample","message":"TestSample","code":"TestSample","details":' . ErrorDetailsTest::getJson() . ',"processor_response":' . ProcessorResponseTest::getJson() . ',"fmf_details":' . FmfDetailsTest::getJson() . ',"information_link":"TestSample","debug_id":"TestSample","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Error */ public static function getObject() @@ -32,6 +34,7 @@ class ErrorTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Error */ public function testSerializationDeserialization() @@ -40,11 +43,13 @@ class ErrorTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj); $this->assertNotNull($obj->getName()); $this->assertNotNull($obj->getPurchaseUnitReferenceId()); - $this->assertNotNull($obj->getDebugId()); $this->assertNotNull($obj->getMessage()); $this->assertNotNull($obj->getCode()); - $this->assertNotNull($obj->getInformationLink()); $this->assertNotNull($obj->getDetails()); + $this->assertNotNull($obj->getProcessorResponse()); + $this->assertNotNull($obj->getFmfDetails()); + $this->assertNotNull($obj->getInformationLink()); + $this->assertNotNull($obj->getDebugId()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -58,12 +63,15 @@ class ErrorTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($obj->getName(), "TestSample"); $this->assertEquals($obj->getPurchaseUnitReferenceId(), "TestSample"); - $this->assertEquals($obj->getDebugId(), "TestSample"); $this->assertEquals($obj->getMessage(), "TestSample"); $this->assertEquals($obj->getCode(), "TestSample"); - $this->assertEquals($obj->getInformationLink(), "TestSample"); $this->assertEquals($obj->getDetails(), ErrorDetailsTest::getObject()); + $this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject()); + $this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject()); + $this->assertEquals($obj->getInformationLink(), "TestSample"); + $this->assertEquals($obj->getDebugId(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } + } diff --git a/tests/PayPal/Test/Api/ExtendedBankAccountTest.php b/tests/PayPal/Test/Api/ExtendedBankAccountTest.php index 689a625..fc9533f 100644 --- a/tests/PayPal/Test/Api/ExtendedBankAccountTest.php +++ b/tests/PayPal/Test/Api/ExtendedBankAccountTest.php @@ -13,6 +13,7 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ExtendedBankAccount + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return ExtendedBankAccount */ public static function getObject() @@ -32,6 +34,7 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return ExtendedBankAccount */ public function testSerializationDeserialization() @@ -52,4 +55,5 @@ class ExtendedBankAccountTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getMandateReferenceNumber(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/ExternalFundingTest.php b/tests/PayPal/Test/Api/ExternalFundingTest.php new file mode 100644 index 0000000..852ded8 --- /dev/null +++ b/tests/PayPal/Test/Api/ExternalFundingTest.php @@ -0,0 +1,65 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getReferenceId()); + $this->assertNotNull($obj->getCode()); + $this->assertNotNull($obj->getFundingAccountId()); + $this->assertNotNull($obj->getDisplayText()); + $this->assertNotNull($obj->getAmount()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param ExternalFunding $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getReferenceId(), "TestSample"); + $this->assertEquals($obj->getCode(), "TestSample"); + $this->assertEquals($obj->getFundingAccountId(), "TestSample"); + $this->assertEquals($obj->getDisplayText(), "TestSample"); + $this->assertEquals($obj->getAmount(), AmountTest::getObject()); + } + + +} diff --git a/tests/PayPal/Test/Api/FmfDetailsTest.php b/tests/PayPal/Test/Api/FmfDetailsTest.php index bf81b4a..96eb7ad 100644 --- a/tests/PayPal/Test/Api/FmfDetailsTest.php +++ b/tests/PayPal/Test/Api/FmfDetailsTest.php @@ -13,6 +13,7 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FmfDetails + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return FmfDetails */ public static function getObject() @@ -32,6 +34,7 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return FmfDetails */ public function testSerializationDeserialization() @@ -58,4 +61,5 @@ class FmfDetailsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getDescription(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/FundingDetailTest.php b/tests/PayPal/Test/Api/FundingDetailTest.php index 5f3b880..9f1f947 100644 --- a/tests/PayPal/Test/Api/FundingDetailTest.php +++ b/tests/PayPal/Test/Api/FundingDetailTest.php @@ -13,15 +13,17 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingDetail + * * @return string */ public static function getJson() { - return '{"clearing_time":"TestSample","payment_hold_date":"TestSample"}'; + return '{"clearing_time":"TestSample","payment_hold_date":"TestSample","payment_debit_date":"TestSample","processing_type":"TestSample"}'; } /** * Gets Object Instance with Json data filled in + * * @return FundingDetail */ public static function getObject() @@ -32,6 +34,7 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return FundingDetail */ public function testSerializationDeserialization() @@ -40,6 +43,8 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj); $this->assertNotNull($obj->getClearingTime()); $this->assertNotNull($obj->getPaymentHoldDate()); + $this->assertNotNull($obj->getPaymentDebitDate()); + $this->assertNotNull($obj->getProcessingType()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -52,6 +57,9 @@ class FundingDetailTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($obj->getClearingTime(), "TestSample"); $this->assertEquals($obj->getPaymentHoldDate(), "TestSample"); + $this->assertEquals($obj->getPaymentDebitDate(), "TestSample"); + $this->assertEquals($obj->getProcessingType(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/FundingInstrumentTest.php b/tests/PayPal/Test/Api/FundingInstrumentTest.php index 4148098..a329171 100644 --- a/tests/PayPal/Test/Api/FundingInstrumentTest.php +++ b/tests/PayPal/Test/Api/FundingInstrumentTest.php @@ -13,15 +13,17 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingInstrument + * * @return string */ public static function getJson() { - return '{"credit_card":' .CreditCardTest::getJson() . ',"credit_card_token":' .CreditCardTokenTest::getJson() . ',"payment_card":' .PaymentCardTest::getJson() . ',"payment_card_token":' .PaymentCardTokenTest::getJson() . ',"bank_account":' .ExtendedBankAccountTest::getJson() . ',"bank_account_token":' .BankTokenTest::getJson() . ',"credit":' .CreditTest::getJson() . '}'; + return '{"credit_card":' . CreditCardTest::getJson() . ',"credit_card_token":' . CreditCardTokenTest::getJson() . ',"payment_card":' . PaymentCardTest::getJson() . ',"bank_account":' . ExtendedBankAccountTest::getJson() . ',"bank_account_token":' . BankTokenTest::getJson() . ',"credit":' . CreditTest::getJson() . ',"incentive":' . IncentiveTest::getJson() . ',"external_funding":' . ExternalFundingTest::getJson() . ',"carrier_account_token":' . CarrierAccountTokenTest::getJson() . ',"carrier_account":' . CarrierAccountTest::getJson() . ',"private_label_card":' . PrivateLabelCardTest::getJson() . ',"billing":' . BillingTest::getJson() . ',"alternate_payment":' . AlternatePaymentTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return FundingInstrument */ public static function getObject() @@ -32,6 +34,7 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return FundingInstrument */ public function testSerializationDeserialization() @@ -41,10 +44,16 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getCreditCard()); $this->assertNotNull($obj->getCreditCardToken()); $this->assertNotNull($obj->getPaymentCard()); - $this->assertNotNull($obj->getPaymentCardToken()); $this->assertNotNull($obj->getBankAccount()); $this->assertNotNull($obj->getBankAccountToken()); $this->assertNotNull($obj->getCredit()); + $this->assertNotNull($obj->getIncentive()); + $this->assertNotNull($obj->getExternalFunding()); + $this->assertNotNull($obj->getCarrierAccountToken()); + $this->assertNotNull($obj->getCarrierAccount()); + $this->assertNotNull($obj->getPrivateLabelCard()); + $this->assertNotNull($obj->getBilling()); + $this->assertNotNull($obj->getAlternatePayment()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -58,10 +67,16 @@ class FundingInstrumentTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getCreditCard(), CreditCardTest::getObject()); $this->assertEquals($obj->getCreditCardToken(), CreditCardTokenTest::getObject()); $this->assertEquals($obj->getPaymentCard(), PaymentCardTest::getObject()); - $this->assertEquals($obj->getPaymentCardToken(), PaymentCardTokenTest::getObject()); $this->assertEquals($obj->getBankAccount(), ExtendedBankAccountTest::getObject()); $this->assertEquals($obj->getBankAccountToken(), BankTokenTest::getObject()); $this->assertEquals($obj->getCredit(), CreditTest::getObject()); + $this->assertEquals($obj->getIncentive(), IncentiveTest::getObject()); + $this->assertEquals($obj->getExternalFunding(), ExternalFundingTest::getObject()); + $this->assertEquals($obj->getCarrierAccountToken(), CarrierAccountTokenTest::getObject()); + $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 e11c7a9..ed44ef1 100644 --- a/tests/PayPal/Test/Api/FundingOptionTest.php +++ b/tests/PayPal/Test/Api/FundingOptionTest.php @@ -13,15 +13,17 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object FundingOption + * * @return string */ public static function getJson() { - return '{"id":"TestSample","funding_sources":' .FundingSourceTest::getJson() . ',"backup_funding_instrument":' .FundingInstrumentTest::getJson() . ',"currency_conversion":' .CurrencyConversionTest::getJson() . ',"installment_info":' .InstallmentInfoTest::getJson() . ',"links":' .LinksTest::getJson() . '}'; + return '{"id":"TestSample","funding_sources":' . FundingSourceTest::getJson() . ',"backup_funding_instrument":' . FundingInstrumentTest::getJson() . ',"currency_conversion":' . CurrencyConversionTest::getJson() . ',"installment_info":' . InstallmentInfoTest::getJson() . ',"links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return FundingOption */ public static function getObject() @@ -32,6 +34,7 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return FundingOption */ public function testSerializationDeserialization() @@ -61,4 +64,6 @@ class FundingOptionTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getInstallmentInfo(), InstallmentInfoTest::getObject()); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } + + } diff --git a/tests/PayPal/Test/Api/FundingSourceTest.php b/tests/PayPal/Test/Api/FundingSourceTest.php index c8f0616..d6160d4 100644 --- a/tests/PayPal/Test/Api/FundingSourceTest.php +++ b/tests/PayPal/Test/Api/FundingSourceTest.php @@ -13,15 +13,17 @@ 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() . ',"legal_text":"TestSample","funding_detail":' . FundingDetailTest::getJson() . ',"additional_text":"TestSample","extends":' . FundingInstrumentTest::getJson() . ',"links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return FundingSource */ public static function getObject() @@ -32,6 +34,7 @@ class FundingSourceTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return FundingSource */ public function testSerializationDeserialization() @@ -67,4 +70,6 @@ class FundingSourceTest extends \PHPUnit_Framework_TestCase $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 61f77e0..7f9aff8 100644 --- a/tests/PayPal/Test/Api/IncentiveTest.php +++ b/tests/PayPal/Test/Api/IncentiveTest.php @@ -13,15 +13,17 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Incentive + * * @return string */ public static function getJson() { - return '{"id":"TestSample","code":"TestSample","name":"TestSample","description":"TestSample","minimum_purchase_amount":' .CurrencyTest::getJson() . ',"logo_image_url":"http://www.google.com","expiry_date":"TestSample","type":"TestSample","terms":"TestSample"}'; + return '{"id":"TestSample","code":"TestSample","name":"TestSample","description":"TestSample","minimum_purchase_amount":' . CurrencyTest::getJson() . ',"logo_image_url":"http://www.google.com","expiry_date":"TestSample","type":"TestSample","terms":"TestSample"}'; } /** * Gets Object Instance with Json data filled in + * * @return Incentive */ public static function getObject() @@ -32,6 +34,7 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Incentive */ public function testSerializationDeserialization() @@ -77,4 +80,5 @@ class IncentiveTest extends \PHPUnit_Framework_TestCase $obj = new Incentive(); $obj->setLogoImageUrl(null); } + } diff --git a/tests/PayPal/Test/Api/InstallmentInfoTest.php b/tests/PayPal/Test/Api/InstallmentInfoTest.php index 0768a90..8867823 100644 --- a/tests/PayPal/Test/Api/InstallmentInfoTest.php +++ b/tests/PayPal/Test/Api/InstallmentInfoTest.php @@ -13,15 +13,17 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object InstallmentInfo + * * @return string */ public static function getJson() { - return '{"installment_id":"TestSample","network":"TestSample","issuer":"TestSample","installment_options":' .InstallmentOptionTest::getJson() . '}'; + return '{"installment_id":"TestSample","network":"TestSample","issuer":"TestSample","installment_options":' . InstallmentOptionTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return InstallmentInfo */ public static function getObject() @@ -32,6 +34,7 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return InstallmentInfo */ public function testSerializationDeserialization() @@ -57,4 +60,6 @@ class InstallmentInfoTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getIssuer(), "TestSample"); $this->assertEquals($obj->getInstallmentOptions(), InstallmentOptionTest::getObject()); } + + } diff --git a/tests/PayPal/Test/Api/InstallmentOptionTest.php b/tests/PayPal/Test/Api/InstallmentOptionTest.php index 10005a3..9c66ffc 100644 --- a/tests/PayPal/Test/Api/InstallmentOptionTest.php +++ b/tests/PayPal/Test/Api/InstallmentOptionTest.php @@ -13,15 +13,17 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object InstallmentOption + * * @return string */ public static function getJson() { - return '{"term":123,"monthly_payment":' .CurrencyTest::getJson() . ',"discount_amount":' .CurrencyTest::getJson() . ',"discount_percentage":"12.34"}'; + return '{"term":123,"monthly_payment":' . CurrencyTest::getJson() . ',"discount_amount":' . CurrencyTest::getJson() . ',"discount_percentage":"TestSample"}'; } /** * Gets Object Instance with Json data filled in + * * @return InstallmentOption */ public static function getObject() @@ -32,6 +34,7 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return InstallmentOption */ public function testSerializationDeserialization() @@ -55,6 +58,8 @@ class InstallmentOptionTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getTerm(), 123); $this->assertEquals($obj->getMonthlyPayment(), CurrencyTest::getObject()); $this->assertEquals($obj->getDiscountAmount(), CurrencyTest::getObject()); - $this->assertEquals($obj->getDiscountPercentage(), "12.34"); + $this->assertEquals($obj->getDiscountPercentage(), "TestSample"); } + + } diff --git a/tests/PayPal/Test/Api/ItemListTest.php b/tests/PayPal/Test/Api/ItemListTest.php index a17aa14..2f9a805 100644 --- a/tests/PayPal/Test/Api/ItemListTest.php +++ b/tests/PayPal/Test/Api/ItemListTest.php @@ -13,15 +13,17 @@ class ItemListTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ItemList + * * @return string */ public static function getJson() { - return '{"items":' .ItemTest::getJson() . ',"shipping_address":' .ShippingAddressTest::getJson() . ',"shipping_method":"TestSample"}'; + return '{"items":' . ItemTest::getJson() . ',"shipping_address":' . ShippingAddressTest::getJson() . ',"shipping_method":"TestSample","shipping_phone_number":"TestSample"}'; } /** * Gets Object Instance with Json data filled in + * * @return ItemList */ public static function getObject() @@ -32,6 +34,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return ItemList */ public function testSerializationDeserialization() @@ -41,6 +44,7 @@ class ItemListTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getItems()); $this->assertNotNull($obj->getShippingAddress()); $this->assertNotNull($obj->getShippingMethod()); + $this->assertNotNull($obj->getShippingPhoneNumber()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -54,6 +58,8 @@ class ItemListTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getItems(), ItemTest::getObject()); $this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject()); $this->assertEquals($obj->getShippingMethod(), "TestSample"); + $this->assertEquals($obj->getShippingPhoneNumber(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/ItemTest.php b/tests/PayPal/Test/Api/ItemTest.php index a50daf6..311d108 100644 --- a/tests/PayPal/Test/Api/ItemTest.php +++ b/tests/PayPal/Test/Api/ItemTest.php @@ -13,15 +13,17 @@ class ItemTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Item + * * @return string */ public static function getJson() { - return '{"quantity":"TestSample","name":"TestSample","description":"TestSample","price":"12.34","tax":"12.34","currency":"TestSample","sku":"TestSample","url":"http://www.google.com","category":"TestSample","weight":' .MeasurementTest::getJson() . ',"length":' .MeasurementTest::getJson() . ',"height":' .MeasurementTest::getJson() . ',"width":' .MeasurementTest::getJson() . ',"supplementary_data":' .NameValuePairTest::getJson() . ',"postback_data":' .NameValuePairTest::getJson() . '}'; + return '{"sku":"TestSample","name":"TestSample","description":"TestSample","quantity":"12.34","price":"12.34","currency":"TestSample","tax":"12.34","url":"http://www.google.com","category":"TestSample","weight":' . MeasurementTest::getJson() . ',"length":' . MeasurementTest::getJson() . ',"height":' . MeasurementTest::getJson() . ',"width":' . MeasurementTest::getJson() . ',"supplementary_data":' . NameValuePairTest::getJson() . ',"postback_data":' . NameValuePairTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Item */ public static function getObject() @@ -32,19 +34,20 @@ class ItemTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Item */ public function testSerializationDeserialization() { $obj = new Item(self::getJson()); $this->assertNotNull($obj); - $this->assertNotNull($obj->getQuantity()); + $this->assertNotNull($obj->getSku()); $this->assertNotNull($obj->getName()); $this->assertNotNull($obj->getDescription()); + $this->assertNotNull($obj->getQuantity()); $this->assertNotNull($obj->getPrice()); - $this->assertNotNull($obj->getTax()); $this->assertNotNull($obj->getCurrency()); - $this->assertNotNull($obj->getSku()); + $this->assertNotNull($obj->getTax()); $this->assertNotNull($obj->getUrl()); $this->assertNotNull($obj->getCategory()); $this->assertNotNull($obj->getWeight()); @@ -63,13 +66,13 @@ class ItemTest extends \PHPUnit_Framework_TestCase */ public function testGetters($obj) { - $this->assertEquals($obj->getQuantity(), "TestSample"); + $this->assertEquals($obj->getSku(), "TestSample"); $this->assertEquals($obj->getName(), "TestSample"); $this->assertEquals($obj->getDescription(), "TestSample"); + $this->assertEquals($obj->getQuantity(), "12.34"); $this->assertEquals($obj->getPrice(), "12.34"); - $this->assertEquals($obj->getTax(), "12.34"); $this->assertEquals($obj->getCurrency(), "TestSample"); - $this->assertEquals($obj->getSku(), "TestSample"); + $this->assertEquals($obj->getTax(), "12.34"); $this->assertEquals($obj->getUrl(), "http://www.google.com"); $this->assertEquals($obj->getCategory(), "TestSample"); $this->assertEquals($obj->getWeight(), MeasurementTest::getObject()); diff --git a/tests/PayPal/Test/Api/MeasurementTest.php b/tests/PayPal/Test/Api/MeasurementTest.php index 12a2606..889f7ef 100644 --- a/tests/PayPal/Test/Api/MeasurementTest.php +++ b/tests/PayPal/Test/Api/MeasurementTest.php @@ -13,6 +13,7 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Measurement + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Measurement */ public static function getObject() @@ -32,6 +34,7 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Measurement */ public function testSerializationDeserialization() @@ -54,4 +57,5 @@ class MeasurementTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getUnit(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/NameValuePairTest.php b/tests/PayPal/Test/Api/NameValuePairTest.php index 117bcf9..c709df7 100644 --- a/tests/PayPal/Test/Api/NameValuePairTest.php +++ b/tests/PayPal/Test/Api/NameValuePairTest.php @@ -13,6 +13,7 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object NameValuePair + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return NameValuePair */ public static function getObject() @@ -32,6 +34,7 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return NameValuePair */ public function testSerializationDeserialization() @@ -54,4 +57,5 @@ class NameValuePairTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getValue(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/OrderTest.php b/tests/PayPal/Test/Api/OrderTest.php index d5295c8..5bdc9a5 100644 --- a/tests/PayPal/Test/Api/OrderTest.php +++ b/tests/PayPal/Test/Api/OrderTest.php @@ -4,7 +4,6 @@ namespace PayPal\Test\Api; use PayPal\Api\Authorization; use PayPal\Api\Order; -use PayPal\Transport\PPRestCall; /** * Class Order @@ -15,15 +14,17 @@ 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","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() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Order */ public static function getObject() @@ -34,6 +35,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Order */ public function testSerializationDeserialization() @@ -80,7 +82,6 @@ class OrderTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getLinks(), LinksTest::getObject()); } - /** * @dataProvider mockProvider * @param Order $obj @@ -94,12 +95,13 @@ class OrderTest extends \PHPUnit_Framework_TestCase $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 @@ -113,13 +115,14 @@ class OrderTest extends \PHPUnit_Framework_TestCase $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 @@ -133,12 +136,13 @@ class OrderTest extends \PHPUnit_Framework_TestCase $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 @@ -152,7 +156,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - AuthorizationTest::getJson() + AuthorizationTest::getJson() )); $authorization = new Authorization(); @@ -164,8 +168,8 @@ class OrderTest extends \PHPUnit_Framework_TestCase { $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/PatchTest.php b/tests/PayPal/Test/Api/PatchTest.php index 639cf13..8ed800b 100644 --- a/tests/PayPal/Test/Api/PatchTest.php +++ b/tests/PayPal/Test/Api/PatchTest.php @@ -13,6 +13,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Patch + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Patch */ public static function getObject() @@ -32,6 +34,7 @@ class PatchTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Patch */ public function testSerializationDeserialization() @@ -58,4 +61,5 @@ class PatchTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getFrom(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/PayeeTest.php b/tests/PayPal/Test/Api/PayeeTest.php index a6a0eaa..853e56b 100644 --- a/tests/PayPal/Test/Api/PayeeTest.php +++ b/tests/PayPal/Test/Api/PayeeTest.php @@ -13,15 +13,17 @@ class PayeeTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Payee + * * @return string */ public static function getJson() { - return '{"email":"TestSample","merchant_id":"TestSample"}'; + 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() @@ -32,6 +34,7 @@ class PayeeTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Payee */ public function testSerializationDeserialization() @@ -40,6 +43,10 @@ class PayeeTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj); $this->assertNotNull($obj->getEmail()); $this->assertNotNull($obj->getMerchantId()); + $this->assertNotNull($obj->getFirstName()); + $this->assertNotNull($obj->getLastName()); + $this->assertNotNull($obj->getAccountNumber()); + $this->assertNotNull($obj->getPhone()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -52,5 +59,11 @@ class PayeeTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($obj->getEmail(), "TestSample"); $this->assertEquals($obj->getMerchantId(), "TestSample"); + $this->assertEquals($obj->getFirstName(), "TestSample"); + $this->assertEquals($obj->getLastName(), "TestSample"); + $this->assertEquals($obj->getAccountNumber(), "TestSample"); + $this->assertEquals($obj->getPhone(), PhoneTest::getObject()); } + + } diff --git a/tests/PayPal/Test/Api/PayerInfoTest.php b/tests/PayPal/Test/Api/PayerInfoTest.php index 2f1917e..7a1546a 100644 --- a/tests/PayPal/Test/Api/PayerInfoTest.php +++ b/tests/PayPal/Test/Api/PayerInfoTest.php @@ -13,15 +13,17 @@ 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","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() . '}'; + 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() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return PayerInfo */ public static function getObject() @@ -32,6 +34,7 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return PayerInfo */ public function testSerializationDeserialization() @@ -40,7 +43,7 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj); $this->assertNotNull($obj->getEmail()); $this->assertNotNull($obj->getExternalRememberMeId()); - $this->assertNotNull($obj->getBuyerAccountNumber()); + $this->assertNotNull($obj->getAccountNumber()); $this->assertNotNull($obj->getSalutation()); $this->assertNotNull($obj->getFirstName()); $this->assertNotNull($obj->getMiddleName()); @@ -67,7 +70,7 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase { $this->assertEquals($obj->getEmail(), "TestSample"); $this->assertEquals($obj->getExternalRememberMeId(), "TestSample"); - $this->assertEquals($obj->getBuyerAccountNumber(), "TestSample"); + $this->assertEquals($obj->getAccountNumber(), "TestSample"); $this->assertEquals($obj->getSalutation(), "TestSample"); $this->assertEquals($obj->getFirstName(), "TestSample"); $this->assertEquals($obj->getMiddleName(), "TestSample"); @@ -84,4 +87,5 @@ class PayerInfoTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getShippingAddress(), ShippingAddressTest::getObject()); } + } diff --git a/tests/PayPal/Test/Api/PayerTest.php b/tests/PayPal/Test/Api/PayerTest.php index 209313c..e5cab69 100644 --- a/tests/PayPal/Test/Api/PayerTest.php +++ b/tests/PayPal/Test/Api/PayerTest.php @@ -13,15 +13,17 @@ 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() . ',"related_funding_option":' . FundingOptionTest::getJson() . ',"payer_info":' . PayerInfoTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Payer */ public static function getObject() @@ -32,6 +34,7 @@ class PayerTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Payer */ public function testSerializationDeserialization() @@ -68,4 +71,5 @@ class PayerTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getPayerInfo(), PayerInfoTest::getObject()); } + } diff --git a/tests/PayPal/Test/Api/PaymentCardTest.php b/tests/PayPal/Test/Api/PaymentCardTest.php index a375f31..44aa163 100644 --- a/tests/PayPal/Test/Api/PaymentCardTest.php +++ b/tests/PayPal/Test/Api/PaymentCardTest.php @@ -13,15 +13,17 @@ 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","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","valid_until":"TestSample","issue_number":"TestSample","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return PaymentCard */ public static function getObject() @@ -32,6 +34,7 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return PaymentCard */ public function testSerializationDeserialization() @@ -53,6 +56,7 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getExternalCustomerId()); $this->assertNotNull($obj->getStatus()); $this->assertNotNull($obj->getValidUntil()); + $this->assertNotNull($obj->getIssueNumber()); $this->assertNotNull($obj->getLinks()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -79,7 +83,9 @@ class PaymentCardTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getExternalCustomerId(), "TestSample"); $this->assertEquals($obj->getStatus(), "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 996674e..fe25bd6 100644 --- a/tests/PayPal/Test/Api/PaymentExecutionTest.php +++ b/tests/PayPal/Test/Api/PaymentExecutionTest.php @@ -13,15 +13,17 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentExecution + * * @return string */ public static function getJson() { - return '{"payer_id":"TestSample","transactions":[' .TransactionTest::getJson() . ']}'; + return '{"payer_id":"TestSample","carrier_account_id":"TestSample","transactions":[' . TransactionTest::getJson() . ']}'; } /** * Gets Object Instance with Json data filled in + * * @return PaymentExecution */ public static function getObject() @@ -32,6 +34,7 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return PaymentExecution */ public function testSerializationDeserialization() @@ -39,6 +42,7 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase $obj = new PaymentExecution(self::getJson()); $this->assertNotNull($obj); $this->assertNotNull($obj->getPayerId()); + $this->assertNotNull($obj->getCarrierAccountId()); $this->assertNotNull($obj->getTransactions()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; @@ -51,6 +55,9 @@ class PaymentExecutionTest extends \PHPUnit_Framework_TestCase public function testGetters($obj) { $this->assertEquals($obj->getPayerId(), "TestSample"); + $this->assertEquals($obj->getCarrierAccountId(), "TestSample"); $this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject())); } + + } diff --git a/tests/PayPal/Test/Api/PaymentHistoryTest.php b/tests/PayPal/Test/Api/PaymentHistoryTest.php index 592c30c..dade26c 100644 --- a/tests/PayPal/Test/Api/PaymentHistoryTest.php +++ b/tests/PayPal/Test/Api/PaymentHistoryTest.php @@ -13,15 +13,17 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentHistory + * * @return string */ public static function getJson() { - return '{"payments":' .PaymentTest::getJson() . ',"count":123,"next_id":"TestSample"}'; + return '{"payments":' . PaymentTest::getJson() . ',"count":123,"next_id":"TestSample"}'; } /** * Gets Object Instance with Json data filled in + * * @return PaymentHistory */ public static function getObject() @@ -32,6 +34,7 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return PaymentHistory */ public function testSerializationDeserialization() @@ -55,4 +58,6 @@ class PaymentHistoryTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getCount(), 123); $this->assertEquals($obj->getNextId(), "TestSample"); } + + } diff --git a/tests/PayPal/Test/Api/PaymentOptionsTest.php b/tests/PayPal/Test/Api/PaymentOptionsTest.php index 572375f..e2bbda2 100644 --- a/tests/PayPal/Test/Api/PaymentOptionsTest.php +++ b/tests/PayPal/Test/Api/PaymentOptionsTest.php @@ -13,15 +13,17 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object PaymentOptions + * * @return string */ public static function getJson() { - return '{"allowed_payment_method":"TestSample"}'; + return '{"allowed_payment_method":"TestSample","recurring_flag":true,"skip_fmf":true}'; } /** * Gets Object Instance with Json data filled in + * * @return PaymentOptions */ public static function getObject() @@ -32,6 +34,7 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return PaymentOptions */ public function testSerializationDeserialization() @@ -39,6 +42,8 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase $obj = new PaymentOptions(self::getJson()); $this->assertNotNull($obj); $this->assertNotNull($obj->getAllowedPaymentMethod()); + $this->assertNotNull($obj->getRecurringFlag()); + $this->assertNotNull($obj->getSkipFmf()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -50,5 +55,9 @@ class PaymentOptionsTest extends \PHPUnit_Framework_TestCase public function testGetters($obj) { $this->assertEquals($obj->getAllowedPaymentMethod(), "TestSample"); + $this->assertEquals($obj->getRecurringFlag(), true); + $this->assertEquals($obj->getSkipFmf(), true); } + + } diff --git a/tests/PayPal/Test/Api/PaymentTest.php b/tests/PayPal/Test/Api/PaymentTest.php index 783c234..2f6d88e 100644 --- a/tests/PayPal/Test/Api/PaymentTest.php +++ b/tests/PayPal/Test/Api/PaymentTest.php @@ -4,7 +4,6 @@ namespace PayPal\Test\Api; use PayPal\Api\object; use PayPal\Api\Payment; -use PayPal\Transport\PPRestCall; /** * Class Payment @@ -15,15 +14,17 @@ class PaymentTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Payment + * * @return string */ public static function getJson() { - return '{"id":"TestSample","intent":"TestSample","payer":' .PayerTest::getJson() . ',"payee":' .PayeeTest::getJson() . ',"cart":"TestSample","transactions":[' .TransactionTest::getJson() . '],"failed_transactions":' .ErrorTest::getJson() . ',"payment_instruction":' .PaymentInstructionTest::getJson() . ',"state":"TestSample","experience_profile_id":"TestSample","redirect_urls":' .RedirectUrlsTest::getJson() . ',"create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}'; + return '{"id":"TestSample","intent":"TestSample","payer":' . PayerTest::getJson() . ',"potential_payer_info":' . PotentialPayerInfoTest::getJson() . ',"payee":' . PayeeTest::getJson() . ',"cart":"TestSample","transactions":[' . TransactionTest::getJson() . '],"failed_transactions":' . ErrorTest::getJson() . ',"billing_agreement_tokens":["TestSample"],"credit_financing_offered":' . CreditFinancingOfferedTest::getJson() . ',"payment_instruction":' . PaymentInstructionTest::getJson() . ',"state":"TestSample","experience_profile_id":"TestSample","note_to_payer":"TestSample","redirect_urls":' . RedirectUrlsTest::getJson() . ',"failure_reason":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Payment */ public static function getObject() @@ -34,6 +35,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Payment */ public function testSerializationDeserialization() @@ -43,14 +45,19 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getId()); $this->assertNotNull($obj->getIntent()); $this->assertNotNull($obj->getPayer()); + $this->assertNotNull($obj->getPotentialPayerInfo()); $this->assertNotNull($obj->getPayee()); $this->assertNotNull($obj->getCart()); $this->assertNotNull($obj->getTransactions()); $this->assertNotNull($obj->getFailedTransactions()); + $this->assertNotNull($obj->getBillingAgreementTokens()); + $this->assertNotNull($obj->getCreditFinancingOffered()); $this->assertNotNull($obj->getPaymentInstruction()); $this->assertNotNull($obj->getState()); $this->assertNotNull($obj->getExperienceProfileId()); + $this->assertNotNull($obj->getNoteToPayer()); $this->assertNotNull($obj->getRedirectUrls()); + $this->assertNotNull($obj->getFailureReason()); $this->assertNotNull($obj->getCreateTime()); $this->assertNotNull($obj->getUpdateTime()); $this->assertNotNull($obj->getLinks()); @@ -67,14 +74,19 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getId(), "TestSample"); $this->assertEquals($obj->getIntent(), "TestSample"); $this->assertEquals($obj->getPayer(), PayerTest::getObject()); + $this->assertEquals($obj->getPotentialPayerInfo(), PotentialPayerInfoTest::getObject()); $this->assertEquals($obj->getPayee(), PayeeTest::getObject()); $this->assertEquals($obj->getCart(), "TestSample"); $this->assertEquals($obj->getTransactions(), array(TransactionTest::getObject())); $this->assertEquals($obj->getFailedTransactions(), ErrorTest::getObject()); + $this->assertEquals($obj->getBillingAgreementTokens(), array("TestSample")); + $this->assertEquals($obj->getCreditFinancingOffered(), CreditFinancingOfferedTest::getObject()); $this->assertEquals($obj->getPaymentInstruction(), PaymentInstructionTest::getObject()); $this->assertEquals($obj->getState(), "TestSample"); $this->assertEquals($obj->getExperienceProfileId(), "TestSample"); + $this->assertEquals($obj->getNoteToPayer(), "TestSample"); $this->assertEquals($obj->getRedirectUrls(), RedirectUrlsTest::getObject()); + $this->assertEquals($obj->getFailureReason(), "TestSample"); $this->assertEquals($obj->getCreateTime(), "TestSample"); $this->assertEquals($obj->getUpdateTime(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); @@ -93,12 +105,13 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $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 @@ -112,12 +125,13 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $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 @@ -138,6 +152,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $result = $obj->update($patchRequest, $mockApiContext, $mockPPRestCall); $this->assertNotNull($result); } + /** * @dataProvider mockProvider * @param Payment $obj @@ -151,13 +166,14 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $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 @@ -171,7 +187,7 @@ class PaymentTest extends \PHPUnit_Framework_TestCase $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - PaymentHistoryTest::getJson() + PaymentHistoryTest::getJson() )); $params = array(); @@ -183,8 +199,8 @@ class PaymentTest extends \PHPUnit_Framework_TestCase { $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 8eca256..bae5453 100644 --- a/tests/PayPal/Test/Api/PhoneTest.php +++ b/tests/PayPal/Test/Api/PhoneTest.php @@ -13,6 +13,7 @@ class PhoneTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Phone + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class PhoneTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Phone */ public static function getObject() @@ -32,6 +34,7 @@ class PhoneTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Phone */ public function testSerializationDeserialization() @@ -56,4 +59,5 @@ class PhoneTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getExtension(), "TestSample"); } + } diff --git a/tests/PayPal/Test/Api/PotentialPayerInfoTest.php b/tests/PayPal/Test/Api/PotentialPayerInfoTest.php new file mode 100644 index 0000000..699deff --- /dev/null +++ b/tests/PayPal/Test/Api/PotentialPayerInfoTest.php @@ -0,0 +1,63 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getEmail()); + $this->assertNotNull($obj->getExternalRememberMeId()); + $this->assertNotNull($obj->getAccountNumber()); + $this->assertNotNull($obj->getBillingAddress()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param PotentialPayerInfo $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getEmail(), "TestSample"); + $this->assertEquals($obj->getExternalRememberMeId(), "TestSample"); + $this->assertEquals($obj->getAccountNumber(), "TestSample"); + $this->assertEquals($obj->getBillingAddress(), AddressTest::getObject()); + } + + +} diff --git a/tests/PayPal/Test/Api/PrivateLabelCardTest.php b/tests/PayPal/Test/Api/PrivateLabelCardTest.php new file mode 100644 index 0000000..2ec678e --- /dev/null +++ b/tests/PayPal/Test/Api/PrivateLabelCardTest.php @@ -0,0 +1,65 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getId()); + $this->assertNotNull($obj->getCardNumber()); + $this->assertNotNull($obj->getIssuerId()); + $this->assertNotNull($obj->getIssuerName()); + $this->assertNotNull($obj->getImageKey()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param PrivateLabelCard $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getId(), "TestSample"); + $this->assertEquals($obj->getCardNumber(), "TestSample"); + $this->assertEquals($obj->getIssuerId(), "TestSample"); + $this->assertEquals($obj->getIssuerName(), "TestSample"); + $this->assertEquals($obj->getImageKey(), "TestSample"); + } + + +} diff --git a/tests/PayPal/Test/Api/ProcessorResponseTest.php b/tests/PayPal/Test/Api/ProcessorResponseTest.php new file mode 100644 index 0000000..6fad9ea --- /dev/null +++ b/tests/PayPal/Test/Api/ProcessorResponseTest.php @@ -0,0 +1,67 @@ +assertNotNull($obj); + $this->assertNotNull($obj->getResponseCode()); + $this->assertNotNull($obj->getAvsCode()); + $this->assertNotNull($obj->getCvvCode()); + $this->assertNotNull($obj->getAdviceCode()); + $this->assertNotNull($obj->getEciSubmitted()); + $this->assertNotNull($obj->getVpas()); + $this->assertEquals(self::getJson(), $obj->toJson()); + return $obj; + } + + /** + * @depends testSerializationDeserialization + * @param ProcessorResponse $obj + */ + public function testGetters($obj) + { + $this->assertEquals($obj->getResponseCode(), "TestSample"); + $this->assertEquals($obj->getAvsCode(), "TestSample"); + $this->assertEquals($obj->getCvvCode(), "TestSample"); + $this->assertEquals($obj->getAdviceCode(), "TestSample"); + $this->assertEquals($obj->getEciSubmitted(), "TestSample"); + $this->assertEquals($obj->getVpas(), "TestSample"); + } + + +} diff --git a/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php b/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php index 93c481c..60176d7 100644 --- a/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php +++ b/tests/PayPal/Test/Api/RecipientBankingInstructionTest.php @@ -13,6 +13,7 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object RecipientBankingInstruction + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return RecipientBankingInstruction */ public static function getObject() @@ -32,6 +34,7 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return RecipientBankingInstruction */ public function testSerializationDeserialization() @@ -61,4 +64,6 @@ class RecipientBankingInstructionTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getInternationalBankAccountNumber(), "TestSample"); $this->assertEquals($obj->getBankIdentifierCode(), "TestSample"); } + + } diff --git a/tests/PayPal/Test/Api/RedirectUrlsTest.php b/tests/PayPal/Test/Api/RedirectUrlsTest.php index ed149e6..e69660a 100644 --- a/tests/PayPal/Test/Api/RedirectUrlsTest.php +++ b/tests/PayPal/Test/Api/RedirectUrlsTest.php @@ -13,6 +13,7 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object RedirectUrls + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return RedirectUrls */ public static function getObject() @@ -32,6 +34,7 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return RedirectUrls */ public function testSerializationDeserialization() @@ -53,4 +56,25 @@ class RedirectUrlsTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getReturnUrl(), "http://www.google.com"); $this->assertEquals($obj->getCancelUrl(), "http://www.google.com"); } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage ReturnUrl is not a fully qualified URL + */ + public function testUrlValidationForReturnUrl() + { + $obj = new RedirectUrls(); + $obj->setReturnUrl(null); + } + + /** + * @expectedException \InvalidArgumentException + * @expectedExceptionMessage CancelUrl is not a fully qualified URL + */ + public function testUrlValidationForCancelUrl() + { + $obj = new RedirectUrls(); + $obj->setCancelUrl(null); + } + } diff --git a/tests/PayPal/Test/Api/RefundTest.php b/tests/PayPal/Test/Api/RefundTest.php index 1848cfe..4edc7fb 100644 --- a/tests/PayPal/Test/Api/RefundTest.php +++ b/tests/PayPal/Test/Api/RefundTest.php @@ -3,7 +3,6 @@ namespace PayPal\Test\Api; use PayPal\Api\Refund; -use PayPal\Transport\PPRestCall; /** * Class Refund @@ -14,15 +13,17 @@ 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","sale_id":"TestSample","capture_id":"TestSample","parent_payment":"TestSample","description":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Refund */ public static function getObject() @@ -33,6 +34,7 @@ class RefundTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Refund */ public function testSerializationDeserialization() @@ -86,7 +88,7 @@ class RefundTest extends \PHPUnit_Framework_TestCase $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - RefundTest::getJson() + RefundTest::getJson() )); $result = $obj->get("refundId", $mockApiContext, $mockPPRestCall); @@ -97,8 +99,8 @@ class RefundTest extends \PHPUnit_Framework_TestCase { $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 e4688b5..077725e 100644 --- a/tests/PayPal/Test/Api/RelatedResourcesTest.php +++ b/tests/PayPal/Test/Api/RelatedResourcesTest.php @@ -13,15 +13,17 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object RelatedResources + * * @return string */ public static function getJson() { - return '{}'; + return '{"sale":' . SaleTest::getJson() . ',"authorization":' . AuthorizationTest::getJson() . ',"order":' . OrderTest::getJson() . ',"capture":' . CaptureTest::getJson() . ',"refund":' . RefundTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return RelatedResources */ public static function getObject() @@ -32,12 +34,18 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return RelatedResources */ public function testSerializationDeserialization() { $obj = new RelatedResources(self::getJson()); $this->assertNotNull($obj); + $this->assertNotNull($obj->getSale()); + $this->assertNotNull($obj->getAuthorization()); + $this->assertNotNull($obj->getOrder()); + $this->assertNotNull($obj->getCapture()); + $this->assertNotNull($obj->getRefund()); $this->assertEquals(self::getJson(), $obj->toJson()); return $obj; } @@ -48,6 +56,12 @@ class RelatedResourcesTest extends \PHPUnit_Framework_TestCase */ public function testGetters($obj) { + $this->assertEquals($obj->getSale(), SaleTest::getObject()); + $this->assertEquals($obj->getAuthorization(), AuthorizationTest::getObject()); + $this->assertEquals($obj->getOrder(), OrderTest::getObject()); + $this->assertEquals($obj->getCapture(), CaptureTest::getObject()); + $this->assertEquals($obj->getRefund(), RefundTest::getObject()); } + } diff --git a/tests/PayPal/Test/Api/SaleTest.php b/tests/PayPal/Test/Api/SaleTest.php index 6553d7b..2a61512 100644 --- a/tests/PayPal/Test/Api/SaleTest.php +++ b/tests/PayPal/Test/Api/SaleTest.php @@ -3,7 +3,6 @@ namespace PayPal\Test\Api; use PayPal\Api\Sale; -use PayPal\Transport\PPRestCall; /** * Class Sale @@ -14,15 +13,17 @@ class SaleTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Sale + * * @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","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","clearing_time":"TestSample","recipient_fund_status":"TestSample","hold_reason":"TestSample","transaction_fee":' .CurrencyTest::getJson() . ',"receivable_amount":' .CurrencyTest::getJson() . ',"exchange_rate":"TestSample","fmf_details":' .FmfDetailsTest::getJson() . ',"receipt_id":"TestSample","parent_payment":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' .LinksTest::getJson() . '}'; + return '{"id":"TestSample","purchase_unit_reference_id":"TestSample","amount":' . AmountTest::getJson() . ',"payment_mode":"TestSample","state":"TestSample","reason_code":"TestSample","protection_eligibility":"TestSample","protection_eligibility_type":"TestSample","clearing_time":"TestSample","payment_hold_status":"TestSample","payment_hold_reasons":"TestSample","transaction_fee":' . CurrencyTest::getJson() . ',"receivable_amount":' . CurrencyTest::getJson() . ',"exchange_rate":"TestSample","fmf_details":' . FmfDetailsTest::getJson() . ',"receipt_id":"TestSample","parent_payment":"TestSample","processor_response":' . ProcessorResponseTest::getJson() . ',"billing_agreement_id":"TestSample","create_time":"TestSample","update_time":"TestSample","links":' . LinksTest::getJson() . '}'; } /** * Gets Object Instance with Json data filled in + * * @return Sale */ public static function getObject() @@ -33,6 +34,7 @@ class SaleTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Sale */ public function testSerializationDeserialization() @@ -48,14 +50,16 @@ class SaleTest extends \PHPUnit_Framework_TestCase $this->assertNotNull($obj->getProtectionEligibility()); $this->assertNotNull($obj->getProtectionEligibilityType()); $this->assertNotNull($obj->getClearingTime()); - $this->assertNotNull($obj->getRecipientFundStatus()); - $this->assertNotNull($obj->getHoldReason()); + $this->assertNotNull($obj->getPaymentHoldStatus()); + $this->assertNotNull($obj->getPaymentHoldReasons()); $this->assertNotNull($obj->getTransactionFee()); $this->assertNotNull($obj->getReceivableAmount()); $this->assertNotNull($obj->getExchangeRate()); $this->assertNotNull($obj->getFmfDetails()); $this->assertNotNull($obj->getReceiptId()); $this->assertNotNull($obj->getParentPayment()); + $this->assertNotNull($obj->getProcessorResponse()); + $this->assertNotNull($obj->getBillingAgreementId()); $this->assertNotNull($obj->getCreateTime()); $this->assertNotNull($obj->getUpdateTime()); $this->assertNotNull($obj->getLinks()); @@ -78,14 +82,16 @@ class SaleTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getProtectionEligibility(), "TestSample"); $this->assertEquals($obj->getProtectionEligibilityType(), "TestSample"); $this->assertEquals($obj->getClearingTime(), "TestSample"); - $this->assertEquals($obj->getRecipientFundStatus(), "TestSample"); - $this->assertEquals($obj->getHoldReason(), "TestSample"); + $this->assertEquals($obj->getPaymentHoldStatus(), "TestSample"); + $this->assertEquals($obj->getPaymentHoldReasons(), "TestSample"); $this->assertEquals($obj->getTransactionFee(), CurrencyTest::getObject()); $this->assertEquals($obj->getReceivableAmount(), CurrencyTest::getObject()); $this->assertEquals($obj->getExchangeRate(), "TestSample"); $this->assertEquals($obj->getFmfDetails(), FmfDetailsTest::getObject()); $this->assertEquals($obj->getReceiptId(), "TestSample"); $this->assertEquals($obj->getParentPayment(), "TestSample"); + $this->assertEquals($obj->getProcessorResponse(), ProcessorResponseTest::getObject()); + $this->assertEquals($obj->getBillingAgreementId(), "TestSample"); $this->assertEquals($obj->getCreateTime(), "TestSample"); $this->assertEquals($obj->getUpdateTime(), "TestSample"); $this->assertEquals($obj->getLinks(), LinksTest::getObject()); @@ -104,12 +110,13 @@ class SaleTest extends \PHPUnit_Framework_TestCase $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 @@ -123,7 +130,7 @@ class SaleTest extends \PHPUnit_Framework_TestCase $mockPPRestCall->expects($this->any()) ->method('execute') ->will($this->returnValue( - RefundTest::getJson() + RefundTest::getJson() )); $refund = RefundTest::getObject(); @@ -135,8 +142,8 @@ class SaleTest extends \PHPUnit_Framework_TestCase { $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/ShippingAddressTest.php b/tests/PayPal/Test/Api/ShippingAddressTest.php index 95a294a..7f2dabe 100644 --- a/tests/PayPal/Test/Api/ShippingAddressTest.php +++ b/tests/PayPal/Test/Api/ShippingAddressTest.php @@ -13,6 +13,7 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object ShippingAddress + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return ShippingAddress */ public static function getObject() @@ -32,6 +34,7 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return ShippingAddress */ public function testSerializationDeserialization() @@ -56,4 +59,5 @@ class ShippingAddressTest extends \PHPUnit_Framework_TestCase $this->assertEquals($obj->getDefaultAddress(), true); } + } diff --git a/tests/PayPal/Test/Api/TransactionTest.php b/tests/PayPal/Test/Api/TransactionTest.php index 7852a05..dd036d2 100644 --- a/tests/PayPal/Test/Api/TransactionTest.php +++ b/tests/PayPal/Test/Api/TransactionTest.php @@ -13,6 +13,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase { /** * Gets Json String of Object Transaction + * * @return string */ public static function getJson() @@ -22,6 +23,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase /** * Gets Object Instance with Json data filled in + * * @return Transaction */ public static function getObject() @@ -32,6 +34,7 @@ class TransactionTest extends \PHPUnit_Framework_TestCase /** * Tests for Serialization and Deserialization Issues + * * @return Transaction */ public function testSerializationDeserialization() @@ -49,4 +52,6 @@ class TransactionTest extends \PHPUnit_Framework_TestCase public function testGetters($obj) { } + + } diff --git a/tests/PayPal/Test/Api/WebhookEventTest.php b/tests/PayPal/Test/Api/WebhookEventTest.php index 3631e9d..02737cd 100644 --- a/tests/PayPal/Test/Api/WebhookEventTest.php +++ b/tests/PayPal/Test/Api/WebhookEventTest.php @@ -213,7 +213,7 @@ class WebhookEventTest extends \PHPUnit_Framework_TestCase * @dataProvider mockProvider * @param $mockApiContext ApiContext * @expectedException \PHPUnit_Framework_Error_Notice - * @expectedExceptionMessage Missing Accessor: PayPal\Api\WebhookEvent:setValid. You might be using older version of SDK. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues + * @expectedExceptionMessage It seems that PayPal\Api\WebhookEvent:setValid is a new field added to the API response. If not, create an issue at https://github.com/paypal/PayPal-PHP-SDK/issues */ public function testValidateWebhookValidJSONWithMissingObject($obj, $mockApiContext) { diff --git a/tests/PayPal/Test/Functional/Api/PaymentsFunctionalTest.php b/tests/PayPal/Test/Functional/Api/PaymentsFunctionalTest.php index bee7fb6..8a1ddf4 100644 --- a/tests/PayPal/Test/Functional/Api/PaymentsFunctionalTest.php +++ b/tests/PayPal/Test/Functional/Api/PaymentsFunctionalTest.php @@ -73,7 +73,6 @@ class PaymentsFunctionalTest extends \PHPUnit_Framework_TestCase $result = Payment::get($payment->getId(), $this->apiContext, $this->mockPayPalRestCall); $this->assertNotNull($result); $this->assertEquals($payment->getId(), $result->getId()); - $this->assertEquals($payment, $result, "", 0, 10, true); return $result; } diff --git a/tests/PayPal/Test/Functional/Setup.php b/tests/PayPal/Test/Functional/Setup.php index 86be9e1..529ffd0 100644 --- a/tests/PayPal/Test/Functional/Setup.php +++ b/tests/PayPal/Test/Functional/Setup.php @@ -19,7 +19,7 @@ class Setup 'log.LogEnabled' => true, 'log.FileName' => '../PayPal.log', 'log.LogLevel' => 'FINE', - 'validation.level' => 'strict' + 'validation.level' => 'log' ); $test->apiContext = new ApiContext( new OAuthTokenCredential('AYSq3RDGsmBLJE-otTkBtM-jBRd1TCQwFf9RGfwddNXWz0uFU9ztymylOhRS', 'EGnHDxD_qRPdaLdZz8iCr8N7_MzF-YHPTkjs6NKYQvQSBngp4PTTVWkPZRbL') diff --git a/tests/PayPal/Test/Validation/ModelAccessValidatorTest.php b/tests/PayPal/Test/Validation/ModelAccessValidatorTest.php index b670794..43c6cf0 100644 --- a/tests/PayPal/Test/Validation/ModelAccessValidatorTest.php +++ b/tests/PayPal/Test/Validation/ModelAccessValidatorTest.php @@ -24,7 +24,7 @@ class ModelAccessValidatorTest extends \PHPUnit_Framework_TestCase array(new SimpleClass(), null,'Error'), array(new SimpleClass(), array(),'Error'), array(null, 'name','must be an instance of PayPal\Common\PayPalModel, null given'), - array(new SimpleClass(),'notfound', 'Missing Accessor: PayPal\\Test\\Common\\SimpleClass:setnotfound') + array(new SimpleClass(),'notfound', 'It seems that PayPal\Test\Common\SimpleClass:setnotfound is a new field added to the API response') ); } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 1e67884..964d78f 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -1,10 +1,13 @@ add('PayPal\\Test', __DIR__); if (!defined("PP_CONFIG_PATH")) { define("PP_CONFIG_PATH", __DIR__);