Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The package's installation is done using composer. Simply add these lines to you
```json
{
"require": {
"processout/processout-php": "^7.1.0"
"processout/processout-php": "^7.2.0"
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
include_once(dirname(__FILE__) . "/src/ErrorCodes.php");
include_once(dirname(__FILE__) . "/src/CategoryErrorCodes.php");
include_once(dirname(__FILE__) . "/src/ExternalThreeDS.php");
include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetails.php");
include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetailsGateway.php");
include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetailsInvoice.php");
include_once(dirname(__FILE__) . "/src/NativeAPMTransactionDetails.php");

include_once(dirname(__FILE__) . "/src/GatewayRequest.php");
34 changes: 34 additions & 0 deletions src/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ class Customer implements \JsonSerializable
*/
protected $lastName;

/**
* Company name of the customer (for business customers only)
* @var string
*/
protected $companyName;

/**
* Address of the customer
* @var string
Expand Down Expand Up @@ -545,6 +551,28 @@ public function setLastName($value)
return $this;
}

/**
* Get CompanyName
* Company name of the customer (for business customers only)
* @return string
*/
public function getCompanyName()
{
return $this->companyName;
}

/**
* Set CompanyName
* Company name of the customer (for business customers only)
* @param string $value
* @return $this
*/
public function setCompanyName($value)
{
$this->companyName = $value;
return $this;
}

/**
* Get Address1
* Address of the customer
Expand Down Expand Up @@ -973,6 +1001,9 @@ public function fillWithData($data)
if(! empty($data['last_name']))
$this->setLastName($data['last_name']);

if(! empty($data['company_name']))
$this->setCompanyName($data['company_name']);

if(! empty($data['address1']))
$this->setAddress1($data['address1']);

Expand Down Expand Up @@ -1046,6 +1077,7 @@ public function jsonSerialize() {
"email" => $this->getEmail(),
"first_name" => $this->getFirstName(),
"last_name" => $this->getLastName(),
"company_name" => $this->getCompanyName(),
"address1" => $this->getAddress1(),
"address2" => $this->getAddress2(),
"city" => $this->getCity(),
Expand Down Expand Up @@ -1277,6 +1309,7 @@ public function create($options = array())
"email" => $this->getEmail(),
"first_name" => $this->getFirstName(),
"last_name" => $this->getLastName(),
"company_name" => $this->getCompanyName(),
"address1" => $this->getAddress1(),
"address2" => $this->getAddress2(),
"city" => $this->getCity(),
Expand Down Expand Up @@ -1354,6 +1387,7 @@ public function save($options = array())
"email" => $this->getEmail(),
"first_name" => $this->getFirstName(),
"last_name" => $this->getLastName(),
"company_name" => $this->getCompanyName(),
"address1" => $this->getAddress1(),
"address2" => $this->getAddress2(),
"city" => $this->getCity(),
Expand Down
61 changes: 61 additions & 0 deletions src/Invoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -2291,4 +2291,65 @@ public function delete($invoiceId, $options = array())
return array_values($returnValues)[0];
}

/**
* Refresh invoice by its ID with PSP.
* @param string $invoiceId
* @param array $options
* @return $this
*/
public function syncWithPsp($invoiceId, $options = array())
{
$this->fillWithData($options);

$request = new Request($this->client);
$path = "/invoices/" . urlencode($invoiceId) . "/sync-with-psp";

$data = array(

);

$response = $request->put($path, $data, $options);
$returnValues = array();


// Handling for field invoice
$body = $response->getBody();
$body = $body['invoice'];
$returnValues['syncWithPsp'] = $this->fillWithData($body);

return array_values($returnValues)[0];
}

/**
* Update invoice by its ID.
* @param string $invoiceId
* @param array $options
* @return $this
*/
public function update($invoiceId, $options = array())
{
$this->fillWithData($options);

$request = new Request($this->client);
$path = "/invoices/" . urlencode($invoiceId) . "";

$data = array(
"amount" => $this->getAmount(),
"tax" => $this->getTax(),
"details" => $this->getDetails(),
"shipping" => $this->getShipping()
);

$response = $request->put($path, $data, $options);
$returnValues = array();


// Handling for field invoice
$body = $response->getBody();
$body = $body['invoice'];
$returnValues['update'] = $this->fillWithData($body);

return array_values($returnValues)[0];
}

}
2 changes: 1 addition & 1 deletion src/Networking/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -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/7.1.0'
'User-Agent: ProcessOut PHP-Bindings/7.2.0'
);
if (! empty($options['idempotencyKey']))
$headers[] = 'Idempotency-Key: ' . $options['idempotencyKey'];
Expand Down
18 changes: 9 additions & 9 deletions src/ProcessOut.php
Original file line number Diff line number Diff line change
Expand Up @@ -694,15 +694,6 @@ public function newExternalThreeDS($prefill = array()) {
return new ExternalThreeDS($this, $prefill);
}

/**
* Create a new NativeAPMTransactionDetails instance
* @param array|null $prefill array used to prefill the object
* @return NativeAPMTransactionDetails
*/
public function newNativeAPMTransactionDetails($prefill = array()) {
return new NativeAPMTransactionDetails($this, $prefill);
}

/**
* Create a new NativeAPMTransactionDetailsGateway instance
* @param array|null $prefill array used to prefill the object
Expand All @@ -721,4 +712,13 @@ public function newNativeAPMTransactionDetailsInvoice($prefill = array()) {
return new NativeAPMTransactionDetailsInvoice($this, $prefill);
}

/**
* Create a new NativeAPMTransactionDetails instance
* @param array|null $prefill array used to prefill the object
* @return NativeAPMTransactionDetails
*/
public function newNativeAPMTransactionDetails($prefill = array()) {
return new NativeAPMTransactionDetails($this, $prefill);
}

}
12 changes: 6 additions & 6 deletions src/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class Token implements \JsonSerializable
protected $cardId;

/**
* Type of the token. Can be card or gateway_token
* Type of the token. Can be card, bank_account or gateway_token
* @var string
*/
protected $type;
Expand Down Expand Up @@ -95,7 +95,7 @@ class Token implements \JsonSerializable
protected $cancelUrl;

/**
* Summary of the customer token, such as a description of the card used or the email of a PayPal account
* Summary of the customer token, such as a description of the card used or bank account or the email of a PayPal account
* @var string
*/
protected $summary;
Expand Down Expand Up @@ -338,7 +338,7 @@ public function setCardId($value)

/**
* Get Type
* Type of the token. Can be card or gateway_token
* Type of the token. Can be card, bank_account or gateway_token
* @return string
*/
public function getType()
Expand All @@ -348,7 +348,7 @@ public function getType()

/**
* Set Type
* Type of the token. Can be card or gateway_token
* Type of the token. Can be card, bank_account or gateway_token
* @param string $value
* @return $this
*/
Expand Down Expand Up @@ -470,7 +470,7 @@ public function setCancelUrl($value)

/**
* Get Summary
* Summary of the customer token, such as a description of the card used or the email of a PayPal account
* Summary of the customer token, such as a description of the card used or bank account or the email of a PayPal account
* @return string
*/
public function getSummary()
Expand All @@ -480,7 +480,7 @@ public function getSummary()

/**
* Set Summary
* Summary of the customer token, such as a description of the card used or the email of a PayPal account
* Summary of the customer token, such as a description of the card used or bank account or the email of a PayPal account
* @param string $value
* @return $this
*/
Expand Down
64 changes: 64 additions & 0 deletions src/TransactionOperation.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ class TransactionOperation implements \JsonSerializable
*/
protected $errorCode;

/**
* Error message returned when attempting the operation, if any
* @var string
*/
protected $errorMessage;

/**
* Additionnal context saved when processing the transaction on the specific PSP
* @var dictionary
Expand Down Expand Up @@ -160,6 +166,12 @@ class TransactionOperation implements \JsonSerializable
*/
protected $schemeId;

/**
* Indicates whether the transaction was processed with a network token instead of raw card details
* @var boolean
*/
protected $processedWithNetworkToken;

/**
* Payment type of the transaction
* @var string
Expand Down Expand Up @@ -621,6 +633,28 @@ public function setErrorCode($value)
return $this;
}

/**
* Get ErrorMessage
* Error message returned when attempting the operation, if any
* @return string
*/
public function getErrorMessage()
{
return $this->errorMessage;
}

/**
* Set ErrorMessage
* Error message returned when attempting the operation, if any
* @param string $value
* @return $this
*/
public function setErrorMessage($value)
{
$this->errorMessage = $value;
return $this;
}

/**
* Get GatewayData
* Additionnal context saved when processing the transaction on the specific PSP
Expand Down Expand Up @@ -774,6 +808,28 @@ public function setSchemeId($value)
return $this;
}

/**
* Get ProcessedWithNetworkToken
* Indicates whether the transaction was processed with a network token instead of raw card details
* @return bool
*/
public function getProcessedWithNetworkToken()
{
return $this->processedWithNetworkToken;
}

/**
* Set ProcessedWithNetworkToken
* Indicates whether the transaction was processed with a network token instead of raw card details
* @param bool $value
* @return $this
*/
public function setProcessedWithNetworkToken($value)
{
$this->processedWithNetworkToken = $value;
return $this;
}

/**
* Get PaymentType
* Payment type of the transaction
Expand Down Expand Up @@ -924,6 +980,9 @@ public function fillWithData($data)
if(! empty($data['error_code']))
$this->setErrorCode($data['error_code']);

if(! empty($data['error_message']))
$this->setErrorMessage($data['error_message']);

if(! empty($data['gateway_data']))
$this->setGatewayData($data['gateway_data']);

Expand All @@ -942,6 +1001,9 @@ public function fillWithData($data)
if(! empty($data['scheme_id']))
$this->setSchemeId($data['scheme_id']);

if(! empty($data['processed_with_network_token']))
$this->setProcessedWithNetworkToken($data['processed_with_network_token']);

if(! empty($data['payment_type']))
$this->setPaymentType($data['payment_type']);

Expand Down Expand Up @@ -981,12 +1043,14 @@ public function jsonSerialize() {
"gateway_operation_id" => $this->getGatewayOperationId(),
"arn" => $this->getArn(),
"error_code" => $this->getErrorCode(),
"error_message" => $this->getErrorMessage(),
"gateway_data" => $this->getGatewayData(),
"payment_data_three_d_s_request" => $this->getPaymentDataThreeDSRequest(),
"payment_data_three_d_s_authentication" => $this->getPaymentDataThreeDSAuthentication(),
"payment_data_network_authentication" => $this->getPaymentDataNetworkAuthentication(),
"initial_scheme_transaction_id" => $this->getInitialSchemeTransactionId(),
"scheme_id" => $this->getSchemeId(),
"processed_with_network_token" => $this->getProcessedWithNetworkToken(),
"payment_type" => $this->getPaymentType(),
"metadata" => $this->getMetadata(),
"gateway_fee" => $this->getGatewayFee(),
Expand Down