diff --git a/README.md b/README.md index 92b2c48..4585069 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Or require the Checkout.com package inside the composer.json of your project: ``` "require": { "php": ">=5.2.4", - "checkout/checkout-php-api": "1.2.11" + "checkout/checkout-php-api": "1.2.13" }, ``` __Manually__ diff --git a/com/checkout/ApiServices/Charges/ChargesMapper.php b/com/checkout/ApiServices/Charges/ChargesMapper.php index 652971e..395f601 100644 --- a/com/checkout/ApiServices/Charges/ChargesMapper.php +++ b/com/checkout/ApiServices/Charges/ChargesMapper.php @@ -45,12 +45,12 @@ public function requestPayloadConverter($requestModel = null ) if(method_exists($requestModel,'getEmail') && $requestModel->getEmail()) { $requestPayload['email'] = $requestModel->getEmail(); } - - if(method_exists($requestModel,'getCustomerName') && $requestModel->getCustomerName()) { + + if(method_exists($requestModel,'getCustomerName') && $requestModel->getCustomerName()) { $requestPayload['customerName'] = $requestModel->getCustomerName(); } - - if(method_exists($requestModel,'getCustomerId') && $requestModel->getCustomerId()) { + + if(method_exists($requestModel,'getCustomerId') && $requestModel->getCustomerId()) { $requestPayload['customerId'] = $requestModel->getCustomerId(); } @@ -65,19 +65,27 @@ public function requestPayloadConverter($requestModel = null ) if(method_exists($requestModel,'getDescription') && $requestModel->getDescription()) { $requestPayload['description'] = $requestModel->getDescription(); } - - if(method_exists($requestModel,'getChargeMode') && $requestModel->getChargeMode()) { - $requestPayload['chargeMode'] = $requestModel->getChargeMode(); - } + + if(method_exists($requestModel,'getChargeMode') && $requestModel->getChargeMode()) { + $requestPayload['chargeMode'] = $requestModel->getChargeMode(); + } - if(method_exists($requestModel,'getRiskCheck') && $requestModel->getRiskCheck()) { - $requestPayload['riskCheck'] = $requestModel->getRiskCheck(); - } + if(method_exists($requestModel,'getRiskCheck') && $requestModel->getRiskCheck()) { + $requestPayload['riskCheck'] = $requestModel->getRiskCheck(); + } if(method_exists($requestModel,'getAttemptN3D') && $requestModel->getAttemptN3D()) { $requestPayload['attemptN3D'] = $requestModel->getAttemptN3D(); } + if(method_exists($requestModel,'getSuccessUrl') && $requestModel->getSuccessUrl()) { + $requestPayload['successUrl'] = $requestModel->getSuccessUrl(); + } + + if(method_exists($requestModel,'getFailUrl') && $requestModel->getFailUrl()) { + $requestPayload['failUrl'] = $requestModel->getFailUrl(); + } + if(method_exists($requestModel,'getChargeId') && $requestModel->getChargeId()) { $requestPayload['chargeId'] = $requestModel->getChargeId(); } @@ -123,17 +131,17 @@ public function requestPayloadConverter($requestModel = null ) $requestPayload['descriptor'] = $descriptorConfig; } - if(method_exists($requestModel,'getAutoCapTime') && $autoCapTime = $requestModel->getAutoCapTime()) { - $requestPayload['autoCapTime'] = $autoCapTime; - } + if(method_exists($requestModel,'getAutoCapTime') && $autoCapTime = $requestModel->getAutoCapTime()) { + $requestPayload['autoCapTime'] = $autoCapTime; + } - if(method_exists($requestModel,'getAutoCapture') && $autoCapture = $requestModel->getAutoCapture()) { - $requestPayload['autoCapture'] = $autoCapture; - } + if(method_exists($requestModel,'getAutoCapture') && $autoCapture = $requestModel->getAutoCapture()) { + $requestPayload['autoCapture'] = $autoCapture; + } - if(method_exists($requestModel,'getTransactionIndicator') && $transactionIndicator = $requestModel->getTransactionIndicator()) { - $requestPayload['transactionIndicator'] = $transactionIndicator; - } + if(method_exists($requestModel,'getTransactionIndicator') && $transactionIndicator = $requestModel->getTransactionIndicator()) { + $requestPayload['transactionIndicator'] = $transactionIndicator; + } if( method_exists($requestModel,'getShippingDetails') && $shippingAddress = $requestModel->getShippingDetails()) { $shippingAddressConfig = array ( @@ -145,37 +153,37 @@ public function requestPayloadConverter($requestModel = null ) 'state' => $shippingAddress->getState () , ); - - if ($shippingAddress->getPhone() != null) { - $shippingAddressConfig = array_merge_recursive($shippingAddressConfig, array( - 'phone' => $shippingAddress->getPhone()->getPhoneDetails() - ) - ); - } + + if ($shippingAddress->getPhone() != null) { + $shippingAddressConfig = array_merge_recursive($shippingAddressConfig, array( + 'phone' => $shippingAddress->getPhone()->getPhoneDetails() + ) + ); + } - $requestPayload['shippingDetails'] = $shippingAddressConfig; + $requestPayload['shippingDetails'] = $shippingAddressConfig; } if (method_exists($requestModel, 'getBillingDetails') && $billingAddress = $requestModel->getBillingDetails()) { - $billingAddressConfig = array( - 'addressLine1' => $billingAddress->getAddressLine1(), - 'addressLine2' => $billingAddress->getAddressLine2(), - 'postcode' => $billingAddress->getPostcode(), - 'country' => $billingAddress->getCountry(), - 'city' => $billingAddress->getCity(), - 'state' => $billingAddress->getState(), - ); - - if ($billingAddress->getPhone() != null) { - $billingAddressConfig = array_merge_recursive($billingAddressConfig, array( - 'phone' => $billingAddress->getPhone()->getPhoneDetails() - ) - ); - } - - $requestPayload['billingDetails'] = $billingAddressConfig; - } + $billingAddressConfig = array( + 'addressLine1' => $billingAddress->getAddressLine1(), + 'addressLine2' => $billingAddress->getAddressLine2(), + 'postcode' => $billingAddress->getPostcode(), + 'country' => $billingAddress->getCountry(), + 'city' => $billingAddress->getCity(), + 'state' => $billingAddress->getState(), + ); + + if ($billingAddress->getPhone() != null) { + $billingAddressConfig = array_merge_recursive($billingAddressConfig, array( + 'phone' => $billingAddress->getPhone()->getPhoneDetails() + ) + ); + } + + $requestPayload['billingDetails'] = $billingAddressConfig; + } if(method_exists($requestModel,'getProducts') && $productsItem = $requestModel->getProducts()) { @@ -226,13 +234,13 @@ public function requestPayloadConverter($requestModel = null ) 'city' => $billingAddress->getCity () , 'state' => $billingAddress->getState () , ); - if($billingAddress->getPhone () != null){ - $billingAddressConfig = array_merge_recursive ( $billingAddressConfig , - array ( - 'phone' => $billingAddress->getPhone()->getPhoneDetails() - ) - ); - } + if($billingAddress->getPhone () != null){ + $billingAddressConfig = array_merge_recursive ( $billingAddressConfig , + array ( + 'phone' => $billingAddress->getPhone()->getPhoneDetails() + ) + ); + } $requestPayload[ 'card' ][ 'billingDetails' ] = $billingAddressConfig; } @@ -260,8 +268,8 @@ public function requestPayloadConverter($requestModel = null ) if(method_exists($requestModel,'getCardId') && $cardId = $requestModel->getCardId()) { $requestPayload[ 'cardId' ] = $cardId; } - - if(method_exists($requestModel,'getCvv') && $cvv = $requestModel->getCvv()) { + + if(method_exists($requestModel,'getCvv') && $cvv = $requestModel->getCvv()) { $requestPayload[ 'cvv' ] = $cvv; } @@ -274,50 +282,50 @@ public function requestPayloadConverter($requestModel = null ) } if(method_exists($requestModel,'getPaymentPlans') ) { - $paymentPlans = $requestModel->getPaymentPlans(); + $paymentPlans = $requestModel->getPaymentPlans(); - foreach($paymentPlans as $singlePlan) { + foreach($paymentPlans as $singlePlan) { - $requestSinglePaymentPlan = array(); + $requestSinglePaymentPlan = array(); - if (method_exists($singlePlan, 'getName') && ($name = $singlePlan->getName())) { - $requestSinglePaymentPlan['name'] = $name; - } + if (method_exists($singlePlan, 'getName') && ($name = $singlePlan->getName())) { + $requestSinglePaymentPlan['name'] = $name; + } - if (method_exists($singlePlan, 'getPlanTrackId') && ($planTrackId = $singlePlan->getPlanTrackId())) { - $requestSinglePaymentPlan['planTrackId'] = $planTrackId; - } + if (method_exists($singlePlan, 'getPlanTrackId') && ($planTrackId = $singlePlan->getPlanTrackId())) { + $requestSinglePaymentPlan['planTrackId'] = $planTrackId; + } - if (method_exists($singlePlan, 'getAutoCapTime') && ($autoCapTime = $singlePlan->getAutoCapTime())) { - $requestSinglePaymentPlan['autoCapTime'] = $autoCapTime; - } + if (method_exists($singlePlan, 'getAutoCapTime') && ($autoCapTime = $singlePlan->getAutoCapTime())) { + $requestSinglePaymentPlan['autoCapTime'] = $autoCapTime; + } - if (method_exists($singlePlan, 'getCurrency') && ($currency = $singlePlan->getCurrency())) { - $requestSinglePaymentPlan['currency'] = $currency; - } + if (method_exists($singlePlan, 'getCurrency') && ($currency = $singlePlan->getCurrency())) { + $requestSinglePaymentPlan['currency'] = $currency; + } - if (method_exists($singlePlan, 'getValue') && ($value = $singlePlan->getValue())) { - $requestSinglePaymentPlan['value'] = $value; - } - if (method_exists($singlePlan, 'getCycle') && ($cycle = $singlePlan->getCycle())) { - $requestSinglePaymentPlan['cycle'] = $cycle; - } + if (method_exists($singlePlan, 'getValue') && ($value = $singlePlan->getValue())) { + $requestSinglePaymentPlan['value'] = $value; + } + if (method_exists($singlePlan, 'getCycle') && ($cycle = $singlePlan->getCycle())) { + $requestSinglePaymentPlan['cycle'] = $cycle; + } - if (method_exists($singlePlan, 'getRecurringCount') && ($recurringCount = $singlePlan->getRecurringCount())) { - $requestSinglePaymentPlan['recurringCount'] = $recurringCount; - } + if (method_exists($singlePlan, 'getRecurringCount') && ($recurringCount = $singlePlan->getRecurringCount())) { + $requestSinglePaymentPlan['recurringCount'] = $recurringCount; + } - if (method_exists($singlePlan, 'getPlanId') && ($planId = $singlePlan->getPlanId())) { - $requestSinglePaymentPlan['planId'] = $planId; - } + if (method_exists($singlePlan, 'getPlanId') && ($planId = $singlePlan->getPlanId())) { + $requestSinglePaymentPlan['planId'] = $planId; + } - if (method_exists($singlePlan, 'getStartDate') && ($startDate = $singlePlan->getStartDate())) { - $requestSinglePaymentPlan['startDate'] = $startDate; - } + if (method_exists($singlePlan, 'getStartDate') && ($startDate = $singlePlan->getStartDate())) { + $requestSinglePaymentPlan['startDate'] = $startDate; + } - $requestPayload['paymentPlans'][] = $requestSinglePaymentPlan; - } - } + $requestPayload['paymentPlans'][] = $requestSinglePaymentPlan; + } + } } diff --git a/com/checkout/ApiServices/Charges/RequestModels/BaseCharge.php b/com/checkout/ApiServices/Charges/RequestModels/BaseCharge.php index 2e372ea..1ada72c 100644 --- a/com/checkout/ApiServices/Charges/RequestModels/BaseCharge.php +++ b/com/checkout/ApiServices/Charges/RequestModels/BaseCharge.php @@ -18,6 +18,8 @@ class BaseCharge extends BaseChargeInfo protected $_riskCheck; protected $_attemptN3D; protected $_billingDetails; + protected $_successUrl; + protected $_failUrl; /** * @return mixed @@ -235,16 +237,43 @@ public function getAttemptN3D() return $this->_attemptN3D; } - /** + /** * @param mixed billingDetails */ - public function setBillingDetails( $billingDetails) - { - $this->_billingDetails= $billingDetails; - } + public function setBillingDetails( $billingDetails) + { + $this->_billingDetails= $billingDetails; + } - public function getBillingDetails() - { - return $this->_billingDetails; - } + public function getBillingDetails() + { + return $this->_billingDetails; + } + + /** + * @param mixed $successUrl + */ + public function setSuccessUrl( $successUrl) + { + $this->_successUrl= $successUrl; + } + + public function getSuccessUrl() + { + return $this->_successUrl; + } + + /** + * @param mixed $failUrl + */ + public function setFailUrl( $failUrl) + { + $this->_failUrl= $failUrl; + } + + public function getFailUrl() + { + return $this->_failUrl; + } + } \ No newline at end of file diff --git a/com/checkout/packages/CheckoutApi/Client/Constant.php b/com/checkout/packages/CheckoutApi/Client/Constant.php index 5a9c8ea..d6521e2 100644 --- a/com/checkout/packages/CheckoutApi/Client/Constant.php +++ b/com/checkout/packages/CheckoutApi/Client/Constant.php @@ -24,5 +24,5 @@ final class CheckoutApi_Client_Constant const VERSION = 'v2'; const STATUS_CAPTURE = 'Captured'; const STATUS_REFUND = 'Refunded'; - const LIB_VERSION = 'v1.2.12'; + const LIB_VERSION = 'v1.2.13'; } diff --git a/composer.json b/composer.json index 4ebed41..2178d78 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "checkout/checkout-php-api", "description": "Checkout PHP API Library", "homepage": "https://github.com/checkout/checkout-php-library", - "version": "1.2.12", + "version": "1.2.13", "type": "library", "license": "MIT", "keywords": ["checkout.com","payment","gateway","online payment","checkoutcom","GW3","CKO"],