| @@ 197-212 (lines=16) @@ | ||
| 194 | */ |
|
| 195 | private function _verifyGatewayResponse($response) |
|
| 196 | { |
|
| 197 | if (isset($response['subscription'])) { |
|
| 198 | return new Result\Successful( |
|
| 199 | Subscription::factory($response['subscription']) |
|
| 200 | ); |
|
| 201 | } else if (isset($response['transaction'])) { |
|
| 202 | // return a populated instance of Transaction, for subscription retryCharge |
|
| 203 | return new Result\Successful( |
|
| 204 | Transaction::factory($response['transaction']) |
|
| 205 | ); |
|
| 206 | } else if (isset($response['apiErrorResponse'])) { |
|
| 207 | return new Result\Error($response['apiErrorResponse']); |
|
| 208 | } else { |
|
| 209 | throw new Exception\Unexpected( |
|
| 210 | "Expected subscription, transaction, or apiErrorResponse" |
|
| 211 | ); |
|
| 212 | } |
|
| 213 | } |
|
| 214 | } |
|
| 215 | class_alias('Braintree\SubscriptionGateway', 'Braintree_SubscriptionGateway'); |
|
| @@ 292-308 (lines=17) @@ | ||
| 289 | VenmoAccount::factory($response['venmoAccount']), |
|
| 290 | "paymentMethod" |
|
| 291 | ); |
|
| 292 | } else if (isset($response['paymentMethodNonce'])) { |
|
| 293 | return new Result\Successful( |
|
| 294 | PaymentMethodNonce::factory($response['paymentMethodNonce']), |
|
| 295 | "paymentMethodNonce" |
|
| 296 | ); |
|
| 297 | } else if (isset($response['apiErrorResponse'])) { |
|
| 298 | return new Result\Error($response['apiErrorResponse']); |
|
| 299 | } else if (is_array($response)) { |
|
| 300 | return new Result\Successful( |
|
| 301 | UnknownPaymentMethod::factory($response), |
|
| 302 | "paymentMethod" |
|
| 303 | ); |
|
| 304 | } else { |
|
| 305 | throw new Exception\Unexpected( |
|
| 306 | 'Expected payment method or apiErrorResponse' |
|
| 307 | ); |
|
| 308 | } |
|
| 309 | } |
|
| 310 | ||
| 311 | /** |
|