diff --git a/src/Omnipay/SagePay/Message/AbstractRequest.php b/src/Omnipay/SagePay/Message/AbstractRequest.php index cf6c2d2..b0a92a6 100644 --- a/src/Omnipay/SagePay/Message/AbstractRequest.php +++ b/src/Omnipay/SagePay/Message/AbstractRequest.php @@ -36,12 +36,76 @@ public function getService() return $this->action; } + /** + * Set the apply AVSCV2 checks. + * + * @param int $value 0: If AVS/CV2 enabled then check them. If rules apply, use rules. (default) + * 1: Force AVS/CV2 checks even if not enabled for the account. If rules apply + * use rules. + * 2: Force NO AVS/CV2 checks even if enabled on account. + * 3: Force AVS/CV2 checks even if not enabled for account but DON'T apply any + * rules. + */ + public function setApplyAVSCV2($value) + { + return $this->setParameter('applyAVSCV2', $value); + } + + public function getApplyAVSCV2() + { + return $this->getParameter('applyAVSCV2'); + } + + public function getAccountType() + { + return $this->getParameter('accountType'); + } + + /** + * Set account type. + * + * This is ignored for all PAYPAL transactions. + * + * @param string $value E: Use the e-commerce merchant account. (default) + * M: Use the mail/telephone order account. (if present) + * C: Use the continuous authority merchant account. (if present) + */ + public function setAccountType($value) + { + return $this->setParameter('accountType', $value); + } + + public function getApply3DSecure() + { + return $this->getParameter('apply3DSecure'); + } + + /** + * Whether or not to apply 3D secure authentication. + * + * This is ignored for PAYPAL, EUROPEAN PAYMENT transactions. + * + * @param int $value 0: If 3D-Secure checks are possible and rules allow, perform the + * checks and apply the authorisation rules. (default) + * 1: Force 3D-Secure checks for this transaction if possible and + * apply rules for authorisation. + * 2: Do not perform 3D-Secure checks for this transactios and always + * authorise. + * 3: Force 3D-Secure checks for this transaction if possible but ALWAYS + * obtain an auth code, irrespective of rule base. + */ + public function setApply3DSecure($value) + { + return $this->setParameter('apply3DSecure', $value); + } + protected function getBaseData() { $data = array(); $data['VPSProtocol'] = '2.23'; $data['TxType'] = $this->action; $data['Vendor'] = $this->getVendor(); + $data['AccountType'] = $this->getAccountType() ?: 'E'; return $data; } diff --git a/src/Omnipay/SagePay/Message/DirectAuthorizeRequest.php b/src/Omnipay/SagePay/Message/DirectAuthorizeRequest.php index 201f161..c27be93 100644 --- a/src/Omnipay/SagePay/Message/DirectAuthorizeRequest.php +++ b/src/Omnipay/SagePay/Message/DirectAuthorizeRequest.php @@ -24,8 +24,8 @@ protected function getBaseAuthorizeData() $data['Currency'] = $this->getCurrency(); $data['VendorTxCode'] = $this->getTransactionId(); $data['ClientIPAddress'] = $this->getClientIp(); - $data['ApplyAVSCV2'] = 0; // use account setting - $data['Apply3DSecure'] = 0; // use account setting + $data['ApplyAVSCV2'] = $this->getApplyAVSCV2() ?: 0; // use account setting + $data['Apply3DSecure'] = $this->getApply3DSecure() ?: 0; // use account setting // billing details $data['BillingFirstnames'] = $card->getFirstName();