diff --git a/README.md b/README.md index ee2bbf3..4b71a53 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ The package's installation is done using composer. Simply add these lines to you ```json { "require": { - "processout/processout-php": "^8.0.1" + "processout/processout-php": "^9.0.0" } } ``` diff --git a/init.php b/init.php index e8195ef..0f5a27f 100644 --- a/init.php +++ b/init.php @@ -46,6 +46,8 @@ include_once(dirname(__FILE__) . "/src/InvoiceShippingPhone.php"); include_once(dirname(__FILE__) . "/src/InvoiceBilling.php"); include_once(dirname(__FILE__) . "/src/UnsupportedFeatureBypass.php"); +include_once(dirname(__FILE__) . "/src/PaymentProcessingConfiguration.php"); +include_once(dirname(__FILE__) . "/src/APMPaymentProcessingConfiguration.php"); include_once(dirname(__FILE__) . "/src/InvoiceDetail.php"); include_once(dirname(__FILE__) . "/src/InvoiceSubmerchant.php"); include_once(dirname(__FILE__) . "/src/SubmerchantPhoneNumber.php"); @@ -60,6 +62,8 @@ include_once(dirname(__FILE__) . "/src/ProjectSFTPSettings.php"); include_once(dirname(__FILE__) . "/src/ProjectSFTPSettingsPublic.php"); include_once(dirname(__FILE__) . "/src/Refund.php"); +include_once(dirname(__FILE__) . "/src/Submerchant.php"); +include_once(dirname(__FILE__) . "/src/SubmerchantMapping.php"); include_once(dirname(__FILE__) . "/src/Transaction.php"); include_once(dirname(__FILE__) . "/src/NativeAPMResponse.php"); include_once(dirname(__FILE__) . "/src/NativeAPMParameterDefinition.php"); @@ -73,6 +77,7 @@ include_once(dirname(__FILE__) . "/src/WebhookEndpoint.php"); include_once(dirname(__FILE__) . "/src/CardUpdateRequest.php"); include_once(dirname(__FILE__) . "/src/CardCreateRequest.php"); +include_once(dirname(__FILE__) . "/src/CardSchemeDetails.php"); include_once(dirname(__FILE__) . "/src/Device.php"); include_once(dirname(__FILE__) . "/src/CardContact.php"); include_once(dirname(__FILE__) . "/src/CardShipping.php"); diff --git a/spec.php b/spec.php index 469b75a..e12b86a 100644 --- a/spec.php +++ b/spec.php @@ -2,7 +2,7 @@ include 'init.php'; -$client = new \ProcessOut\ProcessOut('test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x', +$client = new \ProcessOut\ProcessOut('test-proj_gAO1Uu0ysZJvDuUpOGPkUBeE3pGalk3x', 'key_sandbox_mah31RDFqcDxmaS7MvhDbJfDJvjtsFTB'); // Create and fetch a new invoice @@ -24,21 +24,24 @@ assert($invoice->getId() == $fetched->getId(), 'The invoices ID should be equal'); // Capture an invoice -$gr = new \ProcessOut\GatewayRequest('sandbox'); -$gr->url = 'https://processout.com?token=test-valid'; -$gr->method = 'POST'; -$gr->headers = array('Content-Type' => 'application/json'); -$gr->body = '{}'; -$gr->gatewayConfigurationID = 'gway_conf_44ae90db0a62f819a404ef6a8ff994ca'; +// Skipped: sandbox gateway does not support capturing invoices with gateway requests +if (false) { + $gr = new \ProcessOut\GatewayRequest('sandbox'); + $gr->url = 'https://processout.com?token=test-valid'; + $gr->method = 'POST'; + $gr->headers = array('Content-Type' => 'application/json'); + $gr->body = '{}'; + $gr->gatewayConfigurationID = 'gway_conf_44ae90db0a62f819a404ef6a8ff994ca'; -$transaction = $invoice->capture($gr->getString()); -assert($transaction->getStatus() == 'completed', 'The transactions status was not completed'); + $transaction = $invoice->capture($gr->getString()); + assert($transaction->getStatus() == 'completed', 'The transactions status was not completed'); -// Expand the transaction gateway configuration -$transaction = $transaction->find($transaction->getId(), array( - 'expand' => array('gateway_configuration') -)); -assert(!empty($transaction->getGatewayConfiguration()->getId()), 'The transaction gateway configuration ID was empty'); + // Expand the transaction gateway configuration + $transaction = $transaction->find($transaction->getId(), array( + 'expand' => array('gateway_configuration') + )); + assert(!empty($transaction->getGatewayConfiguration()->getId()), 'The transaction gateway configuration ID was empty'); +} // Fetch the customers $customers = $client->newCustomer()->all(); @@ -47,15 +50,6 @@ $customer = $client->newCustomer()->create(); assert(!empty($customer->getId()), 'The created customer ID should not be empty'); -$subscription = $client->newSubscription(array( - 'customer_id' => $customer->getId(), - 'amount' => '9.99', - 'currency' => 'USD', - 'interval' => '1d', - 'name' => 'great subscription' -))->create(); -assert(!empty($subscription->getId()), 'The created subscription ID should not be empty'); - // Expand a customers' project and fetch gateways $customer = $client->newCustomer()->create(array('expand' => array('project'))); assert(!empty($customer->getProject()), 'The customer project should be expanded'); @@ -67,4 +61,4 @@ assert(false, 'There should have been an error'); } catch(\ProcessOut\Exceptions\NotFoundException $e) { assert($e->getCode() == 'resource.customer.not-found', 'The error code was incorrect'); -} \ No newline at end of file +} diff --git a/src/APMPaymentProcessingConfiguration.php b/src/APMPaymentProcessingConfiguration.php new file mode 100755 index 0000000..9f0836e --- /dev/null +++ b/src/APMPaymentProcessingConfiguration.php @@ -0,0 +1,117 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get ReturnRedirectType + * Type of redirection performed once the customer returns from the Alternative Payment Method (APM) flow. + * @return string + */ + public function getReturnRedirectType() + { + return $this->returnRedirectType; + } + + /** + * Set ReturnRedirectType + * Type of redirection performed once the customer returns from the Alternative Payment Method (APM) flow. + * @param string $value + * @return $this + */ + public function setReturnRedirectType($value) + { + $this->returnRedirectType = $value; + return $this; + } + + /** + * Get PreferredFinalizationMode + * Preferred finalization mode requested for the Alternative Payment Method (APM) flow. + * @return string + */ + public function getPreferredFinalizationMode() + { + return $this->preferredFinalizationMode; + } + + /** + * Set PreferredFinalizationMode + * Preferred finalization mode requested for the Alternative Payment Method (APM) flow. + * @param string $value + * @return $this + */ + public function setPreferredFinalizationMode($value) + { + $this->preferredFinalizationMode = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return APMPaymentProcessingConfiguration + */ + public function fillWithData($data) + { + if(! empty($data['return_redirect_type'])) + $this->setReturnRedirectType($data['return_redirect_type']); + + if(! empty($data['preferred_finalization_mode'])) + $this->setPreferredFinalizationMode($data['preferred_finalization_mode']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return array + */ + public function jsonSerialize(): array { + return array( + "return_redirect_type" => $this->getReturnRedirectType(), + "preferred_finalization_mode" => $this->getPreferredFinalizationMode(), + ); + } + + +} diff --git a/src/Card.php b/src/Card.php index 80740e2..25774f7 100755 --- a/src/Card.php +++ b/src/Card.php @@ -155,11 +155,17 @@ class Card implements \JsonSerializable protected $zip; /** - * Country code of the card holder (ISO-3166, 2 characters format) + * Country where the card was issued, derived from the IIN/BIN lookup (ISO-3166, 2 characters format) * @var string */ protected $countryCode; + /** + * Billing country of the card holder (ISO-3166, 2 characters format), as supplied on the card's contact + * @var string + */ + protected $billingCountryCode; + /** * IP address of the card (IPv4 or IPv6) * @var string @@ -221,10 +227,16 @@ class Card implements \JsonSerializable protected $preferredCardType; /** - * ID of the Vault that the card resides in + * Initial scheme transaction ID associated with the card for transaction chaining + * @var string + */ + protected $initialSchemeTransactionId; + + /** + * Payment Account Reference (PAR) of the card, a unique identifier associating the card with the underlying account across tokens * @var string */ - protected $vaultId; + protected $paymentAccountReference; /** * Card constructor @@ -761,7 +773,7 @@ public function setZip($value) /** * Get CountryCode - * Country code of the card holder (ISO-3166, 2 characters format) + * Country where the card was issued, derived from the IIN/BIN lookup (ISO-3166, 2 characters format) * @return string */ public function getCountryCode() @@ -771,7 +783,7 @@ public function getCountryCode() /** * Set CountryCode - * Country code of the card holder (ISO-3166, 2 characters format) + * Country where the card was issued, derived from the IIN/BIN lookup (ISO-3166, 2 characters format) * @param string $value * @return $this */ @@ -781,6 +793,28 @@ public function setCountryCode($value) return $this; } + /** + * Get BillingCountryCode + * Billing country of the card holder (ISO-3166, 2 characters format), as supplied on the card's contact + * @return string + */ + public function getBillingCountryCode() + { + return $this->billingCountryCode; + } + + /** + * Set BillingCountryCode + * Billing country of the card holder (ISO-3166, 2 characters format), as supplied on the card's contact + * @param string $value + * @return $this + */ + public function setBillingCountryCode($value) + { + $this->billingCountryCode = $value; + return $this; + } + /** * Get IpAddress * IP address of the card (IPv4 or IPv6) @@ -1002,24 +1036,46 @@ public function setPreferredCardType($value) } /** - * Get VaultId - * ID of the Vault that the card resides in + * Get InitialSchemeTransactionId + * Initial scheme transaction ID associated with the card for transaction chaining * @return string */ - public function getVaultId() + public function getInitialSchemeTransactionId() { - return $this->vaultId; + return $this->initialSchemeTransactionId; } /** - * Set VaultId - * ID of the Vault that the card resides in + * Set InitialSchemeTransactionId + * Initial scheme transaction ID associated with the card for transaction chaining * @param string $value * @return $this */ - public function setVaultId($value) + public function setInitialSchemeTransactionId($value) { - $this->vaultId = $value; + $this->initialSchemeTransactionId = $value; + return $this; + } + + /** + * Get PaymentAccountReference + * Payment Account Reference (PAR) of the card, a unique identifier associating the card with the underlying account across tokens + * @return string + */ + public function getPaymentAccountReference() + { + return $this->paymentAccountReference; + } + + /** + * Set PaymentAccountReference + * Payment Account Reference (PAR) of the card, a unique identifier associating the card with the underlying account across tokens + * @param string $value + * @return $this + */ + public function setPaymentAccountReference($value) + { + $this->paymentAccountReference = $value; return $this; } @@ -1103,6 +1159,9 @@ public function fillWithData($data) if(! empty($data['country_code'])) $this->setCountryCode($data['country_code']); + if(! empty($data['billing_country_code'])) + $this->setBillingCountryCode($data['billing_country_code']); + if(! empty($data['ip_address'])) $this->setIpAddress($data['ip_address']); @@ -1133,8 +1192,11 @@ public function fillWithData($data) if(! empty($data['preferred_card_type'])) $this->setPreferredCardType($data['preferred_card_type']); - if(! empty($data['vault_id'])) - $this->setVaultId($data['vault_id']); + if(! empty($data['initial_scheme_transaction_id'])) + $this->setInitialSchemeTransactionId($data['initial_scheme_transaction_id']); + + if(! empty($data['payment_account_reference'])) + $this->setPaymentAccountReference($data['payment_account_reference']); return $this; } @@ -1169,6 +1231,7 @@ public function jsonSerialize(): array { "state" => $this->getState(), "zip" => $this->getZip(), "country_code" => $this->getCountryCode(), + "billing_country_code" => $this->getBillingCountryCode(), "ip_address" => $this->getIpAddress(), "fingerprint" => $this->getFingerprint(), "token_type" => $this->getTokenType(), @@ -1179,7 +1242,8 @@ public function jsonSerialize(): array { "sandbox" => $this->getSandbox(), "created_at" => $this->getCreatedAt(), "preferred_card_type" => $this->getPreferredCardType(), - "vault_id" => $this->getVaultId(), + "initial_scheme_transaction_id" => $this->getInitialSchemeTransactionId(), + "payment_account_reference" => $this->getPaymentAccountReference(), ); } diff --git a/src/CardContact.php b/src/CardContact.php index c3a5cc7..44e9d42 100755 --- a/src/CardContact.php +++ b/src/CardContact.php @@ -41,11 +41,17 @@ class CardContact implements \JsonSerializable protected $state; /** - * Country code of the card holder (ISO-3166, 2 characters format) + * Deprecated alias for billing_country_code. Billing country of the card holder (ISO-3166, 2 characters format). Kept for backward compatibility; prefer billing_country_code. * @var string */ protected $countryCode; + /** + * Billing country of the card holder (ISO-3166, 2 characters format). Takes precedence over country_code when both are supplied. + * @var string + */ + protected $billingCountryCode; + /** * ZIP code of the card holder * @var string @@ -155,7 +161,7 @@ public function setState($value) /** * Get CountryCode - * Country code of the card holder (ISO-3166, 2 characters format) + * Deprecated alias for billing_country_code. Billing country of the card holder (ISO-3166, 2 characters format). Kept for backward compatibility; prefer billing_country_code. * @return string */ public function getCountryCode() @@ -165,7 +171,7 @@ public function getCountryCode() /** * Set CountryCode - * Country code of the card holder (ISO-3166, 2 characters format) + * Deprecated alias for billing_country_code. Billing country of the card holder (ISO-3166, 2 characters format). Kept for backward compatibility; prefer billing_country_code. * @param string $value * @return $this */ @@ -175,6 +181,28 @@ public function setCountryCode($value) return $this; } + /** + * Get BillingCountryCode + * Billing country of the card holder (ISO-3166, 2 characters format). Takes precedence over country_code when both are supplied. + * @return string + */ + public function getBillingCountryCode() + { + return $this->billingCountryCode; + } + + /** + * Set BillingCountryCode + * Billing country of the card holder (ISO-3166, 2 characters format). Takes precedence over country_code when both are supplied. + * @param string $value + * @return $this + */ + public function setBillingCountryCode($value) + { + $this->billingCountryCode = $value; + return $this; + } + /** * Get Zip * ZIP code of the card holder @@ -220,6 +248,9 @@ public function fillWithData($data) if(! empty($data['country_code'])) $this->setCountryCode($data['country_code']); + if(! empty($data['billing_country_code'])) + $this->setBillingCountryCode($data['billing_country_code']); + if(! empty($data['zip'])) $this->setZip($data['zip']); @@ -237,6 +268,7 @@ public function jsonSerialize(): array { "city" => $this->getCity(), "state" => $this->getState(), "country_code" => $this->getCountryCode(), + "billing_country_code" => $this->getBillingCountryCode(), "zip" => $this->getZip(), ); } diff --git a/src/CardCreateRequest.php b/src/CardCreateRequest.php index 6526072..29bbd81 100755 --- a/src/CardCreateRequest.php +++ b/src/CardCreateRequest.php @@ -124,6 +124,12 @@ class CardCreateRequest implements \JsonSerializable */ protected $shipping; + /** + * Scheme details for transaction chaining (e.g. scheme transaction ID) + * @var object + */ + protected $schemeDetails; + /** * CardCreateRequest constructor * @param ProcessOut\ProcessOut $client @@ -554,6 +560,35 @@ public function setShipping($value) return $this; } + /** + * Get SchemeDetails + * Scheme details for transaction chaining (e.g. scheme transaction ID) + * @return object + */ + public function getSchemeDetails() + { + return $this->schemeDetails; + } + + /** + * Set SchemeDetails + * Scheme details for transaction chaining (e.g. scheme transaction ID) + * @param object $value + * @return $this + */ + public function setSchemeDetails($value) + { + if (is_object($value)) + $this->schemeDetails = $value; + else + { + $obj = new CardSchemeDetails($this->client); + $obj->fillWithData($value); + $this->schemeDetails = $obj; + } + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -616,6 +651,9 @@ public function fillWithData($data) if(! empty($data['shipping'])) $this->setShipping($data['shipping']); + if(! empty($data['scheme_details'])) + $this->setSchemeDetails($data['scheme_details']); + return $this; } @@ -643,6 +681,7 @@ public function jsonSerialize(): array { "payment_token" => $this->getPaymentToken(), "contact" => $this->getContact(), "shipping" => $this->getShipping(), + "scheme_details" => $this->getSchemeDetails(), ); } @@ -678,7 +717,7 @@ public function create($options = array()) "payment_token" => $this->getPaymentToken(), "contact" => $this->getContact(), "shipping" => $this->getShipping(), - "scheme_transaction" => $this->getSchemeTransaction() + "scheme_details" => $this->getSchemeDetails() ); $response = $request->post($path, $data, $options); diff --git a/src/CardSchemeDetails.php b/src/CardSchemeDetails.php new file mode 100755 index 0000000..ee53ba3 --- /dev/null +++ b/src/CardSchemeDetails.php @@ -0,0 +1,117 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get TransactionId + * Scheme transaction ID associated with the card for transaction chaining (e.g. SCA) + * @return string + */ + public function getTransactionId() + { + return $this->transactionId; + } + + /** + * Set TransactionId + * Scheme transaction ID associated with the card for transaction chaining (e.g. SCA) + * @param string $value + * @return $this + */ + public function setTransactionId($value) + { + $this->transactionId = $value; + return $this; + } + + /** + * Get TransactionLinkId + * Transaction Link Identifier for Mastercard transaction chaining + * @return string + */ + public function getTransactionLinkId() + { + return $this->transactionLinkId; + } + + /** + * Set TransactionLinkId + * Transaction Link Identifier for Mastercard transaction chaining + * @param string $value + * @return $this + */ + public function setTransactionLinkId($value) + { + $this->transactionLinkId = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return CardSchemeDetails + */ + public function fillWithData($data) + { + if(! empty($data['transaction_id'])) + $this->setTransactionId($data['transaction_id']); + + if(! empty($data['transaction_link_id'])) + $this->setTransactionLinkId($data['transaction_link_id']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return array + */ + public function jsonSerialize(): array { + return array( + "transaction_id" => $this->getTransactionId(), + "transaction_link_id" => $this->getTransactionLinkId(), + ); + } + + +} diff --git a/src/CardUpdateRequest.php b/src/CardUpdateRequest.php index c62de71..87b6b90 100755 --- a/src/CardUpdateRequest.php +++ b/src/CardUpdateRequest.php @@ -28,6 +28,12 @@ class CardUpdateRequest implements \JsonSerializable */ protected $preferredCardType; + /** + * Scheme details for transaction chaining (e.g. scheme transaction ID) + * @var object + */ + protected $schemeDetails; + /** * CardUpdateRequest constructor * @param ProcessOut\ProcessOut $client @@ -85,6 +91,35 @@ public function setPreferredCardType($value) return $this; } + /** + * Get SchemeDetails + * Scheme details for transaction chaining (e.g. scheme transaction ID) + * @return object + */ + public function getSchemeDetails() + { + return $this->schemeDetails; + } + + /** + * Set SchemeDetails + * Scheme details for transaction chaining (e.g. scheme transaction ID) + * @param object $value + * @return $this + */ + public function setSchemeDetails($value) + { + if (is_object($value)) + $this->schemeDetails = $value; + else + { + $obj = new CardSchemeDetails($this->client); + $obj->fillWithData($value); + $this->schemeDetails = $obj; + } + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -99,6 +134,9 @@ public function fillWithData($data) if(! empty($data['preferred_card_type'])) $this->setPreferredCardType($data['preferred_card_type']); + if(! empty($data['scheme_details'])) + $this->setSchemeDetails($data['scheme_details']); + return $this; } @@ -110,6 +148,7 @@ public function jsonSerialize(): array { return array( "preferred_scheme" => $this->getPreferredScheme(), "preferred_card_type" => $this->getPreferredCardType(), + "scheme_details" => $this->getSchemeDetails(), ); } @@ -129,7 +168,7 @@ public function update($cardId, $options = array()) $data = array( "preferred_scheme" => $this->getPreferredScheme(), - "scheme_transaction" => $this->getSchemeTransaction() + "scheme_details" => $this->getSchemeDetails() ); $response = $request->put($path, $data, $options); diff --git a/src/Customer.php b/src/Customer.php index 3d02ef0..9642d4f 100755 --- a/src/Customer.php +++ b/src/Customer.php @@ -202,12 +202,6 @@ class Customer implements \JsonSerializable */ protected $referenceId; - /** - * ID of the Vault that customer resides in - * @var string - */ - protected $vaultId; - /** * Customer constructor * @param ProcessOut\ProcessOut $client @@ -948,28 +942,6 @@ public function setReferenceId($value) return $this; } - /** - * Get VaultId - * ID of the Vault that customer resides in - * @return string - */ - public function getVaultId() - { - return $this->vaultId; - } - - /** - * Set VaultId - * ID of the Vault that customer resides in - * @param string $value - * @return $this - */ - public function setVaultId($value) - { - $this->vaultId = $value; - return $this; - } - /** * Fills the current object with the new values pulled from the data @@ -1071,9 +1043,6 @@ public function fillWithData($data) if(! empty($data['reference_id'])) $this->setReferenceId($data['reference_id']); - if(! empty($data['vault_id'])) - $this->setVaultId($data['vault_id']); - return $this; } @@ -1114,7 +1083,6 @@ public function jsonSerialize(): array { "registered_at" => $this->getRegisteredAt(), "date_of_birth" => $this->getDateOfBirth(), "reference_id" => $this->getReferenceId(), - "vault_id" => $this->getVaultId(), ); } diff --git a/src/Invoice.php b/src/Invoice.php index a4ccfa4..e09eac1 100755 --- a/src/Invoice.php +++ b/src/Invoice.php @@ -82,6 +82,12 @@ class Invoice implements \JsonSerializable */ protected $submerchant; + /** + * ID of the submerchant linked to the invoice, if any + * @var string + */ + protected $submerchantId; + /** * URL to which you may redirect your customer to proceed with the payment * @var string @@ -316,6 +322,12 @@ class Invoice implements \JsonSerializable */ protected $referenceId; + /** + * Configuration related to payment processing of the invoice. + * @var object + */ + protected $paymentProcessingConfig; + /** * Invoice constructor * @param ProcessOut\ProcessOut $client @@ -618,6 +630,28 @@ public function setSubmerchant($value) return $this; } + /** + * Get SubmerchantId + * ID of the submerchant linked to the invoice, if any + * @return string + */ + public function getSubmerchantId() + { + return $this->submerchantId; + } + + /** + * Set SubmerchantId + * ID of the submerchant linked to the invoice, if any + * @param string $value + * @return $this + */ + public function setSubmerchantId($value) + { + $this->submerchantId = $value; + return $this; + } + /** * Get Url * URL to which you may redirect your customer to proceed with the payment @@ -1532,6 +1566,35 @@ public function setReferenceId($value) return $this; } + /** + * Get PaymentProcessingConfig + * Configuration related to payment processing of the invoice. + * @return object + */ + public function getPaymentProcessingConfig() + { + return $this->paymentProcessingConfig; + } + + /** + * Set PaymentProcessingConfig + * Configuration related to payment processing of the invoice. + * @param object $value + * @return $this + */ + public function setPaymentProcessingConfig($value) + { + if (is_object($value)) + $this->paymentProcessingConfig = $value; + else + { + $obj = new PaymentProcessingConfiguration($this->client); + $obj->fillWithData($value); + $this->paymentProcessingConfig = $obj; + } + return $this; + } + /** * Fills the current object with the new values pulled from the data @@ -1573,6 +1636,9 @@ public function fillWithData($data) if(! empty($data['submerchant'])) $this->setSubmerchant($data['submerchant']); + if(! empty($data['submerchant_id'])) + $this->setSubmerchantId($data['submerchant_id']); + if(! empty($data['url'])) $this->setUrl($data['url']); @@ -1690,6 +1756,9 @@ public function fillWithData($data) if(! empty($data['reference_id'])) $this->setReferenceId($data['reference_id']); + if(! empty($data['payment_processing_config'])) + $this->setPaymentProcessingConfig($data['payment_processing_config']); + return $this; } @@ -1710,6 +1779,7 @@ public function jsonSerialize(): array { "token_id" => $this->getTokenId(), "details" => $this->getDetails(), "submerchant" => $this->getSubmerchant(), + "submerchant_id" => $this->getSubmerchantId(), "url" => $this->getUrl(), "url_qrcode" => $this->getUrlQrcode(), "name" => $this->getName(), @@ -1749,6 +1819,7 @@ public function jsonSerialize(): array { "verification" => $this->getVerification(), "auto_capture_at" => $this->getAutoCaptureAt(), "reference_id" => $this->getReferenceId(), + "payment_processing_config" => $this->getPaymentProcessingConfig(), ); } @@ -1779,6 +1850,9 @@ public function authenticate($source, $options = array()) "override_mac_blocking" => (!empty($options["override_mac_blocking"])) ? $options["override_mac_blocking"] : null, "external_three_d_s" => (!empty($options["external_three_d_s"])) ? $options["external_three_d_s"] : null, "save_source" => (!empty($options["save_source"])) ? $options["save_source"] : null, + "provision_network_token" => (!empty($options["provision_network_token"])) ? $options["provision_network_token"] : null, + "invoice_line_items" => (!empty($options["invoice_line_items"])) ? $options["invoice_line_items"] : null, + "transaction_link_id" => (!empty($options["transaction_link_id"])) ? $options["transaction_link_id"] : null, "source" => $source ); @@ -1866,6 +1940,9 @@ public function authorize($source, $options = array()) "override_mac_blocking" => (!empty($options["override_mac_blocking"])) ? $options["override_mac_blocking"] : null, "external_three_d_s" => (!empty($options["external_three_d_s"])) ? $options["external_three_d_s"] : null, "save_source" => (!empty($options["save_source"])) ? $options["save_source"] : null, + "provision_network_token" => (!empty($options["provision_network_token"])) ? $options["provision_network_token"] : null, + "invoice_line_items" => (!empty($options["invoice_line_items"])) ? $options["invoice_line_items"] : null, + "transaction_link_id" => (!empty($options["transaction_link_id"])) ? $options["transaction_link_id"] : null, "source" => $source ); @@ -1889,6 +1966,7 @@ public function authorize($source, $options = array()) $returnValues['customerAction'] = $customerAction->fillWithData($body); } + // Handling for field outcome return (object) $returnValues; } @@ -1920,6 +1998,8 @@ public function capture($source, $options = array()) "override_mac_blocking" => (!empty($options["override_mac_blocking"])) ? $options["override_mac_blocking"] : null, "external_three_d_s" => (!empty($options["external_three_d_s"])) ? $options["external_three_d_s"] : null, "save_source" => (!empty($options["save_source"])) ? $options["save_source"] : null, + "provision_network_token" => (!empty($options["provision_network_token"])) ? $options["provision_network_token"] : null, + "transaction_link_id" => (!empty($options["transaction_link_id"])) ? $options["transaction_link_id"] : null, "source" => $source ); @@ -1943,6 +2023,7 @@ public function capture($source, $options = array()) $returnValues['customerAction'] = $customerAction->fillWithData($body); } + // Handling for field outcome return (object) $returnValues; } @@ -2279,6 +2360,7 @@ public function create($options = array()) "metadata" => $this->getMetadata(), "details" => $this->getDetails(), "submerchant" => $this->getSubmerchant(), + "submerchant_id" => $this->getSubmerchantId(), "reference_id" => $this->getReferenceId(), "exemption_reason_3ds2" => $this->getExemptionReason3ds2(), "sca_exemption_reason" => $this->getScaExemptionReason(), diff --git a/src/Networking/Request.php b/src/Networking/Request.php index df21486..3becc89 100644 --- a/src/Networking/Request.php +++ b/src/Networking/Request.php @@ -31,7 +31,7 @@ protected function prepare($options, $len = null) $headers = array( 'API-Version: 1.4.0.0', 'Content-Type: application/json', - 'User-Agent: ProcessOut PHP-Bindings/8.0.1' + 'User-Agent: ProcessOut PHP-Bindings/9.0.0' ); if (! empty($options['idempotencyKey'])) $headers[] = 'Idempotency-Key: ' . $options['idempotencyKey']; diff --git a/src/PaymentProcessingConfiguration.php b/src/PaymentProcessingConfiguration.php new file mode 100755 index 0000000..dcecd66 --- /dev/null +++ b/src/PaymentProcessingConfiguration.php @@ -0,0 +1,124 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get BypassUnsupportedSplitPayments + * Payment processing should bypass unsupported split payments validation when no payment gateway supports it. + * @return bool + */ + public function getBypassUnsupportedSplitPayments() + { + return $this->bypassUnsupportedSplitPayments; + } + + /** + * Set BypassUnsupportedSplitPayments + * Payment processing should bypass unsupported split payments validation when no payment gateway supports it. + * @param bool $value + * @return $this + */ + public function setBypassUnsupportedSplitPayments($value) + { + $this->bypassUnsupportedSplitPayments = $value; + return $this; + } + + /** + * Get ApmPaymentConfig + * Alternative Payment Method (APM) specific payment processing cofiguration. + * @return object + */ + public function getApmPaymentConfig() + { + return $this->apmPaymentConfig; + } + + /** + * Set ApmPaymentConfig + * Alternative Payment Method (APM) specific payment processing cofiguration. + * @param object $value + * @return $this + */ + public function setApmPaymentConfig($value) + { + if (is_object($value)) + $this->apmPaymentConfig = $value; + else + { + $obj = new APMPaymentProcessingConfiguration($this->client); + $obj->fillWithData($value); + $this->apmPaymentConfig = $obj; + } + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return PaymentProcessingConfiguration + */ + public function fillWithData($data) + { + if(! empty($data['bypass_unsupported_split_payments'])) + $this->setBypassUnsupportedSplitPayments($data['bypass_unsupported_split_payments']); + + if(! empty($data['apm_payment_config'])) + $this->setApmPaymentConfig($data['apm_payment_config']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return array + */ + public function jsonSerialize(): array { + return array( + "bypass_unsupported_split_payments" => $this->getBypassUnsupportedSplitPayments(), + "apm_payment_config" => $this->getApmPaymentConfig(), + ); + } + + +} diff --git a/src/ProcessOut.php b/src/ProcessOut.php index 16918c7..28dce48 100644 --- a/src/ProcessOut.php +++ b/src/ProcessOut.php @@ -379,6 +379,24 @@ public function newUnsupportedFeatureBypass($prefill = array()) { return new UnsupportedFeatureBypass($this, $prefill); } + /** + * Create a new PaymentProcessingConfiguration instance + * @param array|null $prefill array used to prefill the object + * @return PaymentProcessingConfiguration + */ + public function newPaymentProcessingConfiguration($prefill = array()) { + return new PaymentProcessingConfiguration($this, $prefill); + } + + /** + * Create a new APMPaymentProcessingConfiguration instance + * @param array|null $prefill array used to prefill the object + * @return APMPaymentProcessingConfiguration + */ + public function newAPMPaymentProcessingConfiguration($prefill = array()) { + return new APMPaymentProcessingConfiguration($this, $prefill); + } + /** * Create a new InvoiceDetail instance * @param array|null $prefill array used to prefill the object @@ -505,6 +523,24 @@ public function newRefund($prefill = array()) { return new Refund($this, $prefill); } + /** + * Create a new Submerchant instance + * @param array|null $prefill array used to prefill the object + * @return Submerchant + */ + public function newSubmerchant($prefill = array()) { + return new Submerchant($this, $prefill); + } + + /** + * Create a new SubmerchantMapping instance + * @param array|null $prefill array used to prefill the object + * @return SubmerchantMapping + */ + public function newSubmerchantMapping($prefill = array()) { + return new SubmerchantMapping($this, $prefill); + } + /** * Create a new Transaction instance * @param array|null $prefill array used to prefill the object @@ -622,6 +658,15 @@ public function newCardCreateRequest($prefill = array()) { return new CardCreateRequest($this, $prefill); } + /** + * Create a new CardSchemeDetails instance + * @param array|null $prefill array used to prefill the object + * @return CardSchemeDetails + */ + public function newCardSchemeDetails($prefill = array()) { + return new CardSchemeDetails($this, $prefill); + } + /** * Create a new Device instance * @param array|null $prefill array used to prefill the object diff --git a/src/Submerchant.php b/src/Submerchant.php new file mode 100755 index 0000000..adb8cf5 --- /dev/null +++ b/src/Submerchant.php @@ -0,0 +1,149 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Id + * ID of the submerchant at ProcessOut + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * Set Id + * ID of the submerchant at ProcessOut + * @param string $value + * @return $this + */ + public function setId($value) + { + $this->id = $value; + return $this; + } + + /** + * Get Name + * Legal name of the submerchant + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set Name + * Legal name of the submerchant + * @param string $value + * @return $this + */ + public function setName($value) + { + $this->name = $value; + return $this; + } + + /** + * Get CreatedAt + * Time at which the submerchant was created + * @return string + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set CreatedAt + * Time at which the submerchant was created + * @param string $value + * @return $this + */ + public function setCreatedAt($value) + { + $this->createdAt = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return Submerchant + */ + public function fillWithData($data) + { + if(! empty($data['id'])) + $this->setId($data['id']); + + if(! empty($data['name'])) + $this->setName($data['name']); + + if(! empty($data['created_at'])) + $this->setCreatedAt($data['created_at']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return array + */ + public function jsonSerialize(): array { + return array( + "id" => $this->getId(), + "name" => $this->getName(), + "created_at" => $this->getCreatedAt(), + ); + } + + +} diff --git a/src/SubmerchantMapping.php b/src/SubmerchantMapping.php new file mode 100755 index 0000000..f86e201 --- /dev/null +++ b/src/SubmerchantMapping.php @@ -0,0 +1,181 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get SubmerchantId + * ID of the ProcessOut submerchant this mapping belongs to + * @return string + */ + public function getSubmerchantId() + { + return $this->submerchantId; + } + + /** + * Set SubmerchantId + * ID of the ProcessOut submerchant this mapping belongs to + * @param string $value + * @return $this + */ + public function setSubmerchantId($value) + { + $this->submerchantId = $value; + return $this; + } + + /** + * Get GatewayConfigurationId + * ID of the gateway configuration this mapping applies to + * @return string + */ + public function getGatewayConfigurationId() + { + return $this->gatewayConfigurationId; + } + + /** + * Set GatewayConfigurationId + * ID of the gateway configuration this mapping applies to + * @param string $value + * @return $this + */ + public function setGatewayConfigurationId($value) + { + $this->gatewayConfigurationId = $value; + return $this; + } + + /** + * Get PspSubmerchantId + * Submerchant ID at the PSP the gateway configuration connects to + * @return string + */ + public function getPspSubmerchantId() + { + return $this->pspSubmerchantId; + } + + /** + * Set PspSubmerchantId + * Submerchant ID at the PSP the gateway configuration connects to + * @param string $value + * @return $this + */ + public function setPspSubmerchantId($value) + { + $this->pspSubmerchantId = $value; + return $this; + } + + /** + * Get CreatedAt + * Time at which the mapping was created + * @return string + */ + public function getCreatedAt() + { + return $this->createdAt; + } + + /** + * Set CreatedAt + * Time at which the mapping was created + * @param string $value + * @return $this + */ + public function setCreatedAt($value) + { + $this->createdAt = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return SubmerchantMapping + */ + public function fillWithData($data) + { + if(! empty($data['submerchant_id'])) + $this->setSubmerchantId($data['submerchant_id']); + + if(! empty($data['gateway_configuration_id'])) + $this->setGatewayConfigurationId($data['gateway_configuration_id']); + + if(! empty($data['psp_submerchant_id'])) + $this->setPspSubmerchantId($data['psp_submerchant_id']); + + if(! empty($data['created_at'])) + $this->setCreatedAt($data['created_at']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return array + */ + public function jsonSerialize(): array { + return array( + "submerchant_id" => $this->getSubmerchantId(), + "gateway_configuration_id" => $this->getGatewayConfigurationId(), + "psp_submerchant_id" => $this->getPspSubmerchantId(), + "created_at" => $this->getCreatedAt(), + ); + } + + +} diff --git a/src/Token.php b/src/Token.php index fa94b46..c81c12a 100755 --- a/src/Token.php +++ b/src/Token.php @@ -155,10 +155,10 @@ class Token implements \JsonSerializable protected $webhookUrl; /** - * ID of the Vault that customer token resides in - * @var string + * Sticky preference controlling network token provisioning for this token. Null when unset (default behaviour applies), false to opt out, true to opt in + * @var boolean */ - protected $vaultId; + protected $provisionNetworkToken; /** * Token constructor @@ -708,24 +708,24 @@ public function setWebhookUrl($value) } /** - * Get VaultId - * ID of the Vault that customer token resides in - * @return string + * Get ProvisionNetworkToken + * Sticky preference controlling network token provisioning for this token. Null when unset (default behaviour applies), false to opt out, true to opt in + * @return bool */ - public function getVaultId() + public function getProvisionNetworkToken() { - return $this->vaultId; + return $this->provisionNetworkToken; } /** - * Set VaultId - * ID of the Vault that customer token resides in - * @param string $value + * Set ProvisionNetworkToken + * Sticky preference controlling network token provisioning for this token. Null when unset (default behaviour applies), false to opt out, true to opt in + * @param bool $value * @return $this */ - public function setVaultId($value) + public function setProvisionNetworkToken($value) { - $this->vaultId = $value; + $this->provisionNetworkToken = $value; return $this; } @@ -806,8 +806,8 @@ public function fillWithData($data) if(! empty($data['webhook_url'])) $this->setWebhookUrl($data['webhook_url']); - if(! empty($data['vault_id'])) - $this->setVaultId($data['vault_id']); + if(! empty($data['provision_network_token'])) + $this->setProvisionNetworkToken($data['provision_network_token']); return $this; } @@ -841,7 +841,7 @@ public function jsonSerialize(): array { "verification_status" => $this->getVerificationStatus(), "can_get_balance" => $this->getCanGetBalance(), "webhook_url" => $this->getWebhookUrl(), - "vault_id" => $this->getVaultId(), + "provision_network_token" => $this->getProvisionNetworkToken(), ); } @@ -942,7 +942,8 @@ public function create($options = array()) "set_default" => (!empty($options["set_default"])) ? $options["set_default"] : null, "verify_statement_descriptor" => (!empty($options["verify_statement_descriptor"])) ? $options["verify_statement_descriptor"] : null, "invoice_return_url" => (!empty($options["invoice_return_url"])) ? $options["invoice_return_url"] : null, - "summary" => (!empty($options["summary"])) ? $options["summary"] : null + "summary" => (!empty($options["summary"])) ? $options["summary"] : null, + "provision_network_token" => (!empty($options["provision_network_token"])) ? $options["provision_network_token"] : null ); $response = $request->post($path, $data, $options); @@ -988,7 +989,8 @@ public function save($options = array()) "set_default" => (!empty($options["set_default"])) ? $options["set_default"] : null, "verify_statement_descriptor" => (!empty($options["verify_statement_descriptor"])) ? $options["verify_statement_descriptor"] : null, "invoice_return_url" => (!empty($options["invoice_return_url"])) ? $options["invoice_return_url"] : null, - "gateway_configuration_id" => (!empty($options["gateway_configuration_id"])) ? $options["gateway_configuration_id"] : null + "gateway_configuration_id" => (!empty($options["gateway_configuration_id"])) ? $options["gateway_configuration_id"] : null, + "provision_network_token" => (!empty($options["provision_network_token"])) ? $options["provision_network_token"] : null ); $response = $request->put($path, $data, $options);