Skip to content

Commit

Permalink
fix: fund wallet examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Justintime50 committed Jun 4, 2024
1 parent 695d10d commit 37d687c
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 49 deletions.
8 changes: 2 additions & 6 deletions official/docs/golang/current/billing/fund.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package example

import (
"fmt"

"github.com/EasyPost/easypost-go/v4"
"github.com/EasyPost/easypost-go/v3"
)

func main() {
client := easypost.New("EASYPOST_API_KEY")

fund := client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)

fmt.Println(fund)
client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)
}
6 changes: 1 addition & 5 deletions official/docs/golang/v2/billing/fund.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package example

import (
"fmt"

"github.com/EasyPost/easypost-go/v2"
)

func main() {
client := easypost.New("EASYPOST_API_KEY")

fund := client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)

fmt.Println(fund)
client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)
}
6 changes: 1 addition & 5 deletions official/docs/golang/v3/billing/fund.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package example

import (
"fmt"

"github.com/EasyPost/easypost-go/v3"
)

func main() {
client := easypost.New("EASYPOST_API_KEY")

fund := client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)

fmt.Println(fund)
client.FundWallet("2000", easypost.PrimaryPaymentMethodPriority)
}
2 changes: 1 addition & 1 deletion official/docs/ruby/current/users/update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

retrieved_user = client.user.retrieve_me

user = client.user.update(retrieved_user.id, name: 'New Name')
user = client.user.update(retrieved_user.id, recharge_amount: '50.00')

puts user
4 changes: 1 addition & 3 deletions official/docs/ruby/v4/billing/fund.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@

EasyPost.api_key = 'EASYPOST_API_KEY'

success = EasyPost::Billing.fund('2000', 'primary')

puts success
EasyPost::Billing.fund_wallet('2000', 'primary')
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
const Easypost = require('@easypost/api');
const api = new Easypost('<YOUR_PRODUCTION_API_KEY>');
const EasyPostClient = require('@easypost/api');

// If no user id is passed in, the user returned is the owner of the api key.
api.User.retrieve('user_...').then((u) => {
u.recharge_threshold = '50.00';
u.save().catch(console.error);
});
const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
let user;
user = client.User.retrieveMe();
user = client.User.update(user.id, { recharge_threshold: '50.00' });
console.log(user);
})();
9 changes: 6 additions & 3 deletions official/guides/partner-white-label-guide/node/fund-wallet.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const Easypost = require('@easypost/api');
const api = new Easypost('<YOUR_PRODUCTION_API_KEY>');
const EasyPostClient = require('@easypost/api');

api.Billing.fund('2000', 'primary').then(console.log);
const client = new EasyPostClient('EASYPOST_API_KEY');

(async () => {
client.Billing.fundWallet('2000', 'primary');
})();
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<?php

\EasyPost\EasyPost::setApiKey("<YOUR_PRODUCTION_API_KEY>");
$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY');

$me = \EasyPost\User::retrieve_me();
$me->recharge_threshold = "50.00";
$me->save();
$user = $client->user->retrieveMe();

$updatedUser = $client->user->update(
$user->id,
['recharge_threshold' => '50.00']
);

echo $updatedUser;
7 changes: 4 additions & 3 deletions official/guides/partner-white-label-guide/php/fund-wallet.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require_once("../lib/easypost.php");
\EasyPost\EasyPost::setApiKey("<YOUR_PRODUCTION_API_KEY>");
<?php

$success = Billing::fund_wallet(2000, 'primary');
$client = new \EasyPost\EasyPostClient('EASYPOST_API_KEY');

$client->billing->fundWallet(2000, 'primary');
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import easypost

easypost.api_key = "<YOUR_PRODUCTION_API_KEY>"
client = easypost.EasyPostClient("EASYPOST_API_KEY")

me = easypost.User.retrieve()
me.recharge_threshold = "50.00"
me.save()
user = client.user.retrieve_me()

updated_user = client.user.update(user.id, recharge_threshold="50.00")

print(updated_user)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import easypost

easypost.api_key = "<YOUR_PRODUCTION_API_KEY>"
client = easypost.EasyPostClient("EASYPOST_API_KEY")

success = easypost.Billing.fund_wallet(
client.billing.fund_wallet(
amount="2000",
primary_or_secondary="primary",
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
require 'easypost'
EasyPost.api_key = '<YOUR_PRODUCTION_API_KEY>'

me = EasyPost::User.retrieve_me
me.recharge_threshold = '50.00'
me.save
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')

retrieved_user = client.user.retrieve_me

user = client.user.update(retrieved_user.id, recharge_amount: '50.00')

puts user
5 changes: 3 additions & 2 deletions official/guides/partner-white-label-guide/ruby/fund-wallet.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'easypost'
EasyPost.api_key = '<YOUR_PRODUCTION_API_KEY>'

EasyPost::Billing.fund('2000', 'primary')
client = EasyPost::Client.new(api_key: 'EASYPOST_API_KEY')

client.billing.fund_wallet('2000', 'primary')

0 comments on commit 37d687c

Please sign in to comment.