Skip to content

Commit d57404a

Browse files
authoredFeb 10, 2022
Merge pull request #2 from digistorm/Custom-callback-urls
Custom callback urls
2 parents 34e259b + f60f7cc commit d57404a

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed
 

‎src/Gateway.php

+23
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public function getDefaultParameters()
5858
return array(
5959
'apiKey' => '',
6060
'username' => '',
61+
'callbackUrls' => [
62+
'approved' => 'http://example.com?status=approved',
63+
'declined' => 'http://example.com?status=declined',
64+
'cancelled' => 'http://example.com?status=cancelled',
65+
],
6166
);
6267
}
6368

@@ -79,6 +84,24 @@ public function setApiKey($value)
7984
return $this->setParameter('apiKey', $value);
8085
}
8186

87+
/**
88+
* Get Callback URLs associative array (approved, declined, cancelled)
89+
* @return array
90+
*/
91+
public function getCallbackUrls()
92+
{
93+
return $this->getParameter('callbackUrls');
94+
}
95+
96+
/**
97+
* Set Callback URLs associative array (approved, declined, cancelled)
98+
* @param array $value
99+
*/
100+
public function setCallbackUrls($value)
101+
{
102+
return $this->setParameter('callbackUrls', $value);
103+
}
104+
82105
/**
83106
* Get Merchant
84107
* @return string Merchant ID

‎src/Message/AbstractRequest.php

+18
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,24 @@ public function setApiKey($value)
4141
return $this->setParameter('apiKey', $value);
4242
}
4343

44+
/**
45+
* Get Callback URLs associative array (approved, declined, cancelled)
46+
* @return array
47+
*/
48+
public function getCallbackUrls()
49+
{
50+
return $this->getParameter('callbackUrls');
51+
}
52+
53+
/**
54+
* Set Callback URLs associative array (approved, declined, cancelled)
55+
* @param array $value
56+
*/
57+
public function setCallbackUrls($value)
58+
{
59+
return $this->setParameter('callbackUrls', $value);
60+
}
61+
4462
/**
4563
* Get Merchant
4664
* @return string Merchant ID

‎src/Message/CreateSessionRequest.php

+1-5
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,7 @@ public function getData()
2424
'currency' => $this->getCurrency(),
2525
'merchantReference' => substr($this->getMerchantReference(), 0, 64),
2626
'storeCard' => 0,
27-
'callbackUrls' => [
28-
'approved' => 'http://example.com?status=approved',
29-
'declined' => 'http://example.com?status=declined',
30-
'cancelled' => 'http://example.com?status=cancelled',
31-
],
27+
'callbackUrls' => $this->getCallbackUrls(),
3228
];
3329

3430
// Has the Money class been used to set the amount?

0 commit comments

Comments
 (0)