1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-18 19:40:55 +01:00

Make Phortune checkout UI a little less bad

Summary: Ref T2787. There were some mega-uggo buttons and such; reduce the uggo-ness by a hair.

Test Plan: {F179686}

Reviewers: btrahan, chad

Reviewed By: chad

Subscribers: epriestley

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D10006
This commit is contained in:
epriestley 2014-07-23 10:36:37 -07:00
parent d6eb1c67e7
commit 9a892dd906
8 changed files with 63 additions and 62 deletions

View file

@ -84,7 +84,7 @@ return array(
'rsrc/css/application/pholio/pholio-inline-comments.css' => '8e545e49',
'rsrc/css/application/pholio/pholio.css' => '47dffb9c',
'rsrc/css/application/phortune/phortune-credit-card-form.css' => 'b25b4beb',
'rsrc/css/application/phortune/phortune.css' => '012360a6',
'rsrc/css/application/phortune/phortune.css' => '9149f103',
'rsrc/css/application/phrequent/phrequent.css' => 'ffc185ad',
'rsrc/css/application/phriction/phriction-document-css.css' => '7d7f0071',
'rsrc/css/application/policy/policy-edit.css' => '05cca26a',
@ -767,7 +767,7 @@ return array(
'pholio-inline-comments-css' => '8e545e49',
'phortune-credit-card-form' => '2290aeef',
'phortune-credit-card-form-css' => 'b25b4beb',
'phortune-css' => '012360a6',
'phortune-css' => '9149f103',
'phrequent-css' => 'ffc185ad',
'phriction-document-css' => '7d7f0071',
'phui-action-header-view-css' => '83e2cc86',

View file

@ -146,6 +146,13 @@ final class PhortuneCartCheckoutController
$viewer);
}
$one_time_options = phutil_tag(
'div',
array(
'class' => 'phortune-payment-onetime-list',
),
$one_time_options);
$provider_form = new PHUIFormLayoutView();
$provider_form->appendChild(
id(new AphrontFormMarkupControl())

View file

@ -181,7 +181,37 @@ abstract class PhortunePaymentProvider {
PhortuneAccount $account,
PhortuneCart $cart,
PhabricatorUser $user) {
throw new PhortuneNotImplementedException($this);
require_celerity_resource('phortune-css');
$icon_uri = $this->getPaymentMethodIcon();
$description = $this->getPaymentMethodProviderDescription();
$details = $this->getPaymentMethodDescription();
$icon = id(new PHUIIconView())
->setImage($icon_uri)
->addClass('phortune-payment-icon');
$button = id(new PHUIButtonView())
->setSize(PHUIButtonView::BIG)
->setColor(PHUIButtonView::GREY)
->setIcon($icon)
->setText($description)
->setSubtext($details);
$uri = $this->getControllerURI(
'checkout',
array(
'cartID' => $cart->getID(),
));
return phabricator_form(
$user,
array(
'action' => $uri,
'method' => 'POST',
),
$button);
}

View file

@ -17,18 +17,17 @@ final class PhortunePaypalPaymentProvider extends PhortunePaymentProvider {
}
public function getPaymentMethodDescription() {
return 'Paypal Account';
return pht('Credit Card or Paypal Account');
}
public function getPaymentMethodIcon() {
return 'rsrc/phortune/paypal.png';
return celerity_get_resource_uri('rsrc/image/phortune/paypal.png');
}
public function getPaymentMethodProviderDescription() {
return 'Paypal';
}
public function canHandlePaymentMethod(PhortunePaymentMethod $method) {
$type = $method->getMetadataValue('type');
return ($type == 'paypal');
@ -58,33 +57,6 @@ final class PhortunePaypalPaymentProvider extends PhortunePaymentProvider {
return true;
}
public function renderOneTimePaymentButton(
PhortuneAccount $account,
PhortuneCart $cart,
PhabricatorUser $user) {
$uri = $this->getControllerURI(
'checkout',
array(
'cartID' => $cart->getID(),
));
return phabricator_form(
$user,
array(
'action' => $uri,
'method' => 'POST',
),
phutil_tag(
'button',
array(
'class' => 'green',
'type' => 'submit',
),
pht('Pay with Paypal')));
}
/* -( Controllers )-------------------------------------------------------- */

View file

@ -22,14 +22,13 @@ final class PhortuneWePayPaymentProvider extends PhortunePaymentProvider {
}
public function getPaymentMethodIcon() {
return 'rsrc/phortune/wepay.png';
return celerity_get_resource_uri('/rsrc/image/phortune/wepay.png');
}
public function getPaymentMethodProviderDescription() {
return 'WePay';
}
public function canHandlePaymentMethod(PhortunePaymentMethod $method) {
$type = $method->getMetadataValue('type');
return ($type == 'wepay');
@ -64,32 +63,6 @@ final class PhortuneWePayPaymentProvider extends PhortunePaymentProvider {
return true;
}
public function renderOneTimePaymentButton(
PhortuneAccount $account,
PhortuneCart $cart,
PhabricatorUser $user) {
$uri = $this->getControllerURI(
'checkout',
array(
'cartID' => $cart->getID(),
));
return phabricator_form(
$user,
array(
'action' => $uri,
'method' => 'POST',
),
phutil_tag(
'button',
array(
'class' => 'green',
'type' => 'submit',
),
pht('Pay with WePay')));
}
/* -( Controllers )-------------------------------------------------------- */

View file

@ -47,6 +47,15 @@ final class PhortunePaymentMethodQuery
}
protected function willFilterPage(array $methods) {
foreach ($methods as $key => $method) {
try {
$method->buildPaymentProvider();
} catch (Exception $ex) {
unset($methods[$key]);
continue;
}
}
$accounts = id(new PhortuneAccountQuery())
->setViewer($this->getViewer())
->withPHIDs(mpull($methods, 'getAccountPHID'))

View file

@ -48,7 +48,8 @@ final class PhortunePaymentMethod extends PhortuneDAO
}
public function getDescription() {
return '...';
$provider = $this->buildPaymentProvider();
return $provider->getPaymentMethodProviderDescription();
}
public function getMetadataValue($key, $default = null) {

View file

@ -15,3 +15,12 @@
margin: 4px 0;
width: 100%;
}
.phortune-payment-onetime-list {
width: 280px;
}
.phortune-payment-onetime-list button {
margin: 0 0 8px 0;
width: 100%;
}