| @@ 267-283 (lines=17) @@ | ||
| 264 | VenmoAccount::factory($response['venmoAccount']), |
|
| 265 | "paymentMethod" |
|
| 266 | ); |
|
| 267 | } else if (isset($response['paymentMethodNonce'])) { |
|
| 268 | return new Result\Successful( |
|
| 269 | PaymentMethodNonce::factory($response['paymentMethodNonce']), |
|
| 270 | "paymentMethodNonce" |
|
| 271 | ); |
|
| 272 | } else if (isset($response['apiErrorResponse'])) { |
|
| 273 | return new Result\Error($response['apiErrorResponse']); |
|
| 274 | } else if (is_array($response)) { |
|
| 275 | return new Result\Successful( |
|
| 276 | UnknownPaymentMethod::factory($response), |
|
| 277 | "paymentMethod" |
|
| 278 | ); |
|
| 279 | } else { |
|
| 280 | throw new Exception\Unexpected( |
|
| 281 | 'Expected payment method or apiErrorResponse' |
|
| 282 | ); |
|
| 283 | } |
|
| 284 | } |
|
| 285 | ||
| 286 | /** |
|
| @@ 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'); |
|