Skip to content

Commit 546b43a

Browse files
authored
Merge pull request #33 from colbyalbo/master
Format app name for token label
2 parents 1d5fff2 + adeddab commit 546b43a

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ BITPAY_TOKEN=
5252
```
5353

5454
#### Add webhook event listener
55-
By default package is capable of handling of webhook requests. Bitpay payment status updates are completely based on webhooks. Whenever webhook is received from server, `BitpayWebhookReceived` event is dispatched. You just need to provide a listener for this event.
55+
By default, package is capable of handling of webhook requests. Bitpay payment status updates are completely based on webhooks. Whenever webhook is received from server, `BitpayWebhookReceived` event is dispatched. You just need to provide a listener for this event.
5656

5757
You can add your listener as below,
5858
```php
@@ -126,7 +126,7 @@ class EventServiceProvider extends ServiceProvider{
126126
+ SIN (Service Identification Number) for your client will be created to uniquely identify requests from your server.
127127
+ By using SIN **new Token and Pairing Code** will be created for your client on bitpay server and will be shown on your console output.
128128
+ Token will be used for all future request to bitpay and will automatically be copied to your `.env` file.
129-
+ Based on environment you set **TEST/LIVE**, command will provide URL to approve your client and you need to copy and search Pairing Code on bitpay server & approve it.
129+
+ Based on environment you set **TEST/LIVE**, command will provide URL to approve your client, and then you need to copy and search Pairing Code on bitpay server & approve it.
130130

131131
- You are all set. :golf:
132132

config/laravel-bitpay.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,28 @@
55
* This is the full path and name for the private key.
66
* The default value is /tmp/laravel-bitpay.pri
77
*/
8-
'private_key' => env('BITPAY_PRIVATE_KEY_PATH', '/tmp/laravel-bitpay.pri'),
8+
'private_key' => env('BITPAY_PRIVATE_KEY_PATH', '/tmp/laravel-bitpay.pri'),
99

1010
/*
1111
* This is the full path and name for the public key.
1212
* The default value is /tmp/laravel-bitpay.pub
1313
*/
14-
'public_key' => env('BITPAY_PUBLIC_KEY_PATH', '/tmp/laravel-bitpay.pub'),
14+
'public_key' => env('BITPAY_PUBLIC_KEY_PATH', '/tmp/laravel-bitpay.pub'),
1515

1616
/*
1717
* Specifies using the Live Bitcoin network or
1818
* Test Bitcoin network: livenet or testnet.
1919
*
2020
* The default is livenet
2121
*/
22-
'network' => env('BITPAY_NETWORK', 'livenet'),
22+
'network' => env('BITPAY_NETWORK', 'livenet'),
2323

2424
/*
2525
* The key_storage option allows you to specify a class for persisting and retrieving keys.
2626
*
2727
* By default this uses the Bitpay\Storage\EncryptedFilesystemStorage class.
2828
*/
29-
'key_storage' => \BitPayKeyUtils\Storage\EncryptedFilesystemStorage::class,
29+
'key_storage' => \BitPayKeyUtils\Storage\EncryptedFilesystemStorage::class,
3030

3131
/*
3232
* This is the password used to encrypt and decrypt keys on the filesystem.
@@ -36,5 +36,5 @@
3636
/*
3737
* BitPay Token
3838
*/
39-
'token' => env('BITPAY_TOKEN', ''),
39+
'token' => env('BITPAY_TOKEN', ''),
4040
];

src/Commands/CreateKeypair.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,16 +71,16 @@ public function handle()
7171

7272
$this->line('');
7373

74-
$this->line('<options=bold,underscore>Token</> - <options=bold;fg=green>'.$this->token.'</> //(Token copied to .env for you)');
75-
$this->line('<options=bold,underscore>Pairing code</> - <options=bold;fg=green>'.$this->pairingCode.'</>');
74+
$this->line('<options=bold,underscore>Token</> - <options=bold;fg=green>' . $this->token . '</> //(Token copied to .env for you)');
75+
$this->line('<options=bold,underscore>Pairing code</> - <options=bold;fg=green>' . $this->pairingCode . '</>');
7676

7777
$this->line('');
7878

7979
$this->line('Please, copy the above pairing code and approve on your BitPay Account at the following link:');
8080

8181
$this->line('');
8282

83-
$this->line('Open -> <href='.$this->network.'/dashboard/merchant/api-tokens>'.$this->network.'/dashboard/merchant/api-tokens</>');
83+
$this->line('Open -> <href=' . $this->network . '/dashboard/merchant/api-tokens>' . $this->network . '/dashboard/merchant/api-tokens</>');
8484

8585
$this->line('');
8686

@@ -110,7 +110,7 @@ public function createAndPersistKeypair()
110110
}
111111

112112
$this->bar->advance();
113-
$this->info(' - Using <options=bold;fg=red>'.get_class($this->storageEngine).'</> for secure storage.');
113+
$this->info(' - Using <options=bold;fg=red>' . get_class($this->storageEngine) . '</> for secure storage.');
114114

115115
$this->storageEngine->persist($this->privateKey);
116116

@@ -144,17 +144,17 @@ public function pairWithServerAndCreateToken()
144144
$this->info(' - Connecting Bitpay server 🖥️ and generating token & pairing code.');
145145

146146
try {
147-
$this->pairingCodeLabel = config('app.name').'_BitPay_Client';
147+
$this->pairingCodeLabel = ucwords(str_replace(" ", "_", config('app.name'))) . '_BitPay_Client';
148148
$postData = [
149-
'id' => (string) $this->sin,
149+
'id' => (string)$this->sin,
150150
'label' => $this->pairingCodeLabel,
151151
'facade' => 'merchant',
152152
];
153153
$response = $bitpayClient->post('/tokens', [
154154
'json' => $postData,
155155
'headers' => [
156156
'x-accept-version' => '2.0.0',
157-
'Content-Type' => 'application/json',
157+
'Content-Type' => 'application/json',
158158
// Todo: If added below headers, bitpay responds with error, "This endpoint does not support the `user` facade"
159159
// 'x-identity' => $this->publicKey->__toString(),
160160
// 'x-signature' => $this->privateKey->sign($this->network.'/tokens'.json_encode($postData)),

0 commit comments

Comments
 (0)