Page MenuHomePhabricator

D10006.diff
No OneTemporary

D10006.diff

diff --git a/resources/celerity/map.php b/resources/celerity/map.php
--- a/resources/celerity/map.php
+++ b/resources/celerity/map.php
@@ -84,7 +84,7 @@
'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 @@
'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',
diff --git a/src/applications/phortune/controller/PhortuneCartCheckoutController.php b/src/applications/phortune/controller/PhortuneCartCheckoutController.php
--- a/src/applications/phortune/controller/PhortuneCartCheckoutController.php
+++ b/src/applications/phortune/controller/PhortuneCartCheckoutController.php
@@ -146,6 +146,13 @@
$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())
diff --git a/src/applications/phortune/provider/PhortunePaymentProvider.php b/src/applications/phortune/provider/PhortunePaymentProvider.php
--- a/src/applications/phortune/provider/PhortunePaymentProvider.php
+++ b/src/applications/phortune/provider/PhortunePaymentProvider.php
@@ -181,7 +181,37 @@
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);
}
diff --git a/src/applications/phortune/provider/PhortunePaypalPaymentProvider.php b/src/applications/phortune/provider/PhortunePaypalPaymentProvider.php
--- a/src/applications/phortune/provider/PhortunePaypalPaymentProvider.php
+++ b/src/applications/phortune/provider/PhortunePaypalPaymentProvider.php
@@ -17,18 +17,17 @@
}
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 @@
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 )-------------------------------------------------------- */
diff --git a/src/applications/phortune/provider/PhortuneWePayPaymentProvider.php b/src/applications/phortune/provider/PhortuneWePayPaymentProvider.php
--- a/src/applications/phortune/provider/PhortuneWePayPaymentProvider.php
+++ b/src/applications/phortune/provider/PhortuneWePayPaymentProvider.php
@@ -22,14 +22,13 @@
}
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 @@
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 )-------------------------------------------------------- */
diff --git a/src/applications/phortune/query/PhortunePaymentMethodQuery.php b/src/applications/phortune/query/PhortunePaymentMethodQuery.php
--- a/src/applications/phortune/query/PhortunePaymentMethodQuery.php
+++ b/src/applications/phortune/query/PhortunePaymentMethodQuery.php
@@ -47,6 +47,15 @@
}
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'))
diff --git a/src/applications/phortune/storage/PhortunePaymentMethod.php b/src/applications/phortune/storage/PhortunePaymentMethod.php
--- a/src/applications/phortune/storage/PhortunePaymentMethod.php
+++ b/src/applications/phortune/storage/PhortunePaymentMethod.php
@@ -48,7 +48,8 @@
}
public function getDescription() {
- return '...';
+ $provider = $this->buildPaymentProvider();
+ return $provider->getPaymentMethodProviderDescription();
}
public function getMetadataValue($key, $default = null) {
diff --git a/webroot/rsrc/css/application/phortune/phortune.css b/webroot/rsrc/css/application/phortune/phortune.css
--- a/webroot/rsrc/css/application/phortune/phortune.css
+++ b/webroot/rsrc/css/application/phortune/phortune.css
@@ -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%;
+}

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 28, 2:29 PM (3 w, 7 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6733973
Default Alt Text
D10006.diff (7 KB)

Event Timeline