|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Braintree; |
| 4 | + |
| 5 | +/** |
| 6 | + * Provides a fluent interface to build requests for creating Bank Account Instant Verification JWTs. |
| 7 | + */ |
| 8 | +class BankAccountInstantVerificationJwtRequest |
| 9 | +{ |
| 10 | + private $_businessName; |
| 11 | + private $_returnUrl; |
| 12 | + private $_cancelUrl; |
| 13 | + |
| 14 | + /** |
| 15 | + * Sets the officially registered business name for the merchant. |
| 16 | + * |
| 17 | + * @param string $businessName the business name |
| 18 | + * |
| 19 | + * @return BankAccountInstantVerificationJwtRequest |
| 20 | + */ |
| 21 | + public function businessName($businessName) |
| 22 | + { |
| 23 | + $this->_businessName = $businessName; |
| 24 | + return $this; |
| 25 | + } |
| 26 | + |
| 27 | + /** |
| 28 | + * Sets the URL to redirect the consumer after successful account selection. |
| 29 | + * |
| 30 | + * @param string $returnUrl the return URL |
| 31 | + * |
| 32 | + * @return BankAccountInstantVerificationJwtRequest |
| 33 | + */ |
| 34 | + public function returnUrl($returnUrl) |
| 35 | + { |
| 36 | + $this->_returnUrl = $returnUrl; |
| 37 | + return $this; |
| 38 | + } |
| 39 | + |
| 40 | + /** |
| 41 | + * Sets the URL to redirect the consumer upon cancellation of the Open Banking flow. |
| 42 | + * |
| 43 | + * @param string $cancelUrl the cancel URL |
| 44 | + * |
| 45 | + * @return BankAccountInstantVerificationJwtRequest |
| 46 | + */ |
| 47 | + public function cancelUrl($cancelUrl) |
| 48 | + { |
| 49 | + $this->_cancelUrl = $cancelUrl; |
| 50 | + return $this; |
| 51 | + } |
| 52 | + |
| 53 | + |
| 54 | + /** |
| 55 | + * Gets the business name. |
| 56 | + * |
| 57 | + * @return string |
| 58 | + */ |
| 59 | + public function getBusinessName() |
| 60 | + { |
| 61 | + return $this->_businessName; |
| 62 | + } |
| 63 | + |
| 64 | + /** |
| 65 | + * Gets the return URL. |
| 66 | + * |
| 67 | + * @return string |
| 68 | + */ |
| 69 | + public function getReturnUrl() |
| 70 | + { |
| 71 | + return $this->_returnUrl; |
| 72 | + } |
| 73 | + |
| 74 | + /** |
| 75 | + * Gets the cancel URL. |
| 76 | + * |
| 77 | + * @return string |
| 78 | + */ |
| 79 | + public function getCancelUrl() |
| 80 | + { |
| 81 | + return $this->_cancelUrl; |
| 82 | + } |
| 83 | + |
| 84 | + |
| 85 | + /** |
| 86 | + * Converts the request to GraphQL variables format |
| 87 | + * |
| 88 | + * @return array |
| 89 | + */ |
| 90 | + public function toGraphQLVariables() |
| 91 | + { |
| 92 | + $variables = []; |
| 93 | + $input = []; |
| 94 | + |
| 95 | + if ($this->_businessName !== null) { |
| 96 | + $input['businessName'] = $this->_businessName; |
| 97 | + } |
| 98 | + if ($this->_returnUrl !== null) { |
| 99 | + $input['returnUrl'] = $this->_returnUrl; |
| 100 | + } |
| 101 | + if ($this->_cancelUrl !== null) { |
| 102 | + $input['cancelUrl'] = $this->_cancelUrl; |
| 103 | + } |
| 104 | + |
| 105 | + $variables['input'] = $input; |
| 106 | + return $variables; |
| 107 | + } |
| 108 | +} |
0 commit comments