Code Duplication    Length = 8-8 lines in 2 locations

code/services/PurchaseService.php 2 locations

@@ 83-90 (lines=8) @@
80
				$this->payment->Status = 'Authorized';
81
				$this->payment->write();
82
				$gatewayresponse->setMessage("Manual payment authorised");
83
			} elseif ($response->isSuccessful()) {
84
				//successful payment
85
				$this->createMessage('PurchasedResponse', $response);
86
				$this->payment->Status = 'Captured';
87
				$gatewayresponse->setMessage("Payment successful");
88
				$this->payment->write();
89
				$this->payment->extend('onCaptured', $gatewayresponse);
90
			} elseif ($response->isRedirect()) {
91
				// redirect to off-site payment gateway
92
				$this->createMessage('PurchaseRedirectResponse', $response);
93
				$this->payment->Status = 'Authorized';
@@ 140-147 (lines=8) @@
137
			$response = $this->response = $request->send();
138
            $this->extend('onAfterSendCompletePurchase', $request, $response);
139
			$gatewayresponse->setOmnipayResponse($response);
140
			if ($response->isSuccessful()) {
141
				$this->createMessage('PurchasedResponse', $response);
142
				$this->payment->Status = 'Captured';
143
				$this->payment->write();
144
				$this->payment->extend('onCaptured', $gatewayresponse);
145
			} else {
146
				$this->createMessage('CompletePurchaseError', $response);
147
			}
148
		} catch (Omnipay\Common\Exception\OmnipayException $e) {
149
			$this->createMessage("CompletePurchaseError", $e);
150
		}