Code Duplication    Length = 8-8 lines in 2 locations

code/services/PurchaseService.php 2 locations

@@ 65-72 (lines=8) @@
62
				$this->payment->Status = 'Authorized';
63
				$this->payment->write();
64
				$gatewayresponse->setMessage("Manual payment authorised");
65
			} elseif ($response->isSuccessful()) {
66
				//successful payment
67
				$this->createMessage('PurchasedResponse', $response);
68
				$this->payment->Status = 'Captured';
69
				$gatewayresponse->setMessage("Payment successful");
70
				$this->payment->write();
71
				$this->payment->extend('onCaptured', $gatewayresponse);
72
			} elseif ($response->isRedirect()) {
73
				// redirect to off-site payment gateway
74
				$this->createMessage('PurchaseRedirectResponse', $response);
75
				$this->payment->Status = 'Authorized';
@@ 120-127 (lines=8) @@
117
		try {
118
			$response = $this->response = $request->send();
119
			$gatewayresponse->setOmnipayResponse($response);
120
			if ($response->isSuccessful()) {
121
				$this->createMessage('PurchasedResponse', $response);
122
				$this->payment->Status = 'Captured';
123
				$this->payment->write();
124
				$this->payment->extend('onCaptured', $gatewayresponse);
125
			} else {
126
				$this->createMessage('CompletePurchaseError', $response);
127
			}
128
		} catch (Omnipay\Common\Exception\OmnipayException $e) {
129
			$this->createMessage("CompletePurchaseError", $e);
130
		}