@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Give Stripe complete payment workflow logic in Phortune

Summary:
Ref T2787. This basically already works correctly since the hard logic is external to the provider on API providers. Tweak a couple of things.

Failures still just fail the cart completely, for now.

Test Plan: Completed a charge with Stripe.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Maniphest Tasks: T2787

Differential Revision: https://secure.phabricator.com/D10640

+13 -4
+9 -1
src/applications/phortune/provider/PhortuneStripePaymentProvider.php
··· 39 39 40 40 /** 41 41 * @phutil-external-symbol class Stripe_Charge 42 + * @phutil-external-symbol class Stripe_CardError 42 43 */ 43 44 protected function executeCharge( 44 45 PhortunePaymentMethod $method, ··· 58 59 'capture' => true, 59 60 ); 60 61 61 - $stripe_charge = Stripe_Charge::create($params, $secret_key); 62 + try { 63 + $stripe_charge = Stripe_Charge::create($params, $secret_key); 64 + } catch (Stripe_CardError $ex) { 65 + // TODO: Fail charge explicitly. 66 + throw $ex; 67 + } 68 + 62 69 $id = $stripe_charge->id; 63 70 if (!$id) { 64 71 throw new Exception('Stripe charge call did not return an ID!'); 65 72 } 66 73 67 74 $charge->setMetadataValue('stripe.chargeID', $id); 75 + $charge->save(); 68 76 } 69 77 70 78 private function getPublishableKey() {
+4 -3
src/applications/phortune/provider/PhortuneWePayPaymentProvider.php
··· 163 163 'funding_sources' => 'bank,cc' 164 164 ); 165 165 166 - $cart->willApplyCharge($viewer, $this); 167 - 166 + $charge = $cart->willApplyCharge($viewer, $this); 168 167 $result = $wepay->request('checkout/create', $params); 169 168 170 169 $cart->setMetadataValue('provider.checkoutURI', $result->checkout_uri); 171 - $cart->setMetadataValue('wepay.checkoutID', $result->checkout_id); 172 170 $cart->save(); 171 + 172 + $charge->setMetadataValue('wepay.checkoutID', $result->checkout_id); 173 + $charge->save(); 173 174 174 175 $uri = new PhutilURI($result->checkout_uri); 175 176 return id(new AphrontRedirectResponse())