Code Duplication    Length = 8-8 lines in 2 locations

code/services/PurchaseService.php 2 locations

@@ 77-84 (lines=8) @@
74
				$this->payment->Status = 'Authorized';
75
				$this->payment->write();
76
				$gatewayresponse->setMessage("Manual payment authorised");
77
			} elseif ($response->isSuccessful()) {
78
				//successful payment
79
				$this->createMessage('PurchasedResponse', $response);
80
				$this->payment->Status = 'Captured';
81
				$gatewayresponse->setMessage("Payment successful");
82
				$this->payment->write();
83
				$this->payment->extend('onCaptured', $gatewayresponse);
84
			} elseif ($response->isRedirect()) {
85
				// redirect to off-site payment gateway
86
				$this->createMessage('PurchaseRedirectResponse', $response);
87
				$this->payment->Status = 'Authorized';
@@ 134-141 (lines=8) @@
131
			$response = $this->response = $request->send();
132
            $this->extend('onAfterSendCompletePurchase', $request, $response);
133
			$gatewayresponse->setOmnipayResponse($response);
134
			if ($response->isSuccessful()) {
135
				$this->createMessage('PurchasedResponse', $response);
136
				$this->payment->Status = 'Captured';
137
				$this->payment->write();
138
				$this->payment->extend('onCaptured', $gatewayresponse);
139
			} else {
140
				$this->createMessage('CompletePurchaseError', $response);
141
			}
142
		} catch (Omnipay\Common\Exception\OmnipayException $e) {
143
			$this->createMessage("CompletePurchaseError", $e);
144
		}