Skip to content

Commit bd097c0

Browse files
authored
Merge pull request #40 from ashinzekene/release/3.0.0
v3.0.0
2 parents b11d994 + befb06a commit bd097c0

File tree

6 files changed

+99
-84
lines changed

6 files changed

+99
-84
lines changed

CHANGELOG.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
All notable changes to `angular-rave` will be documented here
44

5+
## 3.0.0 - 2020-09-14
56
### Changes
67
- `forRoot` configuration no longer accepts an object. Now accepts only the public key
78
- `PUBKey` now `public_key`
89
- Implemented updated `flutterwave's` inline script.
9-
- `Customization` and `customer` object
1010

1111
### Removed
12-
- Removed the `autoClose` option
12+
- `autoClose` option
1313

1414
### Fixed
15-
- No reload on successful transaction
16-
- Callback is now being called after a successful transaction
15+
- Reload on successful transaction
16+
- Callback not being called after a successful transaction
1717

1818
## 2.0.0 - 2019-10-19
1919
### Added

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,14 @@ Two projects exist in this repository
202202
- To build this project, run `npm run build angular-rave-lib`. The compiled files are built to the `docs` folder for GitHub Pages.
203203
- This project is also served on github pages at https://ashinzekene.github.io/angular-rave/
204204

205+
## Release
206+
- Checkout to a new release branch `release/new-version` eg `release/3.0.0`
207+
- cd into `projects/angular-rave`
208+
- Run `npm version patch|minor|major`
209+
- cd into the main directory and run `npm build`
210+
- Run `git add . && git commit -m new-version`
211+
- Run `git tag -a new-version "release notes..."`
212+
- cd into `dist/angular-rave` and run `npm publish`
205213

206214
Thanks!
207215
Ashinze Ekene.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"ng": "ng",
66
"start": "ng serve",
77
"prebuild": "node scripts/copy-artifacts.js",
8-
"build": "ng build",
8+
"build": "ng build --prod",
99
"test:watch": "ng test angular-rave",
1010
"test": "ng test angular-rave --watch=false --browsers=ChromeHeadless",
1111
"lint": "ng lint",

projects/angular-rave/CHANGELOG.md

+13
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
All notable changes to `angular-rave` will be documented here
44

5+
## 3.0.0 - 2020-09-14
6+
### Changes
7+
- `forRoot` configuration no longer accepts an object. Now accepts only the public key
8+
- `PUBKey` now `public_key`
9+
- Implemented updated `flutterwave's` inline script.
10+
11+
### Removed
12+
- `autoClose` option
13+
14+
### Fixed
15+
- Reload on successful transaction
16+
- Callback not being called after a successful transaction
17+
518
## 2.0.0 - 2019-10-19
619
### Added
720
- Module `forRoot` configuration

projects/angular-rave/README.md

+72-78
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@
66

