1
0
* Automated commit message

* Automated commit message

---------

Co-authored-by: PayPalServerSDKs <server-sdks@paypal.com>
This commit is contained in:
Dani Kirby
2024-11-25 13:17:37 -06:00
committed by GitHub
parent de24c9e488
commit cf6ca18307
47 changed files with 2091 additions and 857 deletions

View File

@@ -23,6 +23,238 @@ use PaypalServerSdkLib\Models\OrderAuthorizeResponse;
class OrdersController extends BaseController
{
/**
* Creates an order. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and
* payment processing costs. For more information about processing payments, see <a href="https:
* //developer.paypal.com/docs/checkout/advanced/processing/">checkout</a> or <a href="https:
* //developer.paypal.com/docs/multiparty/checkout/advanced/processing/">multiparty checkout</a>.
* <blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href="https:
* //developer.paypal.com/api/rest/reference/orders/v2/errors/#create-order">Orders v2 errors</a>.
* </blockquote>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersCreate(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/checkout/orders')
->auth('Oauth2')
->parameters(
HeaderParam::init('Content-Type', 'application/json'),
BodyParam::init($options)->extract('body'),
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('PayPal-Partner-Attribution-Id', $options)->extract('paypalPartnerAttributionId'),
HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(Order::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Shows details for an order, by ID.<blockquote><strong>Note:</strong> For error handling and
* troubleshooting, see <a href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#get-
* order">Orders v2 errors</a>.</blockquote>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersGet(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/checkout/orders/{id}')
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
QueryParam::init('fields', $options)->extract('fields')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class))
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(Order::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Updates an order with a `CREATED` or `APPROVED` status. You cannot update an order with the
* `COMPLETED` status.<br/><br/>To make an update, you must provide a `reference_id`. If you omit this
* value with an order that contains only one purchase unit, PayPal sets the value to `default` which
* enables you to use the path: <code>\"/purchase_units/@reference_id=='default'/{attribute-or-
* object}\"</code>. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and
* payment processing costs. For more information about processing payments, see <a href="https:
* //developer.paypal.com/docs/checkout/advanced/processing/">checkout</a> or <a href="https:
* //developer.paypal.com/docs/multiparty/checkout/advanced/processing/">multiparty checkout</a>.
* <blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href="https:
* //developer.paypal.com/api/rest/reference/orders/v2/errors/#patch-order">Orders v2 errors</a>.
* </blockquote>Patchable attributes or objects:
* <br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th></thead><tbody><tr><td><code>inte
* nt</code></td><td>replace</td><td></td></tr><tr><td><code>payer</code></td><td>replace,
* add</td><td>Using replace op for <code>payer</code> will replace the whole <code>payer</code> object
* with the value sent in request.</td></tr><tr><td><code>purchase_units</code></td><td>replace,
* add</td><td></td></tr><tr><td><code>purchase_units[].custom_id</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].description</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].payee.
* email</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* name</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* email_address</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* phone_number</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* options</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* address</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* type</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].
* soft_descriptor</code></td><td>replace, remove</td><td></td></tr><tr><td><code>purchase_units[].
* amount</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].
* items</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>purchase_units[].
* invoice_id</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>purchase_units[].
* payment_instruction</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].
* payment_instruction.disbursement_mode</code></td><td>replace</td><td>By default,
* <code>disbursement_mode</code> is <code>INSTANT</code>.</td></tr><tr><td><code>purchase_units[].
* payment_instruction.payee_receivable_fx_rate_id</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].payment_instruction.
* platform_fees</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>purchase_units[].
* supplementary_data.airline</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].supplementary_data.
* card</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>application_context.
* client_configuration</code></td><td>replace, add</td><td></td></tr></tbody></table>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersPatch(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/v2/checkout/orders/{id}')
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
BodyParam::init($options)->extract('body')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class))
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Payer confirms their intent to pay for the the Order with the given payment source.
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersConfirm(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(
RequestMethod::POST,
'/v2/checkout/orders/{id}/confirm-payment-source'
)
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'),
BodyParam::init($options)->extract('body')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'403',
ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class)
)
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class))
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(Order::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Authorizes payment for an order. To successfully authorize payment for an order, the buyer must
* first approve the order or a valid payment_source must be provided in the request. A buyer can
@@ -89,196 +321,6 @@ class OrdersController extends BaseController
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Adds tracking information for an Order.
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersTrackCreate(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/checkout/orders/{id}/track')
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
HeaderParam::init('Content-Type', 'application/json'),
BodyParam::init($options)->extract('body'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'403',
ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class)
)
->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class))
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class))
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(Order::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Creates an order. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and
* payment processing costs. For more information about processing payments, see <a href="https:
* //developer.paypal.com/docs/checkout/advanced/processing/">checkout</a> or <a href="https:
* //developer.paypal.com/docs/multiparty/checkout/advanced/processing/">multiparty checkout</a>.
* <blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href="https:
* //developer.paypal.com/api/rest/reference/orders/v2/errors/#create-order">Orders v2 errors</a>.
* </blockquote>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersCreate(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/checkout/orders')
->auth('Oauth2')
->parameters(
HeaderParam::init('Content-Type', 'application/json'),
BodyParam::init($options)->extract('body'),
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('PayPal-Partner-Attribution-Id', $options)->extract('paypalPartnerAttributionId'),
HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(Order::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Updates an order with a `CREATED` or `APPROVED` status. You cannot update an order with the
* `COMPLETED` status.<br/><br/>To make an update, you must provide a `reference_id`. If you omit this
* value with an order that contains only one purchase unit, PayPal sets the value to `default` which
* enables you to use the path: <code>\"/purchase_units/@reference_id=='default'/{attribute-or-
* object}\"</code>. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and
* payment processing costs. For more information about processing payments, see <a href="https:
* //developer.paypal.com/docs/checkout/advanced/processing/">checkout</a> or <a href="https:
* //developer.paypal.com/docs/multiparty/checkout/advanced/processing/">multiparty checkout</a>.
* <blockquote><strong>Note:</strong> For error handling and troubleshooting, see <a href="https:
* //developer.paypal.com/api/rest/reference/orders/v2/errors/#patch-order">Orders v2 errors</a>.
* </blockquote>Patchable attributes or objects:
* <br/><br/><table><thead><th>Attribute</th><th>Op</th><th>Notes</th></thead><tbody><tr><td><code>inte
* nt</code></td><td>replace</td><td></td></tr><tr><td><code>payer</code></td><td>replace,
* add</td><td>Using replace op for <code>payer</code> will replace the whole <code>payer</code> object
* with the value sent in request.</td></tr><tr><td><code>purchase_units</code></td><td>replace,
* add</td><td></td></tr><tr><td><code>purchase_units[].custom_id</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].description</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].payee.
* email</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* name</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* email_address</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* phone_number</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* options</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* address</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].shipping.
* type</code></td><td>replace, add</td><td></td></tr><tr><td><code>purchase_units[].
* soft_descriptor</code></td><td>replace, remove</td><td></td></tr><tr><td><code>purchase_units[].
* amount</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].
* items</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>purchase_units[].
* invoice_id</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>purchase_units[].
* payment_instruction</code></td><td>replace</td><td></td></tr><tr><td><code>purchase_units[].
* payment_instruction.disbursement_mode</code></td><td>replace</td><td>By default,
* <code>disbursement_mode</code> is <code>INSTANT</code>.</td></tr><tr><td><code>purchase_units[].
* payment_instruction.payee_receivable_fx_rate_id</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].payment_instruction.
* platform_fees</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>purchase_units[].
* supplementary_data.airline</code></td><td>replace, add,
* remove</td><td></td></tr><tr><td><code>purchase_units[].supplementary_data.
* card</code></td><td>replace, add, remove</td><td></td></tr><tr><td><code>application_context.
* client_configuration</code></td><td>replace, add</td><td></td></tr></tbody></table>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersPatch(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::PATCH, '/v2/checkout/orders/{id}')
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
HeaderParam::init('Content-Type', 'application/json'),
BodyParam::init($options)->extract('body')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class))
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Captures payment for an order. To successfully capture payment for an order, the buyer must first
* approve the order or a valid payment_source must be provided in the request. A buyer can approve the
@@ -346,60 +388,21 @@ class OrdersController extends BaseController
}
/**
* Shows details for an order, by ID.<blockquote><strong>Note:</strong> For error handling and
* troubleshooting, see <a href="https://developer.paypal.com/api/rest/reference/orders/v2/errors/#get-
* order">Orders v2 errors</a>.</blockquote>
* Adds tracking information for an Order.
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersGet(array $options): ApiResponse
public function ordersTrackCreate(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/checkout/orders/{id}')
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
QueryParam::init('fields', $options)->extract('fields')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class))
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(Order::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Payer confirms their intent to pay for the the Order with the given payment source.
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function ordersConfirm(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(
RequestMethod::POST,
'/v2/checkout/orders/{id}/confirm-payment-source'
)
$_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v2/checkout/orders/{id}/track')
->auth('Oauth2')
->parameters(
TemplateParam::init('id', $options)->extract('id'),
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Client-Metadata-Id', $options)->extract('paypalClientMetadataId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'),
BodyParam::init($options)->extract('body')
BodyParam::init($options)->extract('body'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion')
);
$_resHandler = $this->responseHandler()
@@ -414,6 +417,7 @@ class OrdersController extends BaseController
'403',
ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class)
)
->throwErrorOn('404', ErrorType::init('The specified resource does not exist.', ErrorException::class))
->throwErrorOn(
'422',
ErrorType::init(
@@ -455,6 +459,7 @@ class OrdersController extends BaseController
TemplateParam::init('id', $options)->extract('id'),
TemplateParam::init('tracker_id', $options)->extract('trackerId'),
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
BodyParam::init($options)->extract('body')
);

View File

@@ -26,15 +26,18 @@ class PaymentsController extends BaseController
/**
* Shows details for an authorized payment, by ID.
*
* @param string $authorizationId The ID of the authorized payment for which to show details.
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function authorizationsGet(string $authorizationId): ApiResponse
public function authorizationsGet(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/payments/authorizations/{authorization_id}')
->auth('Oauth2')
->parameters(TemplateParam::init('authorization_id', $authorizationId));
->parameters(
TemplateParam::init('authorization_id', $options)->extract('authorizationId'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
@@ -45,13 +48,6 @@ class PaymentsController extends BaseController
ErrorException::class
)
)
->throwErrorOn(
'403',
ErrorType::init(
'The request failed because the caller has insufficient permissions.',
ErrorException::class
)
)
->throwErrorOn(
'404',
ErrorType::init('The request failed because the resource does not exist.', ErrorException::class)
@@ -83,6 +79,7 @@ class PaymentsController extends BaseController
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
BodyParam::init($options)->extract('body')
);
@@ -136,6 +133,76 @@ class PaymentsController extends BaseController
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Reauthorizes an authorized PayPal account payment, by ID. To ensure that funds are still available,
* reauthorize a payment after its initial three-day honor period expires. Within the 29-day
* authorization period, you can issue multiple re-authorizations after the honor period expires.
* <br/><br/>If 30 days have transpired since the date of the original authorization, you must create
* an authorized payment instead of reauthorizing the original authorized payment.<br/><br/>A
* reauthorized payment itself has a new honor period of three days.<br/><br/>You can reauthorize an
* authorized payment from 4 to 29 days after the 3-day honor period. The allowed amount depends on
* context and geography, for example in US it is up to 115% of the original authorized amount, not to
* exceed an increase of $75 USD.<br/><br/>Supports only the `amount` request parameter.
* <blockquote><strong>Note:</strong> This request is currently not supported for Partner use cases.
* </blockquote>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function authorizationsReauthorize(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(
RequestMethod::POST,
'/v2/payments/authorizations/{authorization_id}/reauthorize'
)
->auth('Oauth2')
->parameters(
TemplateParam::init('authorization_id', $options)->extract('authorizationId'),
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
BodyParam::init($options)->extract('body')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'The request failed because it is not well-formed or is syntactically incor' .
'rect or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn(
'404',
ErrorType::init('The request failed because the resource does not exist.', ErrorException::class)
)
->throwErrorOn(
'422',
ErrorType::init(
'The request failed because it either is semantically incorrect or failed b' .
'usiness validation.',
ErrorException::class
)
)
->throwErrorOn('500', ErrorType::init('The request failed because an internal server error occurred.'))
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(PaymentAuthorization::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Voids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been
* fully captured.
@@ -154,18 +221,11 @@ class PaymentsController extends BaseController
->parameters(
TemplateParam::init('authorization_id', $options)->extract('authorizationId'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion'),
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'The request failed because it is not well-formed or is syntactically incor' .
'rect or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
@@ -209,82 +269,6 @@ class PaymentsController extends BaseController
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Reauthorizes an authorized PayPal account payment, by ID. To ensure that funds are still available,
* reauthorize a payment after its initial three-day honor period expires. Within the 29-day
* authorization period, you can issue multiple re-authorizations after the honor period expires.
* <br/><br/>If 30 days have transpired since the date of the original authorization, you must create
* an authorized payment instead of reauthorizing the original authorized payment.<br/><br/>A
* reauthorized payment itself has a new honor period of three days.<br/><br/>You can reauthorize an
* authorized payment from 4 to 29 days after the 3-day honor period. The allowed amount depends on
* context and geography, for example in US it is up to 115% of the original authorized amount, not to
* exceed an increase of $75 USD.<br/><br/>Supports only the `amount` request parameter.
* <blockquote><strong>Note:</strong> This request is currently not supported for Partner use cases.
* </blockquote>
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function authorizationsReauthorize(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(
RequestMethod::POST,
'/v2/payments/authorizations/{authorization_id}/reauthorize'
)
->auth('Oauth2')
->parameters(
TemplateParam::init('authorization_id', $options)->extract('authorizationId'),
HeaderParam::init('Content-Type', 'application/json'),
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('Prefer', $options)->extract('prefer', 'return=minimal'),
BodyParam::init($options)->extract('body')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'The request failed because it is not well-formed or is syntactically incor' .
'rect or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'401',
ErrorType::init(
'Authentication failed due to missing authorization header, or invalid auth' .
'entication credentials.',
ErrorException::class
)
)
->throwErrorOn(
'403',
ErrorType::init(
'The request failed because the caller has insufficient permissions.',
ErrorException::class
)
)
->throwErrorOn(
'404',
ErrorType::init('The request failed because the resource does not exist.', ErrorException::class)
)
->throwErrorOn(
'422',
ErrorType::init(
'The request failed because it either is semantically incorrect or failed b' .
'usiness validation.',
ErrorException::class
)
)
->throwErrorOn('500', ErrorType::init('The request failed because an internal server error occurred.'))
->throwErrorOn('0', ErrorType::init('The error response.', ErrorException::class))
->type(PaymentAuthorization::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Shows details for a captured payment, by ID.
*
@@ -402,15 +386,18 @@ class PaymentsController extends BaseController
/**
* Shows details for a refund, by ID.
*
* @param string $refundId The PayPal-generated ID for the refund for which to show details.
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function refundsGet(string $refundId): ApiResponse
public function refundsGet(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::GET, '/v2/payments/refunds/{refund_id}')
->auth('Oauth2')
->parameters(TemplateParam::init('refund_id', $refundId));
->parameters(
TemplateParam::init('refund_id', $options)->extract('refundId'),
HeaderParam::init('PayPal-Auth-Assertion', $options)->extract('paypalAuthAssertion')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(

View File

@@ -24,6 +24,58 @@ use PaypalServerSdkLib\Models\SetupTokenResponse;
class VaultController extends BaseController
{
/**
* Creates a Payment Token from the given payment source and adds it to the Vault of the associated
* customer.
*
* @param array $options Array with all options for search
*
* @return ApiResponse Response from the API call
*/
public function paymentTokensCreate(array $options): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v3/vault/payment-tokens')
->auth('Oauth2')
->parameters(
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('Content-Type', 'application/json'),
BodyParam::init($options)->extract('body')
);
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'403',
ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class)
)
->throwErrorOn(
'404',
ErrorType::init(
'Request contains reference to resources that do not exist.',
ErrorException::class
)
)
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class))
->type(PaymentTokenResponse::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Returns all payment tokens for a customer.
*
@@ -96,22 +148,17 @@ class VaultController extends BaseController
}
/**
* Creates a Payment Token from the given payment source and adds it to the Vault of the associated
* customer.
* Delete the payment token associated with the payment token id.
*
* @param array $options Array with all options for search
* @param string $id ID of the payment token.
*
* @return ApiResponse Response from the API call
*/
public function paymentTokensCreate(array $options): ApiResponse
public function paymentTokensDelete(string $id): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::POST, '/v3/vault/payment-tokens')
$_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/v3/vault/payment-tokens/{id}')
->auth('Oauth2')
->parameters(
HeaderParam::init('PayPal-Request-Id', $options)->extract('paypalRequestId'),
HeaderParam::init('Content-Type', 'application/json'),
BodyParam::init($options)->extract('body')
);
->parameters(TemplateParam::init('id', $id));
$_resHandler = $this->responseHandler()
->throwErrorOn(
@@ -125,23 +172,7 @@ class VaultController extends BaseController
'403',
ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class)
)
->throwErrorOn(
'404',
ErrorType::init(
'Request contains reference to resources that do not exist.',
ErrorException::class
)
)
->throwErrorOn(
'422',
ErrorType::init(
'The requested action could not be performed, semantically incorrect, or fa' .
'iled business validation.',
ErrorException::class
)
)
->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class))
->type(PaymentTokenResponse::class)
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
@@ -192,37 +223,6 @@ class VaultController extends BaseController
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Delete the payment token associated with the payment token id.
*
* @param string $id ID of the payment token.
*
* @return ApiResponse Response from the API call
*/
public function paymentTokensDelete(string $id): ApiResponse
{
$_reqBuilder = $this->requestBuilder(RequestMethod::DELETE, '/v3/vault/payment-tokens/{id}')
->auth('Oauth2')
->parameters(TemplateParam::init('id', $id));
$_resHandler = $this->responseHandler()
->throwErrorOn(
'400',
ErrorType::init(
'Request is not well-formed, syntactically incorrect, or violates schema.',
ErrorException::class
)
)
->throwErrorOn(
'403',
ErrorType::init('Authorization failed due to insufficient permissions.', ErrorException::class)
)
->throwErrorOn('500', ErrorType::init('An internal server error has occurred.', ErrorException::class))
->returnApiResponse();
return $this->execute($_reqBuilder, $_resHandler);
}
/**
* Returns a readable representation of temporarily vaulted payment source associated with the setup
* token id.

View File

@@ -94,6 +94,15 @@ class CardVerificationDetailsBuilder
return $this;
}
/**
* Sets three d secure field.
*/
public function threeDSecure($value): self
{
$this->instance->setThreeDSecure($value);
return $this;
}
/**
* Initializes a new card verification details object.
*/

