diff --git a/README.md b/README.md index 19cc4e7..9fa124f 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": "^6.31.0" + "processout/processout-php": "^6.32.0" } } ``` diff --git a/init.php b/init.php index 1cd7db5..41d4776 100644 --- a/init.php +++ b/init.php @@ -51,6 +51,7 @@ include_once(dirname(__FILE__) . "/src/Product.php"); include_once(dirname(__FILE__) . "/src/Project.php"); 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/Subscription.php"); include_once(dirname(__FILE__) . "/src/Transaction.php"); diff --git a/src/CardCreateRequest.php b/src/CardCreateRequest.php index eb8ec1c..dedde4c 100755 --- a/src/CardCreateRequest.php +++ b/src/CardCreateRequest.php @@ -628,7 +628,23 @@ public function create($options = array()) $path = "/cards"; $data = array( - + "device" => $this->getDevice(), + "name" => $this->getName(), + "number" => $this->getNumber(), + "exp_day" => $this->getExpDay(), + "exp_month" => $this->getExpMonth(), + "exp_year" => $this->getExpYear(), + "cvc2" => $this->getCvc2(), + "preferred_scheme" => $this->getPreferredScheme(), + "metadata" => $this->getMetadata(), + "token_type" => $this->getTokenType(), + "eci" => $this->getEci(), + "cryptogram" => $this->getCryptogram(), + "applepay_response" => $this->getApplepayResponse(), + "applepay_mid" => $this->getApplepayMid(), + "payment_token" => $this->getPaymentToken(), + "contact" => $this->getContact(), + "shipping" => $this->getShipping() ); $response = $request->post($path, $data, $options); diff --git a/src/CardUpdateRequest.php b/src/CardUpdateRequest.php index ac50041..427f466 100755 --- a/src/CardUpdateRequest.php +++ b/src/CardUpdateRequest.php @@ -160,7 +160,9 @@ public function update($cardId, $options = array()) $path = "/cards/" . urlencode($cardId) . ""; $data = array( - + "update_type" => $this->getUpdateType(), + "update_reason" => $this->getUpdateReason(), + "preferred_scheme" => $this->getPreferredScheme() ); $response = $request->put($path, $data, $options); diff --git a/src/Networking/Request.php b/src/Networking/Request.php index f77758b..cf420ea 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/6.31.0' + 'User-Agent: ProcessOut PHP-Bindings/6.32.0' ); if (! empty($options['idempotencyKey'])) $headers[] = 'Idempotency-Key: ' . $options['idempotencyKey']; diff --git a/src/ProcessOut.php b/src/ProcessOut.php index c7ff583..40d4d13 100644 --- a/src/ProcessOut.php +++ b/src/ProcessOut.php @@ -424,6 +424,15 @@ public function newProjectSFTPSettings($prefill = array()) { return new ProjectSFTPSettings($this, $prefill); } + /** + * Create a new ProjectSFTPSettingsPublic instance + * @param array|null $prefill array used to prefill the object + * @return ProjectSFTPSettingsPublic + */ + public function newProjectSFTPSettingsPublic($prefill = array()) { + return new ProjectSFTPSettingsPublic($this, $prefill); + } + /** * Create a new Refund instance * @param array|null $prefill array used to prefill the object diff --git a/src/ProjectSFTPSettings.php b/src/ProjectSFTPSettings.php index 8c81fc5..3ec66c6 100755 --- a/src/ProjectSFTPSettings.php +++ b/src/ProjectSFTPSettings.php @@ -17,7 +17,7 @@ class ProjectSFTPSettings implements \JsonSerializable protected $client; /** - * SFTP server endpoint, port is required. + * SFTP server endpoint, port is required * @var string */ protected $endpoint; @@ -55,7 +55,7 @@ public function __construct(ProcessOut $client, $prefill = array()) /** * Get Endpoint - * SFTP server endpoint, port is required. + * SFTP server endpoint, port is required * @return string */ public function getEndpoint() @@ -65,7 +65,7 @@ public function getEndpoint() /** * Set Endpoint - * SFTP server endpoint, port is required. + * SFTP server endpoint, port is required * @param string $value * @return $this */ diff --git a/src/ProjectSFTPSettingsPublic.php b/src/ProjectSFTPSettingsPublic.php new file mode 100755 index 0000000..6d51bf6 --- /dev/null +++ b/src/ProjectSFTPSettingsPublic.php @@ -0,0 +1,178 @@ +client = $client; + + $this->fillWithData($prefill); + } + + + /** + * Get Enabled + * Whether the SFTP settings are enabled + * @return bool + */ + public function getEnabled() + { + return $this->enabled; + } + + /** + * Set Enabled + * Whether the SFTP settings are enabled + * @param bool $value + * @return $this + */ + public function setEnabled($value) + { + $this->enabled = $value; + return $this; + } + + /** + * Get Endpoint + * SFTP server endpoint with port + * @return string + */ + public function getEndpoint() + { + return $this->endpoint; + } + + /** + * Set Endpoint + * SFTP server endpoint with port + * @param string $value + * @return $this + */ + public function setEndpoint($value) + { + $this->endpoint = $value; + return $this; + } + + /** + * Get Username + * SFTP server username + * @return string + */ + public function getUsername() + { + return $this->username; + } + + /** + * Set Username + * SFTP server username + * @param string $value + * @return $this + */ + public function setUsername($value) + { + $this->username = $value; + return $this; + } + + + /** + * Fills the current object with the new values pulled from the data + * @param array $data + * @return ProjectSFTPSettingsPublic + */ + public function fillWithData($data) + { + if(! empty($data['enabled'])) + $this->setEnabled($data['enabled']); + + if(! empty($data['endpoint'])) + $this->setEndpoint($data['endpoint']); + + if(! empty($data['username'])) + $this->setUsername($data['username']); + + return $this; + } + + /** + * Implements the JsonSerializable interface + * @return object + */ + public function jsonSerialize() { + return array( + "enabled" => $this->getEnabled(), + "endpoint" => $this->getEndpoint(), + "username" => $this->getUsername(), + ); + } + + + /** + * Fetch the SFTP settings for the project. + * @param string $id + * @param array $options + * @return $this + */ + public function fetchSftpSettings($id, $options = array()) + { + $this->fillWithData($options); + + $request = new Request($this->client); + $path = "/projects/" . urlencode($id) . "/sftp-settings"; + + $data = array( + + ); + + $response = $request->get($path, $data, $options); + $returnValues = array(); + + + // Handling for field sftp_settings + $body = $response->getBody(); + $body = $body['sftp_settings']; + $returnValues['fetchSftpSettings'] = $this->fillWithData($body); + + return array_values($returnValues)[0]; + } + +}