77
You can checkout the demo [here](https://ashinzekene.github.io/angular-rave)
88

9-
### 1. INSTALL THE MODULE
9+
### 1. Install the module
1010

11-
Run
11+
Run this in the root of your angular project
1212
```bash
1313
npm install --save angular-rave
1414
```
15-
in the your angular project
1615

1716
### 2. Import the module into your project like so
1817

@@ -23,13 +22,11 @@ You can checkout the demo [here](https://ashinzekene.github.io/angular-rave)
2322

2423
@NgModlule({
2524
imports: [
26-
AngularRaveModule.forRoot({
27-
key: 'FLWPUBK-XXXXXXXXXXXXXXXXXXX',
28-
isTest: true,
29-
}),
25+
AngularRaveModule.forRoot('FLWPUBK-XXXXXXXXXXXXXXXXXXX'),
3026
]
3127
})
3228
```
29+
where `FLWPUBK-XXXXXXXXXXXXXXXXXXX` is your public key which can be found on the flutterwave dashboard
3330

3431
### 3. Implementing Angular-rave
3532

@@ -38,58 +35,52 @@ There are two option available
3835
- The `angular-rave` component:
3936
```html
4037
<angular-rave
41-
[customer_email] = "'user@example.com'"
42-
[customer_phone] = "'08090909090'"
38+
[customer]="{ email: 'user@example.com', phonenumber: '0809808800900' }"
4339
[amount]="500000"
44-
[custom_title]="'Bill Payment'"
45-
[txref]="'USR1295950'"
40+
[customizations]="{ title: 'Bill Payment' }"
41+
[tx_ref]="'USR1295950'"
4642
(callback)="paymentSuccess($event)"
4743
(close)="paymentFailure()"
48-
(close)="paymentInit()"
44+
(init)="paymentInit()"
4945
></angular-rave>
5046
```
5147

5248
2. The `angular-rave` directive:
5349
```html
5450
<button
5551
angular-rave
56-
[customer_email] = "'user@example.com'"
57-
[customer_phone] = "'08090909090'"
52+
[customer]="{ email: 'user@example.com', phonenumber: '0809808800900' }"
5853
[amount]="500000"
59-
[custom_title]="'Bill Payment'"
60-
[txref]="'USR1295950'"
54+
[customizations]="{ title: 'Bill Payment'}"
55+
[tx_ref]="'USR1295950'"
6156
(callback)="paymentSuccess($event)"
62-
(onclose)="paymentFailure()"
63-
(init)="paymentInit($event)"
57+
(close)="paymentFailure()"
58+
(init)="paymentInit()"
6459
>PAY NOW</button>
6560
```
6661
And then in your `component.ts` file:
6762

6863
```ts
6964
import { Component } from '@angular/core';
70-
import { PaymentInstance } from 'angular-rave';
65+
import { RavePaymentData } from 'angular-rave';
7166

7267
@Component({
7368
selector: 'app-root',
7469
templateUrl: './app.component.html',
7570
styleUrls: ['./app.component.css']
7671
})
7772
export class AppComponent {
78-
paymentInstance: PaymentInstance;
79-
token :string
80-
8173
paymentFailure() {
8274
console.log('Payment Failed');
8375
}
8476

85-
paymentSuccess(res) {
77+
paymentSuccess(res: RavePaymentData) {
8678
console.log('Payment complete', res);
87-
this.paymentInstance.close();
79+
// Verify the transaction
8880
}
8981

90-
paymentInit(paymentInstance) {
91-
this.paymentInstance = paymentInstance;
92-
console.log('Payment about to begin', paymentInstance);
82+
paymentInit() {
83+
console.log('Payment about to begin');
9384
}
9485
}
9586

@@ -101,36 +92,41 @@ You can also pass in an object containing your rave options like so
10192
```html
10293
<button
10394
angular-rave
104-
[raveOptions]="paymentOptions"
95+
[raveOptions]="raveOptions"
96+
(init)="paymentInit()"
97+
(callback)="paymentSuccess($event)"
98+
(onclose)="paymentFailure()"
10599
>
106-
PAY NOW
100+
Pay with Rave Directive
107101
</button>
102+
108103
```
109104
And then you can import the `RaveOptions` class for help in typing
110105
```ts
111106
import { RaveOptions } from 'angular-rave';
112107

113108
...
114-
paymentOptions: RaveOptions = {
115-
PBFPubKey: 'FLWPUBK-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
116-
customer_email: 'mailexample@mail.com',
117-
customer_firstname: 'Ashinze',
118-
customer_lastname: 'Ekene',
119-
custom_description: 'Payment for goods',
120-
amount: 500000,
121-
customer_phone: '09026464646',
122-
txref: 'a-unique-reference',
123-
}
109+
raveOptions: RaveOptions = {
110+
amount: 3000,
111+
customer: {
112+
email: 'user@ravemail.com',
113+
phonenumber: '09010910901',
114+
name: 'Ekene Ashinze',
115+
},
116+
customizations: {
117+
description: 'This is a flutterwave modal implemented using angular rave',
118+
title: 'Angular Rave',
119+
logo: 'https://angular.io/assets/images/logos/angular/angular.svg',
120+
},
121+
tx_ref: `${Math.random() * 1000000}`,
122+
};
124123
```
125-
126-
### Autoclose
127-
By default, you would have to call `paymentInstance.close()` to close the modal after a transaction is complete. You can pass in the `autoClose` boolean input to close the modal automatically after a transaction is completed. Use like so
128-
124+
And then in the template
129125
```html
130126
<button
131127
angular-rave
132128
[autoClose]="true"
133-
[raveOptions]="paymentOptions"
129+
[raveOptions]="raveOptions"
134130
>PAY NOW</button>
135131
```
136132

@@ -142,18 +138,15 @@ For example, if you have this is your module file
142138
```ts
143139
@NgModule({
144140
imports: [
145-
AngularRaveModule.forRoot({
146-
key: 'FLWPUBK-1000',
147-
isTest: true,
148-
}),
141+
AngularRaveModule.forRoot('FLWPUBK-1000'),
149142
]
150143
})
151144
```
152145
and this in your component
153146
```html
154147
<button
155148
angular-rave
156-
[PBFPubKey]="FLWPUBK-2000"
149+
[public_key]="FLWPUBK-2000"
157150
[raveOptions]="paymentOptions"
158151
>
159152
PAY NOW
@@ -164,38 +157,31 @@ Then `FLWPUBK-2000` would be used instead
164157
**NOTE:**
165158

166159
- When using the component, the rave's payment popup shows once the component is rendered while using the directive the popup shows on click
167-
- Always generate a unique reference for every transaction
160+
- Always generate a sensible unique reference for every transaction (unlike what I did up there 😉)
168161
- After successful payment always perform server verification
169162

170163
## OPTIONS
171164

172-
| Name | Type | Required | Default Value | Description |
173-
|-----------------------|------------ |------------------|:-------------:|--------------------------------------------------|
174-
PBFPubKey | string | true | - | Your merchant public key provided when you create a button.
175-
customer_email | string | true | - | ( if customer phone number is not passed ) Email of the customer.
176-
customer_phone | string | true | - | phone number of the customer.
177-
txref | string | true | - | Unique transaction reference provided by the merchant.
178-
amount | number | true | - | Amount to charge.
179-
integrity_hash | string | false | - | (temporarily) This is a sha256 hash of your getpaidSetup values, it is used for passing secured values to the payment gateway.
180-
payment_method | string | false | "both" | This allows you select the payment option you want for your users, possible values are card, account or both.
181-
payment_options | string | false | - | This allows you to select the payment option you want for your users. Possible values are: `'card'`, `'account'`, `'ussd'`. To use more than one option just add them as comma separated values without spaces e.g. `'card,account'`, `'card,account,qr'` etc.
182-
currency | string | false | "NGN" | currency to charge the card in.
183-
country | string | false | "NG" | route country.
184-
customer_firstname | string | false | - | firstname of the customer.
185-
customer_lastname | string | false | - | lastname of the customer.
186-
pay_button_text | string | false | - | Text to be displayed on the Rave Checkout Button.
187-
custom_title | string | false | - | Text to be displayed as the title of the payment modal.
188-
custom_description | string | false | - | Text to be displayed as a short modal description.
189-
redirect_url | string | false | - | URL to redirect to when transaction is completed.
190-
custom_logo | string | false | - | Link to your custom image.
191-
meta | object | false | - | Any other custom data you wish to pass. Eg- `[{ metaname: ‘flightid’, metavalue: ‘93849-MK5000’}]`
192-
onclose | function() | false | - | A function to be called when the pay modal is closed.
193-
callback | function(res) | true | - | A function to be called on successful card charge. User’s can always be redirected to a successful or failed page supplied by the merchant here based on response.
194-
subaccounts | []{id: string, transaction_split_ratio: string} | true | - | Subaccounts to add for split payments https://developer.flutterwave.com/v2.0/docs/split-payment
195-
init | function(res) | false | - | A function to be called when payment is about to begin
196-
autoClose | boolean | false | - | If true, the payment modal closes automatically after a transaction is completed
197-
198-
> You can get more information from [rave's documentation](https://flutterwavedevelopers.readme.io/)
165+
| Name | Type | Required | Default Value | Description |
166+
|-------------------------|---------------------------|-------------------|:---------------:|:--------------------------------------------------|
167+
| public_key | string | true | - | Merchant public key
168+
| tx_ref | string | true | - | Your transaction reference. This MUST be unique for every transaction
169+
| amount | number | true | - | Amount to charge the customer.
170+
| currency | string | false | 'NGN' | currency to charge in. Defaults to 'NGN'
171+
| integrity_hash | string | false | - | This is a sha256 hash of your FlutterwaveCheckout values, it is used for passing secured values to the payment gateway.
172+
| paymentOptions | `PaymentOptionsEnum[]` | false | - |This specifies the payment options to be displayed e.g - card, mobilemoney, ussd and so on.
173+
| payment_plan | string | false | - | This is the payment plan ID used for Recurring billing
174+
| subaccounts | `RaveSubAcccount[]` | false | - |This is an array of objects containing the subaccount IDs to split the payment into. Check our Split Payment page for more info
175+
| redirect_url | string | false | - | URL to redirect to when a transaction is completed. This is useful for 3DSecure payments so we can redirect your customer back to a custom page you want to show them.
176+
| customer | RaveCustomer | true | - | This is an object that can contains your customer details: e.g: `{ 'email': 'example@example.com', 'phonenumber': '08012345678', 'name': 'Takeshi Kovacs'}`
177+
| meta | `{[key: string]: any}` | false | - | This is an object that helps you include additional payment information to your request `{'consumer_id': 23,'consumer_mac': '92a3-912ba-1192a'}`
178+
| customizations | `RaveCustomization` | true | - | This is an object that contains title, logo, and description you want to display on the modal e.g `{'title': 'Pied Piper Payments', 'description': 'Middleout isn't free. Pay the price', 'logo': 'https://assets.piedpiper.com/logo.png'}`
179+
| init | `() => void` | false | - | A function to be called when payment is about to begin
180+
| onclose | function() | false | - | A function to be called when the pay modal is closed before a transaction is completed.
181+
| callback | (res: RavePaymentData) => void | true | - | A function to be called on successful card charge. Users can always be redirected to a successful or failed page supplied by the merchant here based on response.
182+
183+
> You can get more information from [rave's documentation](https://flutterwavedevelopers.readme.io/)
184+
> Type definitions can be found [here](./projects/angular-rave/src/lib/rave-options.ts)
199185
200186
## CONTRIBUTING
201187

@@ -213,9 +199,17 @@ Two projects exist in this repository
213199
### Demo
214200
- To serve this project run `npm start`/`ng serve`.
215201
- This project makes use of the [built package](./tsconfig.json#L23) from the `angular-rave` library for quick testing and real-life debugging. So it's **important** to initially run `npm run build`/`ng build` before serving this project
216-
- To build this project, run `npm run build angular-rave-lib`. After building, a [post build script](./scripts/copy-web-build.js) moves the built files to the `docs` folder for GitHub Pages.
202+
- To build this project, run `npm run build angular-rave-lib`. The compiled files are built to the `docs` folder for GitHub Pages.
217203
- This project is also served on github pages at https://ashinzekene.github.io/angular-rave/
218204

205+
## Release
206+
- Checkout to a new release branch `release/new-version` eg `release/3.0.0`
207+
- cd into `projects/angular-rave`
208+
- Run `npm version patch|minor|major`
209+
- cd into the main directory and run `npm build`
210+
- Run `git add . && git commit -m new-version`
211+
- Run `git tag -a new-version "release notes..."`
212+
- cd into `dist/angular-rave` and run `npm publish`
219213

220214
Thanks!
221215
Ashinze Ekene.

projects/angular-rave/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-rave",
3-
"version": "2.0.1",
3+
"version": "3.0.0",
44
"peerDependencies": {
55
"@angular/common": "^8.0.3",
66
"@angular/core": "^8.0.3"

0 commit comments

Comments
 (0)