View File

@@ -43,7 +43,7 @@ class ConfirmOrderRequestBuilder
/**
* Sets processing instruction field.
*/
public function processingInstruction(?string $value): self
public function processingInstruction($value): self
{
$this->instance->setProcessingInstruction($value);
return $this;

View File

@@ -0,0 +1,112 @@
<?php
declare(strict_types=1);
/*
* PaypalServerSdkLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
namespace PaypalServerSdkLib\Models\Builders;
use Core\Utils\CoreHelper;
use PaypalServerSdkLib\Models\GooglePayCard;
use PaypalServerSdkLib\Models\PortablePostalAddressMediumGrained;
/**
* Builder for model GooglePayCard
*
* @see GooglePayCard
*/
class GooglePayCardBuilder
{
/**
* @var GooglePayCard
*/
private $instance;
private function __construct(GooglePayCard $instance)
{
$this->instance = $instance;
}
/**
* Initializes a new google pay card Builder object.
*/
public static function init(): self
{
return new self(new GooglePayCard());
}
/**
* Sets name field.
*/
public function name(?string $value): self
{
$this->instance->setName($value);
return $this;
}
/**
* Sets number field.
*/
public function number(?string $value): self
{
$this->instance->setNumber($value);
return $this;
}
/**
* Sets expiry field.
*/
public function expiry(?string $value): self
{
$this->instance->setExpiry($value);
return $this;
}
/**
* Sets last digits field.
*/
public function lastDigits(?string $value): self
{
$this->instance->setLastDigits($value);
return $this;
}
/**
* Sets type field.
*/
public function type(?string $value): self
{
$this->instance->setType($value);
return $this;
}
/**
* Sets brand field.
*/
public function brand(?string $value): self
{
$this->instance->setBrand($value);
return $this;
}
/**
* Sets billing address field.
*/
public function billingAddress(?PortablePostalAddressMediumGrained $value): self
{
$this->instance->setBillingAddress($value);
return $this;
}
/**
* Initializes a new google pay card object.
*/
public function build(): GooglePayCard
{
return CoreHelper::clone($this->instance);
}
}

View File

@@ -11,6 +11,7 @@ declare(strict_types=1);
namespace PaypalServerSdkLib\Models\Builders;
use Core\Utils\CoreHelper;
use PaypalServerSdkLib\Models\GooglePayCard;
use PaypalServerSdkLib\Models\GooglePayDecryptedTokenData;
/**
@@ -33,9 +34,9 @@ class GooglePayDecryptedTokenDataBuilder
/**
* Initializes a new google pay decrypted token data Builder object.
*/
public static function init(string $paymentMethod, string $authenticationMethod): self
public static function init(string $paymentMethod, GooglePayCard $card, string $authenticationMethod): self
{
return new self(new GooglePayDecryptedTokenData($paymentMethod, $authenticationMethod));
return new self(new GooglePayDecryptedTokenData($paymentMethod, $card, $authenticationMethod));
}
/**

View File

@@ -88,7 +88,7 @@ class OrderAuthorizeResponseBuilder
/**
* Sets processing instruction field.
*/
public function processingInstruction(?string $value): self
public function processingInstruction($value): self
{
$this->instance->setProcessingInstruction($value);
return $this;

View File

@@ -88,7 +88,7 @@ class OrderBuilder
/**
* Sets processing instruction field.
*/
public function processingInstruction(?string $value): self
public function processingInstruction($value): self
{
$this->instance->setProcessingInstruction($value);
return $this;

View File

@@ -0,0 +1,93 @@
<?php
declare(strict_types=1);
/*
* PaypalServerSdkLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
namespace PaypalServerSdkLib\Models\Builders;
use Core\Utils\CoreHelper;
use PaypalServerSdkLib\Models\PortablePostalAddressMediumGrained;
/**
* Builder for model PortablePostalAddressMediumGrained
*
* @see PortablePostalAddressMediumGrained
*/
class PortablePostalAddressMediumGrainedBuilder
{
/**
* @var PortablePostalAddressMediumGrained
*/
private $instance;
private function __construct(PortablePostalAddressMediumGrained $instance)
{
$this->instance = $instance;
}
/**
* Initializes a new portable postal address medium grained Builder object.
*/
public static function init(string $countryCode): self
{
return new self(new PortablePostalAddressMediumGrained($countryCode));
}
/**
* Sets address line 1 field.
*/
public function addressLine1(?string $value): self
{
$this->instance->setAddressLine1($value);
return $this;
}
/**
* Sets address line 2 field.
*/
public function addressLine2(?string $value): self
{
$this->instance->setAddressLine2($value);
return $this;
}
/**
* Sets admin area 2 field.
*/
public function adminArea2(?string $value): self
{
$this->instance->setAdminArea2($value);
return $this;
}
/**
* Sets admin area 1 field.
*/
public function adminArea1(?string $value): self
{
$this->instance->setAdminArea1($value);
return $this;
}
/**
* Sets postal code field.
*/
public function postalCode(?string $value): self
{
$this->instance->setPostalCode($value);
return $this;
}
/**
* Initializes a new portable postal address medium grained object.
*/
public function build(): PortablePostalAddressMediumGrained
{
return CoreHelper::clone($this->instance);
}
}

View File

@@ -47,6 +47,11 @@ class CardVerificationDetails implements \JsonSerializable
*/
private $processorResponse;
/**
* @var mixed
*/
private $threeDSecure;
/**
* Returns Network Transaction Id.
* Transaction Identifier as given by the network to indicate a previously executed CIT authorization.
@@ -175,6 +180,32 @@ class CardVerificationDetails implements \JsonSerializable
$this->processorResponse = $processorResponse;
}
/**
* Returns Three D Secure.
* DEPRECATED. This field is DEPRECATED. Please find the 3D secure authentication data in
* 'three_d_secure' object under 'authentication_result' object instead of the 'verification' field.
*
* @return mixed
*/
public function getThreeDSecure()
{
return $this->threeDSecure;
}
/**
* Sets Three D Secure.
* DEPRECATED. This field is DEPRECATED. Please find the 3D secure authentication data in
* 'three_d_secure' object under 'authentication_result' object instead of the 'verification' field.
*
* @maps three_d_secure
*
* @param mixed $threeDSecure
*/
public function setThreeDSecure($threeDSecure): void
{
$this->threeDSecure = $threeDSecure;
}
/**
* Encode this object to JSON
*
@@ -205,6 +236,9 @@ class CardVerificationDetails implements \JsonSerializable
if (isset($this->processorResponse)) {
$json['processor_response'] = $this->processorResponse;
}
if (isset($this->threeDSecure)) {
$json['three_d_secure'] = $this->threeDSecure;
}
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
}

View File

@@ -23,9 +23,9 @@ class ConfirmOrderRequest implements \JsonSerializable
private $paymentSource;
/**
* @var string|null
* @var mixed
*/
private $processingInstruction = ProcessingInstruction::NO_INSTRUCTION;
private $processingInstruction;
/**
* @var OrderConfirmApplicationContext|null
@@ -63,20 +63,22 @@ class ConfirmOrderRequest implements \JsonSerializable
/**
* Returns Processing Instruction.
* The instruction to process an order.
*
* @return mixed
*/
public function getProcessingInstruction(): ?string
public function getProcessingInstruction()
{
return $this->processingInstruction;
}
/**
* Sets Processing Instruction.
* The instruction to process an order.
*
* @maps processing_instruction
*
* @param mixed $processingInstruction
*/
public function setProcessingInstruction(?string $processingInstruction): void
public function setProcessingInstruction($processingInstruction): void
{
$this->processingInstruction = $processingInstruction;
}
@@ -115,7 +117,7 @@ class ConfirmOrderRequest implements \JsonSerializable
$json = [];
$json['payment_source'] = $this->paymentSource;
if (isset($this->processingInstruction)) {
$json['processing_instruction'] = ProcessingInstruction::checkValue($this->processingInstruction);
$json['processing_instruction'] = $this->processingInstruction;
}
if (isset($this->applicationContext)) {
$json['application_context'] = $this->applicationContext;

View File

@@ -18,7 +18,7 @@ use stdClass;
* A classification for the method of purchase fulfillment (e.g shipping, in-store pickup, etc). Either
* `type` or `options` may be present, but not both.
*/
class FullfillmentType
class FulfillmentType
{
public const SHIPPING = 'SHIPPING';
@@ -46,6 +46,6 @@ class FullfillmentType
if (CoreHelper::checkValueOrValuesInList($value, self::_ALL_VALUES)) {
return $value;
}
throw new Exception("$value is invalid for FullfillmentType.");
throw new Exception("$value is invalid for FulfillmentType.");
}
}

View File

@@ -0,0 +1,239 @@
<?php
declare(strict_types=1);
/*
* PaypalServerSdkLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
namespace PaypalServerSdkLib\Models;
use stdClass;
/**
* The payment card used to fund a Google Pay payment. Can be a credit or debit card.
*/
class GooglePayCard implements \JsonSerializable
{
/**
* @var string|null
*/
private $name;
/**
* @var string|null
*/
private $number;
/**
* @var string|null
*/
private $expiry;
/**
* @var string|null
*/
private $lastDigits;
/**
* @var string|null
*/
private $type;
/**
* @var string|null
*/
private $brand;
/**
* @var PortablePostalAddressMediumGrained|null
*/
private $billingAddress;
/**
* Returns Name.
* The card holder's name as it appears on the card.
*/
public function getName(): ?string
{
return $this->name;
}
/**
* Sets Name.
* The card holder's name as it appears on the card.
*
* @maps name
*/
public function setName(?string $name): void
{
$this->name = $name;
}
/**
* Returns Number.
* The primary account number (PAN) for the payment card.
*/
public function getNumber(): ?string
{
return $this->number;
}
/**
* Sets Number.
* The primary account number (PAN) for the payment card.
*
* @maps number
*/
public function setNumber(?string $number): void
{
$this->number = $number;
}
/**
* Returns Expiry.
* The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https:
* //tools.ietf.org/html/rfc3339#section-5.6).
*/
public function getExpiry(): ?string
{
return $this->expiry;
}
/**
* Sets Expiry.
* The year and month, in ISO-8601 `YYYY-MM` date format. See [Internet date and time format](https:
* //tools.ietf.org/html/rfc3339#section-5.6).
*
* @maps expiry
*/
public function setExpiry(?string $expiry): void
{
$this->expiry = $expiry;
}
/**
* Returns Last Digits.
* The last digits of the payment card.
*/
public function getLastDigits(): ?string
{
return $this->lastDigits;
}
/**
* Sets Last Digits.
* The last digits of the payment card.
*
* @maps last_digits
*/
public function setLastDigits(?string $lastDigits): void
{
$this->lastDigits = $lastDigits;
}
/**
* Returns Type.
* Type of card. i.e Credit, Debit and so on.
*/
public function getType(): ?string
{
return $this->type;
}
/**
* Sets Type.
* Type of card. i.e Credit, Debit and so on.
*
* @maps type
*/
public function setType(?string $type): void
{
$this->type = $type;
}
/**
* Returns Brand.
* The card network or brand. Applies to credit, debit, gift, and payment cards.
*/
public function getBrand(): ?string
{
return $this->brand;
}
/**
* Sets Brand.
* The card network or brand. Applies to credit, debit, gift, and payment cards.
*
* @maps brand
*/
public function setBrand(?string $brand): void
{
$this->brand = $brand;
}
/**
* Returns Billing Address.
* The portable international postal address. Maps to [AddressValidationMetadata](https://github.
* com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form
* controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-
* controls-the-autocomplete-attribute).
*/
public function getBillingAddress(): ?PortablePostalAddressMediumGrained
{
return $this->billingAddress;
}
/**
* Sets Billing Address.
* The portable international postal address. Maps to [AddressValidationMetadata](https://github.
* com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form
* controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-
* controls-the-autocomplete-attribute).
*
* @maps billing_address
*/
public function setBillingAddress(?PortablePostalAddressMediumGrained $billingAddress): void
{
$this->billingAddress = $billingAddress;
}
/**
* Encode this object to JSON
*
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
* are set. (default: false)
*
* @return array|stdClass
*/
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
public function jsonSerialize(bool $asArrayWhenEmpty = false)
{
$json = [];
if (isset($this->name)) {
$json['name'] = $this->name;
}
if (isset($this->number)) {
$json['number'] = $this->number;
}
if (isset($this->expiry)) {
$json['expiry'] = $this->expiry;
}
if (isset($this->lastDigits)) {
$json['last_digits'] = $this->lastDigits;
}
if (isset($this->type)) {
$json['type'] = CardType::checkValue($this->type);
}
if (isset($this->brand)) {
$json['brand'] = CardBrand::checkValue($this->brand);
}
if (isset($this->billingAddress)) {
$json['billing_address'] = $this->billingAddress;
}
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
}
}

View File

@@ -33,6 +33,11 @@ class GooglePayDecryptedTokenData implements \JsonSerializable
*/
private $paymentMethod;
/**
* @var GooglePayCard
*/
private $card;
/**
* @var string
*/
@@ -50,11 +55,13 @@ class GooglePayDecryptedTokenData implements \JsonSerializable
/**
* @param string $paymentMethod
* @param GooglePayCard $card
* @param string $authenticationMethod
*/
public function __construct(string $paymentMethod, string $authenticationMethod)
public function __construct(string $paymentMethod, GooglePayCard $card, string $authenticationMethod)
{
$this->paymentMethod = $paymentMethod;
$this->card = $card;
$this->authenticationMethod = $authenticationMethod;
}
@@ -121,6 +128,27 @@ class GooglePayDecryptedTokenData implements \JsonSerializable
$this->paymentMethod = $paymentMethod;
}
/**
* Returns Card.
* The payment card used to fund a Google Pay payment. Can be a credit or debit card.
*/
public function getCard(): GooglePayCard
{
return $this->card;
}
/**
* Sets Card.
* The payment card used to fund a Google Pay payment. Can be a credit or debit card.
*
* @required
* @maps card
*/
public function setCard(GooglePayCard $card): void
{
$this->card = $card;
}
/**
* Returns Authentication Method.
* Authentication Method which is used for the card transaction.
@@ -205,6 +233,7 @@ class GooglePayDecryptedTokenData implements \JsonSerializable
$json['message_expiration'] = $this->messageExpiration;
}
$json['payment_method'] = GooglePayPaymentMethod::checkValue($this->paymentMethod);
$json['card'] = $this->card;
$json['authentication_method'] = GooglePayAuthenticationMethod::checkValue($this->authenticationMethod);
if (isset($this->cryptogram)) {
$json['cryptogram'] = $this->cryptogram;

View File

@@ -43,9 +43,9 @@ class Order implements \JsonSerializable
private $intent;
/**
* @var string|null
* @var mixed
*/
private $processingInstruction = ProcessingInstruction::NO_INSTRUCTION;
private $processingInstruction;
/**
* @var Payer|null
@@ -179,20 +179,22 @@ class Order implements \JsonSerializable
/**
* Returns Processing Instruction.
* The instruction to process an order.
*
* @return mixed
*/
public function getProcessingInstruction(): ?string
public function getProcessingInstruction()
{
return $this->processingInstruction;
}
/**
* Sets Processing Instruction.
* The instruction to process an order.
*
* @maps processing_instruction
*
* @param mixed $processingInstruction
*/
public function setProcessingInstruction(?string $processingInstruction): void
public function setProcessingInstruction($processingInstruction): void
{
$this->processingInstruction = $processingInstruction;
}
@@ -266,9 +268,9 @@ class Order implements \JsonSerializable
/**
* Returns Links.
* An array of request-related HATEOAS links. To complete payer approval, use the `approve` link to
* redirect the payer. The API caller has 3 hours (default setting, this which can be changed by your
* redirect the payer. The API caller has 6 hours (default setting, this which can be changed by your
* account manager to 24/48/72 hours to accommodate your use case) from the time the order is created,
* to redirect your payer. Once redirected, the API caller has 3 hours for the payer to approve the
* to redirect your payer. Once redirected, the API caller has 6 hours for the payer to approve the
* order and either authorize or capture the order. If you are not using the PayPal JavaScript SDK to
* initiate PayPal Checkout (in context) ensure that you include `application_context.return_url` is
* specified or you will get "We're sorry, Things don't appear to be working at the moment" after the
@@ -284,9 +286,9 @@ class Order implements \JsonSerializable
/**
* Sets Links.
* An array of request-related HATEOAS links. To complete payer approval, use the `approve` link to
* redirect the payer. The API caller has 3 hours (default setting, this which can be changed by your
* redirect the payer. The API caller has 6 hours (default setting, this which can be changed by your
* account manager to 24/48/72 hours to accommodate your use case) from the time the order is created,
* to redirect your payer. Once redirected, the API caller has 3 hours for the payer to approve the
* to redirect your payer. Once redirected, the API caller has 6 hours for the payer to approve the
* order and either authorize or capture the order. If you are not using the PayPal JavaScript SDK to
* initiate PayPal Checkout (in context) ensure that you include `application_context.return_url` is
* specified or you will get "We're sorry, Things don't appear to be working at the moment" after the
@@ -329,7 +331,7 @@ class Order implements \JsonSerializable
$json['intent'] = CheckoutPaymentIntent::checkValue($this->intent);
}
if (isset($this->processingInstruction)) {
$json['processing_instruction'] = ProcessingInstruction::checkValue($this->processingInstruction);
$json['processing_instruction'] = $this->processingInstruction;
}
if (isset($this->payer)) {
$json['payer'] = $this->payer;

View File

@@ -40,9 +40,9 @@ class OrderAuthorizeResponse implements \JsonSerializable
private $intent;
/**
* @var string|null
* @var mixed
*/
private $processingInstruction = ProcessingInstruction::NO_INSTRUCTION;
private $processingInstruction;
/**
* @var Payer|null
@@ -176,20 +176,22 @@ class OrderAuthorizeResponse implements \JsonSerializable
/**
* Returns Processing Instruction.
* The instruction to process an order.
*
* @return mixed
*/
public function getProcessingInstruction(): ?string
public function getProcessingInstruction()
{
return $this->processingInstruction;
}
/**
* Sets Processing Instruction.
* The instruction to process an order.
*
* @maps processing_instruction
*
* @param mixed $processingInstruction
*/
public function setProcessingInstruction(?string $processingInstruction): void
public function setProcessingInstruction($processingInstruction): void
{
$this->processingInstruction = $processingInstruction;
}
@@ -314,7 +316,7 @@ class OrderAuthorizeResponse implements \JsonSerializable
$json['intent'] = CheckoutPaymentIntent::checkValue($this->intent);
}
if (isset($this->processingInstruction)) {
$json['processing_instruction'] = ProcessingInstruction::checkValue($this->processingInstruction);
$json['processing_instruction'] = $this->processingInstruction;
}
if (isset($this->payer)) {
$json['payer'] = $this->payer;

View File

@@ -0,0 +1,231 @@
<?php
declare(strict_types=1);
/*
* PaypalServerSdkLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
namespace PaypalServerSdkLib\Models;
use stdClass;
/**
* The portable international postal address. Maps to [AddressValidationMetadata](https://github.
* com/googlei18n/libaddressinput/wiki/AddressValidationMetadata) and HTML 5.1 [Autofilling form
* controls: the autocomplete attribute](https://www.w3.org/TR/html51/sec-forms.html#autofilling-form-
* controls-the-autocomplete-attribute).
*/
class PortablePostalAddressMediumGrained implements \JsonSerializable
{
/**
* @var string|null
*/
private $addressLine1;
/**
* @var string|null
*/
private $addressLine2;
/**
* @var string|null
*/
private $adminArea2;
/**
* @var string|null
*/
private $adminArea1;
/**
* @var string|null
*/
private $postalCode;
/**
* @var string
*/
private $countryCode;
/**
* @param string $countryCode
*/
public function __construct(string $countryCode)
{
$this->countryCode = $countryCode;
}
/**
* Returns Address Line 1.
* The first line of the address, such as number and street, for example, `173 Drury Lane`. Needed for
* data entry, and Compliance and Risk checks. This field needs to pass the full address.
*/
public function getAddressLine1(): ?string
{
return $this->addressLine1;
}
/**
* Sets Address Line 1.
* The first line of the address, such as number and street, for example, `173 Drury Lane`. Needed for
* data entry, and Compliance and Risk checks. This field needs to pass the full address.
*
* @maps address_line_1
*/
public function setAddressLine1(?string $addressLine1): void
{
$this->addressLine1 = $addressLine1;
}
/**
* Returns Address Line 2.
* The second line of the address, for example, a suite or apartment number.
*/
public function getAddressLine2(): ?string
{
return $this->addressLine2;
}
/**
* Sets Address Line 2.
* The second line of the address, for example, a suite or apartment number.
*
* @maps address_line_2
*/
public function setAddressLine2(?string $addressLine2): void
{
$this->addressLine2 = $addressLine2;
}
/**
* Returns Admin Area 2.
* A city, town, or village. Smaller than `admin_area_level_1`.
*/
public function getAdminArea2(): ?string
{
return $this->adminArea2;
}
/**
* Sets Admin Area 2.
* A city, town, or village. Smaller than `admin_area_level_1`.
*
* @maps admin_area_2
*/
public function setAdminArea2(?string $adminArea2): void
{
$this->adminArea2 = $adminArea2;
}
/**
* Returns Admin Area 1.
* The highest-level sub-division in a country, which is usually a province, state, or ISO-3166-2
* subdivision. This data is formatted for postal delivery, for example, `CA` and not `California`.
* Value, by country, is:<ul><li>UK. A county.</li><li>US. A state.</li><li>Canada. A province.
* </li><li>Japan. A prefecture.</li><li>Switzerland. A *kanton*.</li></ul>
*/
public function getAdminArea1(): ?string
{
return $this->adminArea1;
}
/**
* Sets Admin Area 1.
* The highest-level sub-division in a country, which is usually a province, state, or ISO-3166-2
* subdivision. This data is formatted for postal delivery, for example, `CA` and not `California`.
* Value, by country, is:<ul><li>UK. A county.</li><li>US. A state.</li><li>Canada. A province.
* </li><li>Japan. A prefecture.</li><li>Switzerland. A *kanton*.</li></ul>
*
* @maps admin_area_1
*/
public function setAdminArea1(?string $adminArea1): void
{
$this->adminArea1 = $adminArea1;
}
/**
* Returns Postal Code.
* The postal code, which is the ZIP code or equivalent. Typically required for countries with a postal
* code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code).
*/
public function getPostalCode(): ?string
{
return $this->postalCode;
}
/**
* Sets Postal Code.
* The postal code, which is the ZIP code or equivalent. Typically required for countries with a postal
* code or an equivalent. See [postal code](https://en.wikipedia.org/wiki/Postal_code).
*
* @maps postal_code
*/
public function setPostalCode(?string $postalCode): void
{
$this->postalCode = $postalCode;
}
/**
* Returns Country Code.
* The [2-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or
* region.<blockquote><strong>Note:</strong> The country code for Great Britain is <code>GB</code> and
* not <code>UK</code> as used in the top-level domain names for that country. Use the `C2` country
* code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border
* transactions.</blockquote>
*/
public function getCountryCode(): string
{
return $this->countryCode;
}
/**
* Sets Country Code.
* The [2-character ISO 3166-1 code](/api/rest/reference/country-codes/) that identifies the country or
* region.<blockquote><strong>Note:</strong> The country code for Great Britain is <code>GB</code> and
* not <code>UK</code> as used in the top-level domain names for that country. Use the `C2` country
* code for China worldwide for comparable uncontrolled price (CUP) method, bank card, and cross-border
* transactions.</blockquote>
*
* @required
* @maps country_code
*/
public function setCountryCode(string $countryCode): void
{
$this->countryCode = $countryCode;
}
/**
* Encode this object to JSON
*
* @param bool $asArrayWhenEmpty Whether to serialize this model as an array whenever no fields
* are set. (default: false)
*
* @return array|stdClass
*/
#[\ReturnTypeWillChange] // @phan-suppress-current-line PhanUndeclaredClassAttribute for (php < 8.1)
public function jsonSerialize(bool $asArrayWhenEmpty = false)
{
$json = [];
if (isset($this->addressLine1)) {
$json['address_line_1'] = $this->addressLine1;
}
if (isset($this->addressLine2)) {
$json['address_line_2'] = $this->addressLine2;
}
if (isset($this->adminArea2)) {
$json['admin_area_2'] = $this->adminArea2;
}
if (isset($this->adminArea1)) {
$json['admin_area_1'] = $this->adminArea1;
}
if (isset($this->postalCode)) {
$json['postal_code'] = $this->postalCode;
}
$json['country_code'] = $this->countryCode;
return (!$asArrayWhenEmpty && empty($json)) ? new stdClass() : $json;
}
}

View File

@@ -1,45 +0,0 @@
<?php
declare(strict_types=1);
/*
* PaypalServerSdkLib
*
* This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ).
*/
namespace PaypalServerSdkLib\Models;
use Core\Utils\CoreHelper;
use Exception;
use stdClass;
/**
* The instruction to process an order.
*/
class ProcessingInstruction
{
public const ORDER_COMPLETE_ON_PAYMENT_APPROVAL = 'ORDER_COMPLETE_ON_PAYMENT_APPROVAL';
public const NO_INSTRUCTION = 'NO_INSTRUCTION';
private const _ALL_VALUES = [self::ORDER_COMPLETE_ON_PAYMENT_APPROVAL, self::NO_INSTRUCTION];
/**
* Ensures that all the given values are present in this Enum.
*
* @param array|stdClass|null|string $value Value or a list/map of values to be checked
*
* @return array|null|string Input value(s), if all are a part of this Enum
*
* @throws Exception Throws exception if any given value is not in this Enum
*/
public static function checkValue($value)
{
$value = json_decode(json_encode($value), true); // converts stdClass into array
if (CoreHelper::checkValueOrValuesInList($value, self::_ALL_VALUES)) {
return $value;
}
throw new Exception("$value is invalid for ProcessingInstruction.");
}
}

View File

@@ -2576,6 +2576,222 @@ class ShipmentCarrier
public const SPEEDY = 'SPEEDY';
public const ZOOM_RED = 'ZOOM_RED';
public const NAVLUNGO = 'NAVLUNGO';
public const CASTLEPARCELS = 'CASTLEPARCELS';
public const WEEE = 'WEEE';
public const PACKALY = 'PACKALY';
public const YUNHUIPOST = 'YUNHUIPOST';
public const YOUPARCEL = 'YOUPARCEL';
public const LEMAN = 'LEMAN';
public const MOOVIN = 'MOOVIN';
public const URB_IT = 'URB_IT';
public const MULTIENTREGAPANAMA = 'MULTIENTREGAPANAMA';
public const JUSDASR = 'JUSDASR';
public const DISCOUNTPOST = 'DISCOUNTPOST';
public const RHENUS_UK = 'RHENUS_UK';
public const SWISHIP_JP = 'SWISHIP_JP';
public const GLS_US = 'GLS_US';
public const SMTL = 'SMTL';
public const EMEGA = 'EMEGA';
public const EXPRESSONE_SV = 'EXPRESSONE_SV';
public const HEPSIJET = 'HEPSIJET';
public const WELIVERY = 'WELIVERY';
public const BRINGER = 'BRINGER';
public const EASYROUTES = 'EASYROUTES';
public const MRW = 'MRW';
public const RPM = 'RPM';
public const DPD_PRT = 'DPD_PRT';
public const GLS_ROMANIA = 'GLS_ROMANIA';
public const LMPARCEL = 'LMPARCEL';
public const GTAGSM = 'GTAGSM';
public const DOMINO = 'DOMINO';
public const ESHIPPER = 'ESHIPPER';
public const TRANSPAK = 'TRANSPAK';
public const XINDUS = 'XINDUS';
public const AOYUE = 'AOYUE';
public const EASYPARCEL = 'EASYPARCEL';
public const EXPRESSONE = 'EXPRESSONE';
public const SENDEO_KARGO = 'SENDEO_KARGO';
public const SPEEDAF = 'SPEEDAF';
public const ETOWER = 'ETOWER';
public const GCX = 'GCX';
public const NINJAVAN_VN = 'NINJAVAN_VN';
public const ALLEGRO = 'ALLEGRO';
public const JUMPPOINT = 'JUMPPOINT';
public const SHIPGLOBAL_US = 'SHIPGLOBAL_US';
public const KINISI = 'KINISI';
public const OAKH = 'OAKH';
public const AWEST = 'AWEST';
public const BARSAN = 'BARSAN';
public const ENERGOLOGISTIC = 'ENERGOLOGISTIC';
public const MADROOEX = 'MADROOEX';
public const GOBOLT = 'GOBOLT';
public const SWISS_UNIVERSAL_EXPRESS = 'SWISS_UNIVERSAL_EXPRESS';
public const IORDIRECT = 'IORDIRECT';
public const XMSZM = 'XMSZM';
public const GLS_HUN = 'GLS_HUN';
public const SENDY = 'SENDY';
public const BRAUNSEXPRESS = 'BRAUNSEXPRESS';
public const GRANDSLAMEXPRESS = 'GRANDSLAMEXPRESS';
public const XGS = 'XGS';
public const OTSCHILE = 'OTSCHILE';
public const PACK_UP = 'PACK_UP';
public const PARCELSTARS = 'PARCELSTARS';
public const TEAMEXPRESSLLC = 'TEAMEXPRESSLLC';
public const ASYADEXPRESS = 'ASYADEXPRESS';
public const TDN = 'TDN';
public const EARLYBIRD = 'EARLYBIRD';
public const CACESA = 'CACESA';
public const PARCELJET = 'PARCELJET';
public const MNG_KARGO = 'MNG_KARGO';
public const SUPERPACKLINE = 'SUPERPACKLINE';
public const SPEEDX = 'SPEEDX';
public const VESYL = 'VESYL';
public const SKYKING = 'SKYKING';
public const DIRMENSAJERIA = 'DIRMENSAJERIA';
public const NETLOGIXGROUP = 'NETLOGIXGROUP';
public const ZYOU = 'ZYOU';
public const JAWAR = 'JAWAR';
public const AGSYSTEMS = 'AGSYSTEMS';
public const GPS = 'GPS';
public const PTT_KARGO = 'PTT_KARGO';
public const MAERGO = 'MAERGO';
public const ARIHANTCOURIER = 'ARIHANTCOURIER';
public const VTFE = 'VTFE';
public const YUNANT = 'YUNANT';
public const URBIFY = 'URBIFY';
public const PACK_MAN = 'PACK_MAN';
public const LIEFERGRUN = 'LIEFERGRUN';
public const OBIBOX = 'OBIBOX';
public const PAIKEDA = 'PAIKEDA';
public const SCOTTY = 'SCOTTY';
public const INTELCOM_CA = 'INTELCOM_CA';
public const SWE = 'SWE';
public const ASENDIA = 'ASENDIA';
public const DPD_AT = 'DPD_AT';
public const RELAY = 'RELAY';
public const ATA = 'ATA';
public const SKYEXPRESS_INTERNATIONAL = 'SKYEXPRESS_INTERNATIONAL';
public const SURAT_KARGO = 'SURAT_KARGO';
public const SGLINK = 'SGLINK';
public const FLEETOPTICSINC = 'FLEETOPTICSINC';
public const SHOPLINE = 'SHOPLINE';
public const PIGGYSHIP = 'PIGGYSHIP';
public const LOGOIX = 'LOGOIX';
public const KOLAY_GELSIN = 'KOLAY_GELSIN';
public const ASSOCIATED_COURIERS = 'ASSOCIATED_COURIERS';
public const UPS_CHECKER = 'UPS_CHECKER';
public const WINESHIPPING = 'WINESHIPPING';
public const SPEDISCI = 'SPEDISCI';
private const _ALL_VALUES = [
self::DPD_RU,
self::BG_BULGARIAN_POST,
@@ -3852,7 +4068,115 @@ class ShipmentCarrier
self::MOBI_BR,
self::LOGINEXT_WEBHOOK,
self::EMS,
self::SPEEDY
self::SPEEDY,
self::ZOOM_RED,
self::NAVLUNGO,
self::CASTLEPARCELS,
self::WEEE,
self::PACKALY,
self::YUNHUIPOST,
self::YOUPARCEL,
self::LEMAN,
self::MOOVIN,
self::URB_IT,
self::MULTIENTREGAPANAMA,
self::JUSDASR,
self::DISCOUNTPOST,
self::RHENUS_UK,
self::SWISHIP_JP,
self::GLS_US,
self::SMTL,
self::EMEGA,
self::EXPRESSONE_SV,
self::HEPSIJET,
self::WELIVERY,
self::BRINGER,
self::EASYROUTES,
self::MRW,
self::RPM,
self::DPD_PRT,
self::GLS_ROMANIA,
self::LMPARCEL,
self::GTAGSM,
self::DOMINO,
self::ESHIPPER,
self::TRANSPAK,
self::XINDUS,
self::AOYUE,
self::EASYPARCEL,
self::EXPRESSONE,
self::SENDEO_KARGO,
self::SPEEDAF,
self::ETOWER,
self::GCX,
self::NINJAVAN_VN,
self::ALLEGRO,
self::JUMPPOINT,
self::SHIPGLOBAL_US,
self::KINISI,
self::OAKH,
self::AWEST,
self::BARSAN,
self::ENERGOLOGISTIC,
self::MADROOEX,
self::GOBOLT,
self::SWISS_UNIVERSAL_EXPRESS,
self::IORDIRECT,
self::XMSZM,
self::GLS_HUN,
self::SENDY,
self::BRAUNSEXPRESS,
self::GRANDSLAMEXPRESS,
self::XGS,
self::OTSCHILE,
self::PACK_UP,
self::PARCELSTARS,
self::TEAMEXPRESSLLC,
self::ASYADEXPRESS,
self::TDN,
self::EARLYBIRD,
self::CACESA,
self::PARCELJET,
self::MNG_KARGO,
self::SUPERPACKLINE,
self::SPEEDX,
self::VESYL,
self::SKYKING,
self::DIRMENSAJERIA,
self::NETLOGIXGROUP,
self::ZYOU,
self::JAWAR,
self::AGSYSTEMS,
self::GPS,
self::PTT_KARGO,
self::MAERGO,
self::ARIHANTCOURIER,
self::VTFE,
self::YUNANT,
self::URBIFY,
self::PACK_MAN,
self::LIEFERGRUN,
self::OBIBOX,
self::PAIKEDA,
self::SCOTTY,
self::INTELCOM_CA,
self::SWE,
self::ASENDIA,
self::DPD_AT,
self::RELAY,
self::ATA,
self::SKYEXPRESS_INTERNATIONAL,
self::SURAT_KARGO,
self::SGLINK,
self::FLEETOPTICSINC,
self::SHOPLINE,
self::PIGGYSHIP,
self::LOGOIX,
self::KOLAY_GELSIN,
self::ASSOCIATED_COURIERS,
self::UPS_CHECKER,
self::WINESHIPPING,
self::SPEDISCI
];
/**

View File

@@ -177,7 +177,7 @@ class ShippingDetails implements \JsonSerializable
$json['phone_number'] = $this->phoneNumber;
}
if (isset($this->type)) {
$json['type'] = FullfillmentType::checkValue($this->type);
$json['type'] = FulfillmentType::checkValue($this->type);
}
if (isset($this->options)) {
$json['options'] = $this->options;

View File

@@ -206,7 +206,7 @@ class ShippingWithTrackingDetails implements \JsonSerializable
$json['phone_number'] = $this->phoneNumber;
}
if (isset($this->type)) {
$json['type'] = FullfillmentType::checkValue($this->type);
$json['type'] = FulfillmentType::checkValue($this->type);
}
if (isset($this->options)) {
$json['options'] = $this->options;

View File

@@ -116,7 +116,7 @@ class VaultedDigitalWalletShippingDetails implements \JsonSerializable
$json['name'] = $this->name;
}
if (isset($this->type)) {
$json['type'] = FullfillmentType::checkValue($this->type);
$json['type'] = FulfillmentType::checkValue($this->type);
}
if (isset($this->address)) {
$json['address'] = $this->address;

View File

@@ -62,7 +62,7 @@ class PaypalServerSdkClient implements ConfigurationInterface
->converter(new CompatibilityConverter())
->jsonHelper(ApiHelper::getJsonHelper())
->apiCallback($this->config['httpCallback'] ?? null)
->userAgent('PayPal REST API PHP SDK, Version: 0.6.0, on OS {os-info}')
->userAgent('PayPal REST API PHP SDK, Version: 0.6.1, on OS {os-info}')
->serverUrls(self::ENVIRONMENT_MAP[$this->getEnvironment()], Server::DEFAULT_)
->authManagers(['Oauth2' => $this->clientCredentialsAuthManager])
->loggingConfiguration($loggingConfiguration)