Code Duplication    Length = 7-7 lines in 2 locations

code/services/RefundService.php 1 location

@@ 41-47 (lines=7) @@
38
				$this->payment->Status = 'Refunded';
39
				$gatewayresponse->setMessage('Payment refunded');
40
				$this->payment->extend('onRefunded', $gatewayresponse);
41
			} else {
42
				//handle error
43
				$this->createMessage('RefundError', $response);
44
				$gatewayresponse->setMessage(
45
					"Error (".$response->getCode()."): ".$response->getMessage()
46
				);
47
			}
48
			$this->payment->write();
49
			$gatewayresponse->setOmnipayResponse($response);
50
		} catch (Omnipay\Common\Exception\OmnipayException $e) {

code/services/PurchaseService.php 1 location

@@ 90-96 (lines=7) @@
87
				$this->payment->Status = 'Authorized';
88
				$this->payment->write();
89
				$gatewayresponse->setMessage("Redirecting to gateway");
90
			} else {
91
				//handle error
92
				$this->createMessage('PurchaseError', $response);
93
				$gatewayresponse->setMessage(
94
					"Error (".$response->getCode()."): ".$response->getMessage()
95
				);
96
			}
97
		} catch (Omnipay\Common\Exception\OmnipayException $e) {
98
			$this->createMessage('PurchaseError', $e);
99
			$gatewayresponse->setMessage($e->getMessage());