Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F97589125
PhortuneStripePaymentFormView.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Jan 5, 12:43
Size
3 KB
Mime Type
text/x-php
Expires
Tue, Jan 7, 12:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23431862
Attached To
rPH Phabricator
PhortuneStripePaymentFormView.php
View Options
<?php
final
class
PhortuneStripePaymentFormView
extends
AphrontView
{
private
$stripeKey
;
private
$cardNumberError
;
private
$cardCVCError
;
private
$cardExpirationError
;
public
function
setStripeKey
(
$key
)
{
$this
->
stripeKey
=
$key
;
return
$this
;
}
private
function
getStripeKey
()
{
return
$this
->
stripeKey
;
}
public
function
setCardNumberError
(
$error
)
{
$this
->
cardNumberError
=
$error
;
return
$this
;
}
private
function
getCardNumberError
()
{
return
$this
->
cardNumberError
;
}
public
function
setCardCVCError
(
$error
)
{
$this
->
cardCVCError
=
$error
;
return
$this
;
}
private
function
getCardCVCError
()
{
return
$this
->
cardCVCError
;
}
public
function
setCardExpirationError
(
$error
)
{
$this
->
cardExpirationError
=
$error
;
return
$this
;
}
private
function
getCardExpirationError
()
{
return
$this
->
cardExpirationError
;
}
public
function
render
()
{
$form_id
=
celerity_generate_unique_node_id
();
require_celerity_resource
(
'stripe-payment-form-css'
);
require_celerity_resource
(
'aphront-tooltip-css'
);
Javelin
::
initBehavior
(
'phabricator-tooltips'
);
$form
=
id
(
new
AphrontFormView
())
->
setID
(
$form_id
)
->
setUser
(
$this
->
getUser
())
->
appendChild
(
id
(
new
AphrontFormMarkupControl
())
->
setLabel
(
''
)
->
setValue
(
javelin_tag
(
'div'
,
array
(
'class'
=>
'credit-card-logos'
,
'sigil'
=>
'has-tooltip'
,
'meta'
=>
array
(
'tip'
=>
'We support Visa, Mastercard, American Express, '
.
'Discover, JCB, and Diners Club.'
,
'size'
=>
440
,
)
))))
->
appendChild
(
id
(
new
AphrontFormTextControl
())
->
setLabel
(
'Card Number'
)
->
setDisableAutocomplete
(
true
)
->
setSigil
(
'number-input'
)
->
setError
(
$this
->
getCardNumberError
()))
->
appendChild
(
id
(
new
AphrontFormTextControl
())
->
setLabel
(
'CVC'
)
->
setDisableAutocomplete
(
true
)
->
setSigil
(
'cvc-input'
)
->
setError
(
$this
->
getCardCVCError
()))
->
appendChild
(
id
(
new
PhortuneMonthYearExpiryControl
())
->
setLabel
(
'Expiration'
)
->
setUser
(
$this
->
getUser
())
->
setError
(
$this
->
getCardExpirationError
()))
->
appendChild
(
javelin_tag
(
'input'
,
array
(
'hidden'
=>
true
,
'name'
=>
'stripeToken'
,
'sigil'
=>
'stripe-token-input'
,
)))
->
appendChild
(
javelin_tag
(
'input'
,
array
(
'hidden'
=>
true
,
'name'
=>
'cardErrors'
,
'sigil'
=>
'card-errors-input'
)))
->
appendChild
(
phutil_tag
(
'input'
,
array
(
'hidden'
=>
true
,
'name'
=>
'stripeKey'
,
'value'
=>
$this
->
getStripeKey
(),
)))
->
appendChild
(
id
(
new
AphrontFormSubmitControl
())
->
setValue
(
'Add Payment Method'
));
Javelin
::
initBehavior
(
'stripe-payment-form'
,
array
(
'stripePublishKey'
=>
$this
->
getStripeKey
(),
'root'
=>
$form_id
,
));
return
$form
->
render
();
}
}
Event Timeline
Log In to Comment