[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhortuneTestPaymentProvider extends PhortunePaymentProvider { 4 5 public function isAcceptingLivePayments() { 6 return false; 7 } 8 9 public function getName() { 10 return pht('Test Payments'); 11 } 12 13 public function getConfigureName() { 14 return pht('Test Payments'); 15 } 16 17 public function getConfigureDescription() { 18 return pht( 19 'Adds a test provider to allow you to test payments. This allows '. 20 'users to make purchases by clicking a button without actually paying '. 21 'any money.'); 22 } 23 24 public function getConfigureProvidesDescription() { 25 return pht('This merchant accepts test payments.'); 26 } 27 28 public function getConfigureInstructions() { 29 return pht('This providers does not require any special configuration.'); 30 } 31 32 public function canRunConfigurationTest() { 33 return false; 34 } 35 36 public function getPaymentMethodDescription() { 37 return pht('Add Mountain of Virtual Wealth'); 38 } 39 40 public function getPaymentMethodIcon() { 41 return 'TestPayment'; 42 } 43 44 public function getPaymentMethodProviderDescription() { 45 return pht('Infinite Free Money'); 46 } 47 48 public function getDefaultPaymentMethodDisplayName( 49 PhortunePaymentMethod $method) { 50 return pht('Vast Wealth'); 51 } 52 53 protected function executeCharge( 54 PhortunePaymentMethod $payment_method, 55 PhortuneCharge $charge) { 56 return; 57 } 58 59 protected function executeRefund( 60 PhortuneCharge $charge, 61 PhortuneCharge $refund) { 62 return; 63 } 64 65 public function updateCharge(PhortuneCharge $charge) { 66 return; 67 } 68 69 public function getAllConfigurableProperties() { 70 return array(); 71 } 72 73 public function getAllConfigurableSecretProperties() { 74 return array(); 75 } 76 77 public function processEditForm( 78 AphrontRequest $request, 79 array $values) { 80 81 $errors = array(); 82 $issues = array(); 83 $values = array(); 84 85 return array($errors, $issues, $values); 86 } 87 88 public function extendEditForm( 89 AphrontRequest $request, 90 AphrontFormView $form, 91 array $values, 92 array $issues) { 93 return; 94 } 95 96 97 98 /* -( Adding Payment Methods )--------------------------------------------- */ 99 100 101 public function canCreatePaymentMethods() { 102 return true; 103 } 104 105 106 public function translateCreatePaymentMethodErrorCode($error_code) { 107 return $error_code; 108 } 109 110 111 public function getCreatePaymentMethodErrorMessage($error_code) { 112 return null; 113 } 114 115 116 public function validateCreatePaymentMethodToken(array $token) { 117 return true; 118 } 119 120 121 public function createPaymentMethodFromRequest( 122 AphrontRequest $request, 123 PhortunePaymentMethod $method, 124 array $token) { 125 126 $method 127 ->setExpires('2050', '01') 128 ->setBrand('FreeMoney') 129 ->setLastFourDigits('9999') 130 ->setMetadata( 131 array( 132 'type' => 'test.wealth', 133 )); 134 135 return array(); 136 } 137 138 139 /** 140 * @task addmethod 141 */ 142 public function renderCreatePaymentMethodForm( 143 AphrontRequest $request, 144 array $errors) { 145 146 $ccform = id(new PhortuneCreditCardForm()) 147 ->setUser($request->getUser()) 148 ->setErrors($errors); 149 150 Javelin::initBehavior( 151 'test-payment-form', 152 array( 153 'formID' => $ccform->getFormID(), 154 )); 155 156 return $ccform->buildForm(); 157 } 158 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |