6
6
7
7
class Braintree extends \Signifyd \Models \Payment \AbstractGateway
8
8
{
9
- protected $ response = '' ;
9
+ protected $ response = [] ;
10
10
11
11
/**
12
12
* @var string[]
@@ -23,7 +23,7 @@ class Braintree extends \Signifyd\Models\Payment\AbstractGateway
23
23
*/
24
24
public function fetchData ($ transactionId , $ orderId )
25
25
{
26
- if (empty ($ this ->response ) ) {
26
+ if (isset ($ this ->response [ $ orderId ]) === false ) {
27
27
$ requestArr = [
28
28
'query ' => 'query Search($input: PaymentSearchInput!) {
29
29
search {
@@ -93,7 +93,7 @@ public function fetchData($transactionId, $orderId)
93
93
curl_close ($ ch );
94
94
95
95
$ info = json_decode (preg_replace ('/[\x00-\x1F\x80-\xFF]/ ' , '' , $ serverOutput ), true );
96
- $ this ->response = new BraintreeResponse ();
96
+ $ this ->response [ $ orderId ] = new BraintreeResponse ();
97
97
98
98
if (isset ($ info ['data ' ]) &&
99
99
isset ($ info ['data ' ]['search ' ]) &&
@@ -105,7 +105,7 @@ public function fetchData($transactionId, $orderId)
105
105
isset ($ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['last4 ' ])
106
106
) {
107
107
$ last4 = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['last4 ' ];
108
- $ this ->response ->setLast4 ($ last4 );
108
+ $ this ->response [ $ orderId ] ->setLast4 ($ last4 );
109
109
}
110
110
111
111
if (isset ($ info ['data ' ]) &&
@@ -119,7 +119,7 @@ public function fetchData($transactionId, $orderId)
119
119
120
120
) {
121
121
$ bin = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['bin ' ];
122
- $ this ->response ->setBin ($ bin );
122
+ $ this ->response [ $ orderId ] ->setBin ($ bin );
123
123
}
124
124
125
125
if (isset ($ info ['data ' ]) &&
@@ -133,7 +133,7 @@ public function fetchData($transactionId, $orderId)
133
133
134
134
) {
135
135
$ expirationMonth = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['expirationMonth ' ];
136
- $ this ->response ->setExpiryMonth ($ expirationMonth );
136
+ $ this ->response [ $ orderId ] ->setExpiryMonth ($ expirationMonth );
137
137
}
138
138
139
139
if (isset ($ info ['data ' ]) &&
@@ -147,7 +147,7 @@ public function fetchData($transactionId, $orderId)
147
147
148
148
) {
149
149
$ expirationYear = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['expirationYear ' ];
150
- $ this ->response ->setExpiryYear ($ expirationYear );
150
+ $ this ->response [ $ orderId ] ->setExpiryYear ($ expirationYear );
151
151
}
152
152
153
153
if (isset ($ info ['data ' ]) &&
@@ -160,7 +160,7 @@ public function fetchData($transactionId, $orderId)
160
160
isset ($ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['cardholderName ' ])
161
161
) {
162
162
$ cardholderName = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['paymentMethodSnapshot ' ]['cardholderName ' ];
163
- $ this ->response ->setCardholder ($ cardholderName );
163
+ $ this ->response [ $ orderId ] ->setCardholder ($ cardholderName );
164
164
}
165
165
166
166
if (isset ($ info ['data ' ]) &&
@@ -175,7 +175,7 @@ public function fetchData($transactionId, $orderId)
175
175
isset ($ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['statusHistory ' ][0 ]['processorResponse ' ]['cvvResponse ' ])
176
176
) {
177
177
$ cvvResponse = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['statusHistory ' ][0 ]['processorResponse ' ]['cvvResponse ' ];
178
- $ this ->response ->setCvv ($ cvvResponse );
178
+ $ this ->response [ $ orderId ] ->setCvv ($ cvvResponse );
179
179
}
180
180
181
181
if (isset ($ info ['data ' ]) &&
@@ -193,10 +193,10 @@ public function fetchData($transactionId, $orderId)
193
193
$ avsPostalCodeResponse = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['statusHistory ' ][0 ]['processorResponse ' ]['avsPostalCodeResponse ' ];
194
194
$ avsStreetAddressResponse = $ info ['data ' ]['search ' ]['payments ' ]['edges ' ][0 ]['node ' ]['statusHistory ' ][0 ]['processorResponse ' ]['avsStreetAddressResponse ' ];
195
195
196
- $ this ->response ->setAvsResponse ($ avsPostalCodeResponse , $ avsStreetAddressResponse );
196
+ $ this ->response [ $ orderId ] ->setAvsResponse ($ avsPostalCodeResponse , $ avsStreetAddressResponse );
197
197
}
198
198
}
199
199
200
- return $ this ->response ;
200
+ return $ this ->response [ $ orderId ] ;
201
201
}
202
202
}
0 commit comments