Update with the API in the main project
This commit is contained in:
		@@ -65,7 +65,7 @@ repository.
 | 
			
		||||
            return "Pending, Reference: ". $response->getTransactionReference();
 | 
			
		||||
        } else {
 | 
			
		||||
            // payment failed: display message to customer
 | 
			
		||||
            return "Error " .$response->getCode() . ': ' . $response->getMessage();
 | 
			
		||||
            return "Error " .$response->getError();
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        /**
 | 
			
		||||
@@ -74,10 +74,9 @@ repository.
 | 
			
		||||
        // Check the status
 | 
			
		||||
        $response = $gateway->completePurchase()->send();
 | 
			
		||||
        if ($response->isSuccessful()) {
 | 
			
		||||
            $reference = $response->getTransactionReference();  // TODO; Check the reference/id with your database
 | 
			
		||||
            return "Transaction '" . $response->getTransactionId() . "' succeeded!";
 | 
			
		||||
            $transaction = $response->getTransaction();
 | 
			
		||||
        } else {
 | 
			
		||||
            return "Error " .$response->getCode() . ': ' . $response->getMessage();
 | 
			
		||||
            return "Error " .$response->getError();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
```
 | 
			
		||||
 
 | 
			
		||||
@@ -16,4 +16,9 @@ abstract class AbstractResponse extends BaseAbstractResponse
 | 
			
		||||
            $this->error = (string) $this->data->error;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getError()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->error;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ class CompletePurchaseRequest extends AbstractRequest
 | 
			
		||||
    protected function generateSignature()
 | 
			
		||||
    {
 | 
			
		||||
        return sha1(
 | 
			
		||||
            $this->getTransactionReference() . $this->getClientId() . $this->getClientSecret()
 | 
			
		||||
            $this->getTransactionReference() . $this->getClientSecret()
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -20,14 +20,13 @@ class CompletePurchaseRequest extends AbstractRequest
 | 
			
		||||
 | 
			
		||||
    public function getData()
 | 
			
		||||
    {
 | 
			
		||||
        $this->validate('merchantId', 'merchantKey');
 | 
			
		||||
 | 
			
		||||
        $data = array(
 | 
			
		||||
            "clientId" => $this->getClientId(),
 | 
			
		||||
            "clientSecret" => $this->getClientSecret(),
 | 
			
		||||
            "transactionId" => $this->getTransactionReference(),
 | 
			
		||||
            "sha1" => $this->generateSignature()
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return $data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function sendData($data)
 | 
			
		||||
 
 | 
			
		||||
@@ -14,8 +14,8 @@ class CompletePurchaseResponse extends PurchaseResponse
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function getStatus()
 | 
			
		||||
    public function getTransaction()
 | 
			
		||||
    {
 | 
			
		||||
        return $this->data->transaction->status;
 | 
			
		||||
        return $this->data->transaction;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ class PurchaseRequest extends AbstractRequest
 | 
			
		||||
    protected function generateSignature()
 | 
			
		||||
    {
 | 
			
		||||
        return sha1(
 | 
			
		||||
            $this->getTransactionId() . $this->getAmountInteger() . $this->getClientId() . $this->getClientSecret()
 | 
			
		||||
            $this->getTransactionId() . $this->getAmountInteger() . $this->getClientSecret()
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -23,13 +23,14 @@ class PurchaseRequest extends AbstractRequest
 | 
			
		||||
 | 
			
		||||
        $data = array(
 | 
			
		||||
            "clientId" => $this->getClientId(),
 | 
			
		||||
            "clientSecret" => $this->getClientSecret(),
 | 
			
		||||
            "transactionId" => $this->getTransactionId(),
 | 
			
		||||
            "amount" => $this->getAmountInteger(),
 | 
			
		||||
            "description" => $this->getDescription(),
 | 
			
		||||
            "returnUrl" => $this->getReturnUrl(),
 | 
			
		||||
            "sha1" => $this->generateSignature()
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        return $data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function sendData($data)
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ class PurchaseResponse extends AbstractResponse implements RedirectResponseInter
 | 
			
		||||
 | 
			
		||||
    public function isRedirect()
 | 
			
		||||
    {
 | 
			
		||||
        return is_null($this->error);
 | 
			
		||||
        return is_null($this->getError());
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public function isPending()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user