• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Braintree_Http类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Braintree_Http的典型用法代码示例。如果您正苦于以下问题:PHP Braintree_Http类的具体用法?PHP Braintree_Http怎么用?PHP Braintree_Http使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Braintree_Http类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: testAuthorizationWithConfig

 function testAuthorizationWithConfig()
 {
     $config = new Braintree_Configuration(array('environment' => 'development', 'merchant_id' => 'integration_merchant_id', 'publicKey' => 'badPublicKey', 'privateKey' => 'badPrivateKey'));
     $http = new Braintree_Http($config);
     $result = $http->_doUrlRequest('GET', $config->baseUrl() . '/merchants/integration_merchant_id/customers');
     $this->assertEquals(401, $result['status']);
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:7,代码来源:HttpTest.php


示例2: createGrant

 public static function createGrant($gateway, $params)
 {
     $http = new Braintree_Http($gateway->config);
     $http->useClientCredentials();
     $response = $http->post('/oauth_testing/grants', array('grant' => $params));
     return $response['grant']['code'];
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:7,代码来源:OAuthTestHelper.php


示例3: testAll_returnsAllPlans

 function testAll_returnsAllPlans()
 {
     $newId = strval(rand());
     $params = array("id" => $newId, "billingDayOfMonth" => "1", "billingFrequency" => "1", "currencyIsoCode" => "USD", "description" => "some description", "name" => "php test plan", "numberOfBillingCycles" => "1", "price" => "1.00", "trialDuration" => "3", "trialDurationUnit" => "day", "trialPeriod" => "true");
     Braintree_Http::post("/plans/create_plan_for_tests", array("plan" => $params));
     $addOnParams = array("kind" => "add_on", "plan_id" => $newId, "amount" => "1.00", "name" => "add_on_name");
     Braintree_Http::post("/modifications/create_modification_for_tests", array("modification" => $addOnParams));
     $discountParams = array("kind" => "discount", "plan_id" => $newId, "amount" => "1.00", "name" => "discount_name");
     Braintree_Http::post("/modifications/create_modification_for_tests", array("modification" => $discountParams));
     $plans = Braintree_Plan::all();
     foreach ($plans as $plan) {
         if ($plan->id == $newId) {
             $actualPlan = $plan;
         }
     }
     $this->assertNotNull($actualPlan);
     $this->assertEquals($params["billingDayOfMonth"], $actualPlan->billingDayOfMonth);
     $this->assertEquals($params["billingFrequency"], $actualPlan->billingFrequency);
     $this->assertEquals($params["currencyIsoCode"], $actualPlan->currencyIsoCode);
     $this->assertEquals($params["description"], $actualPlan->description);
     $this->assertEquals($params["name"], $actualPlan->name);
     $this->assertEquals($params["numberOfBillingCycles"], $actualPlan->numberOfBillingCycles);
     $this->assertEquals($params["price"], $actualPlan->price);
     $this->assertEquals($params["trialDuration"], $actualPlan->trialDuration);
     $this->assertEquals($params["trialDurationUnit"], $actualPlan->trialDurationUnit);
     $this->assertEquals($params["trialPeriod"], $actualPlan->trialPeriod);
     $addOn = $actualPlan->addOns[0];
     $this->assertEquals($addOnParams["name"], $addOn->name);
     $discount = $actualPlan->discounts[0];
     $this->assertEquals($discountParams["name"], $discount->name);
 }
开发者ID:rayku,项目名称:rayku,代码行数:31,代码来源:PlanTest.php


示例4: all

 public static function all()
 {
     $response = Braintree_Http::get('/plans');
     if (key_exists('plans', $response)) {
         $plans = array("plan" => $response['plans']);
     } else {
         $plans = array("plan" => array());
     }
     return Braintree_Util::extractAttributeAsArray($plans, 'plan');
 }
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:10,代码来源:Plan.php


示例5: search

 public static function search($query)
 {
     $criteria = array();
     foreach ($query as $term) {
         $criteria[$term->name] = $term->toparam();
     }
     $response = Braintree_Http::post('/verifications/advanced_search_ids', array('search' => $criteria));
     $pager = array('className' => __CLASS__, 'classMethod' => 'fetch', 'methodArgs' => array($query));
     return new Braintree_ResourceCollection($response, $pager);
 }
开发者ID:othreed,项目名称:osCommerce-234-bootstrap-wADDONS,代码行数:10,代码来源:CreditCardVerification.php


示例6: testGatewayAll_returnsAllAddOns

 function testGatewayAll_returnsAllAddOns()
 {
     $newId = strval(rand());
     $addOnParams = array("amount" => "100.00", "description" => "some description", "id" => $newId, "kind" => "add_on", "name" => "php_add_on", "neverExpires" => "false", "numberOfBillingCycles" => "1");
     $http = new Braintree_Http(Braintree_Configuration::$global);
     $path = Braintree_Configuration::$global->merchantPath() . "/modifications/create_modification_for_tests";
     $http->post($path, array("modification" => $addOnParams));
     $gateway = new Braintree_Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key'));
     $addOns = $gateway->addOn()->all();
     foreach ($addOns as $addOn) {
         if ($addOn->id == $newId) {
             $actualAddOn = $addOn;
         }
     }
     $this->assertNotNull($actualAddOn);
     $this->assertEquals($addOnParams["amount"], $actualAddOn->amount);
     $this->assertEquals($addOnParams["description"], $actualAddOn->description);
     $this->assertEquals($addOnParams["id"], $actualAddOn->id);
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:19,代码来源:AddOnsTest.php


示例7: testSandboxSSL

 function testSandboxSSL()
 {
     try {
         Braintree_Configuration::environment('sandbox');
         $this->setExpectedException('Braintree_Exception_Authentication');
         Braintree_Http::get('/');
     } catch (Exception $e) {
         Braintree_Configuration::environment('development');
         throw $e;
     }
     Braintree_Configuration::environment('development');
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:12,代码来源:HttpTest.php


示例8: testSslError

 function testSslError()
 {
     try {
         Braintree_Configuration::environment('sandbox');
         $this->setExpectedException('Braintree_Exception_SSLCertificate');
         //ip address of api.braintreegateway.com
         Braintree_Http::_doUrlRequest('get', '204.109.13.121');
     } catch (Exception $e) {
         Braintree_Configuration::environment('development');
         throw $e;
     }
     Braintree_Configuration::environment('development');
 }
开发者ID:kingsj,项目名称:shopping-cart-lite,代码行数:13,代码来源:HttpTest.php


示例9: generate

 public static function generate($settlement_date, $groupByCustomField = NULL)
 {
     $criteria = array('settlement_date' => $settlement_date);
     if (isset($groupByCustomField)) {
         $criteria['group_by_custom_field'] = $groupByCustomField;
     }
     $params = array('settlement_batch_summary' => $criteria);
     $response = Braintree_Http::post('/settlement_batch_summary', $params);
     if (isset($groupByCustomField)) {
         $response['settlementBatchSummary']['records'] = self::_underscoreCustomField($groupByCustomField, $response['settlementBatchSummary']['records']);
     }
     return self::_verifyGatewayResponse($response);
 }
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:13,代码来源:SettlementBatchSummary.php


示例10: testGatewayAll_returnsAllPlans

 function testGatewayAll_returnsAllPlans()
 {
     $newId = strval(rand());
     $params = array("id" => $newId, "billingDayOfMonth" => "1", "billingFrequency" => "1", "currencyIsoCode" => "USD", "description" => "some description", "name" => "php test plan", "numberOfBillingCycles" => "1", "price" => "1.00", "trialPeriod" => "false");
     $http = new Braintree_Http(Braintree_Configuration::$global);
     $path = Braintree_Configuration::$global->merchantPath() . "/plans/create_plan_for_tests";
     $http->post($path, array("plan" => $params));
     $gateway = new Braintree_Gateway(array('environment' => 'development', 'merchantId' => 'integration_merchant_id', 'publicKey' => 'integration_public_key', 'privateKey' => 'integration_private_key'));
     $plans = $gateway->plan()->all();
     foreach ($plans as $plan) {
         if ($plan->id == $newId) {
             $actualPlan = $plan;
         }
     }
     $this->assertNotNull($actualPlan);
     $this->assertEquals($params["billingDayOfMonth"], $actualPlan->billingDayOfMonth);
     $this->assertEquals($params["billingFrequency"], $actualPlan->billingFrequency);
     $this->assertEquals($params["currencyIsoCode"], $actualPlan->currencyIsoCode);
     $this->assertEquals($params["description"], $actualPlan->description);
     $this->assertEquals($params["name"], $actualPlan->name);
     $this->assertEquals($params["numberOfBillingCycles"], $actualPlan->numberOfBillingCycles);
     $this->assertEquals($params["price"], $actualPlan->price);
 }
开发者ID:beevo,项目名称:disruptivestrong,代码行数:23,代码来源:PlanTest.php


示例11: testSearch_daysPastDue

 function testSearch_daysPastDue()
 {
     $creditCard = Braintree_SubscriptionTestHelper::createCreditCard();
     $triallessPlan = Braintree_SubscriptionTestHelper::triallessPlan();
     $subscription = Braintree_Subscription::create(array('paymentMethodToken' => $creditCard->token, 'planId' => $triallessPlan['id']))->subscription;
     Braintree_Http::put('/subscriptions/' . $subscription->id . '/make_past_due', array('daysPastDue' => 5));
     $found = false;
     $collection = Braintree_Subscription::search(array(Braintree_SubscriptionSearch::daysPastDue()->between(2, 10)));
     foreach ($collection as $item) {
         $found = true;
         $this->assertTrue($item->daysPastDue <= 10);
         $this->assertTrue($item->daysPastDue >= 2);
     }
     $this->assertTrue($found);
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:15,代码来源:SubscriptionSearchTest.php


示例12: testAll_returnsAllDiscounts

 function testAll_returnsAllDiscounts()
 {
     $newId = strval(rand());
     $discountParams = array("amount" => "100.00", "description" => "some description", "id" => $newId, "kind" => "discount", "name" => "php_discount", "neverExpires" => "false", "numberOfBillingCycles" => "1");
     Braintree_Http::post("/modifications/create_modification_for_tests", array("modification" => $discountParams));
     $discounts = Braintree_Discount::all();
     foreach ($discounts as $discount) {
         if ($discount->id == $newId) {
             $actualDiscount = $discount;
         }
     }
     $this->assertNotNull($actualDiscount);
     $this->assertEquals($discountParams["amount"], $actualDiscount->amount);
     $this->assertEquals($discountParams["description"], $actualDiscount->description);
     $this->assertEquals($discountParams["id"], $actualDiscount->id);
     $this->assertEquals($discountParams["kind"], $actualDiscount->kind);
     $this->assertEquals($discountParams["name"], $actualDiscount->name);
     $this->assertFalse($actualDiscount->neverExpires);
     $this->assertEquals($discountParams["numberOfBillingCycles"], $actualDiscount->numberOfBillingCycles);
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:20,代码来源:DiscountTest.php


示例13: escrow

 public static function escrow($transactionId)
 {
     Braintree_Http::put('/transactions/' . $transactionId . '/escrow');
 }
开发者ID:anmolview,项目名称:yiidemos,代码行数:4,代码来源:TestHelper.php


示例14: _doUpdate

 private static function _doUpdate($url, $params)
 {
     $response = Braintree_Http::put($url, $params);
     return self::_verifyGatewayResponse($response);
 }
开发者ID:bobstermyang,项目名称:communityfoodshare,代码行数:5,代码来源:MerchantAccount.php


示例15: delete

 public static function delete($token)
 {
     self::_validateId($token);
     Braintree_Http::delete('/payment_methods/paypal_account/' . $token);
     return new Braintree_Result_Successful();
 }
开发者ID:kingsj,项目名称:shopping-cart-lite,代码行数:6,代码来源:PayPalAccount.php


示例16: testRetryCharge_WithAmount

 function testRetryCharge_WithAmount()
 {
     $subscription = Braintree_SubscriptionTestHelper::createSubscription();
     $http = new Braintree_Http(Braintree_Configuration::$global);
     $path = Braintree_Configuration::$global->merchantPath() . '/subscriptions/' . $subscription->id . '/make_past_due';
     $http->put($path);
     $result = Braintree_Subscription::retryCharge($subscription->id, 1000);
     $this->assertTrue($result->success);
     $transaction = $result->transaction;
     $this->assertEquals(1000, $transaction->amount);
     $this->assertNotNull($transaction->processorAuthorizationCode);
     $this->assertEquals(Braintree_Transaction::SALE, $transaction->type);
     $this->assertEquals(Braintree_Transaction::AUTHORIZED, $transaction->status);
 }
开发者ID:buga1234,项目名称:buga_segforours,代码行数:14,代码来源:SubscriptionTest.php


示例17: test_rangeNode_settledAt

 function test_rangeNode_settledAt()
 {
     $transaction = Braintree_Transaction::saleNoValidate(array('amount' => '1000.00', 'creditCard' => array('number' => '4111111111111111', 'expirationDate' => '05/12'), 'options' => array('submitForSettlement' => true)));
     Braintree_Http::put('/transactions/' . $transaction->id . '/settle');
     $transaction = Braintree_Transaction::find($transaction->id);
     $twenty_min_ago = date_create("now -20 minutes", new DateTimeZone("UTC"));
     $ten_min_ago = date_create("now -10 minutes", new DateTimeZone("UTC"));
     $ten_min_from_now = date_create("now +10 minutes", new DateTimeZone("UTC"));
     $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::id()->is($transaction->id), Braintree_TransactionSearch::settledAt()->between($twenty_min_ago, $ten_min_ago)));
     $this->assertEquals(0, $collection->maximumCount());
     $collection = Braintree_Transaction::search(array(Braintree_TransactionSearch::id()->is($transaction->id), Braintree_TransactionSearch::settledAt()->between($ten_min_ago, $ten_min_from_now)));
     $this->assertEquals(1, $collection->maximumCount());
     $this->assertEquals($transaction->id, $collection->firstItem()->id);
 }
开发者ID:kingsolmn,项目名称:CakePHP-Braintree-Plugin,代码行数:14,代码来源:TransactionAdvancedSearchTest.php


示例18: create3DSVerification

 public static function create3DSVerification($merchantAccountId, $params)
 {
     $http = new Braintree_Http(Braintree_Configuration::$global);
     $path = Braintree_Configuration::$global->merchantPath() . '/three_d_secure/create_verification/' . $merchantAccountId;
     $response = $http->post($path, array('threeDSecureVerification' => $params));
     return $response['threeDSecureVerification']['threeDSecureToken'];
 }
开发者ID:oscarsmartwave,项目名称:l45fbl45t,代码行数:7,代码来源:TestHelper.php


示例19: cancel

 public static function cancel($subscriptionId)
 {
     $response = Braintree_Http::put('/subscriptions/' . $subscriptionId . '/cancel');
     return self::_verifyGatewayResponse($response);
 }
开发者ID:agency2016,项目名称:rothy_cloudynote,代码行数:5,代码来源:Subscription.php


示例20: all

 public static function all()
 {
     $response = Braintree_Http::get('/plans');
     $plans = array("plan" => $response['plans']);
     return Braintree_Util::extractAttributeAsArray($plans, 'plan');
 }
开发者ID:technomagegithub,项目名称:inmed-magento,代码行数:6,代码来源:Plan.php



注:本文中的Braintree_Http类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Braintree_Subscription类代码示例发布时间:2022-05-23
下一篇:
PHP Braintree_Customer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap