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

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