Skip to content

Commit 225493b

Browse files
fix(payment-service): fix issues in payment service
fix issues in payment service GH-2138
1 parent b69cda1 commit 225493b

File tree

12 files changed

+8604
-6014
lines changed

12 files changed

+8604
-6014
lines changed

package-lock.json

Lines changed: 8235 additions & 5958 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/payment-service/README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ any client application.
1616
- Users can seamlessly integrate PayPal for payment transactions.
1717
- The microservice supports Stripe as a preferred payment gateway option.
1818
- Razorpay integration is also available for users seeking diverse payment methods.
19+
1920
## Installation
2021

2122
```bash
@@ -41,12 +42,10 @@ npm i @sourceloop/payment-service
4142
- Bind any of the custom [providers](#providers) you need.
4243
- **Using Paypal payment Gateway**
4344
Bind the PayPalHelper and PayPalConfig as shown below
45+
4446
```typescript
4547
//import Providers
46-
import {
47-
PayPalBindings,
48-
PaypalProvider
49-
} from 'payment-service/dist/providers';
48+
import {PayPalBindings, PaypalProvider} from 'payment-service/dist/providers';
5049
//Bind the providers
5150
this.bind(PayPalBindings.PayPalHelper.key).toProvider(PaypalProvider);
5251
this.bind(PayPalBindings.PayPalConfig).to({
@@ -56,23 +55,19 @@ npm i @sourceloop/payment-service
5655
```
5756

5857
- **Using Stripe payment Gateway**
59-
Bind the StripeHelper and Config as shown below
60-
58+
Bind the StripeHelper and Config as shown below
6159

6260
```typescript
6361
//import Providers
64-
import {
65-
StripeBindings,
66-
StripeProvider,
67-
} from 'payment-service/dist/providers';
62+
import {StripeBindings, StripeProvider} from 'payment-service/dist/providers';
6863
//Bind the providers
6964
this.bind(StripeBindings.Config).to({dataKey: '', publishKey: ''});
7065
this.bind(StripeBindings.StripeHelper).toProvider(StripeProvider);
7166
```
7267

7368
- **Using RazorPay payment Gateway**
7469
Bind the RazorPayHelper and RazorPayConfig as shown below
75-
70+
7671
```typescript
7772
//import Providers
7873
import {
@@ -183,6 +178,7 @@ JWT_ISSUER=https://authentication.service
183178
| `DB_SCHEMA` | Y | `public` | Database schema used for the data source. In PostgreSQL, this will be `public` unless a schema is made explicitly for the service. |
184179
| `JWT_SECRET` | Y | | Symmetric signing key of the JWT token. |
185180
| `JWT_ISSUER` | Y | | Issuer of the JWT token. |
181+
186182
### Providers
187183

188184
You can find documentation for some of the providers available in this service [here](./src/providers/README.md)
@@ -227,6 +223,10 @@ Create a payment gateway.
227223

228224
Create an order and initiate transaction for the selected payment gateway, this will create order and initiate payment process.
229225

226+
##### POST /transactions/charge
227+
228+
The transactionscharge endpoint handles incoming charge requests. It extracts the order ID from the request, calls the charge helper method of selected payment gateway,and redirects the user to a success or failure URL based on the charge outcome.
229+
230230
##### POST /orders
231231

232232
Creating orders manually.

services/payment-service/openapi.json

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,11 @@
731731
"tags": [
732732
"TransactionsController"
733733
],
734+
"security": [
735+
{
736+
"HTTPBearer": []
737+
}
738+
],
734739
"responses": {
735740
"302": {
736741
"description": "Order model instance",
@@ -739,11 +744,12 @@
739744
}
740745
}
741746
},
747+
"description": "\n\n| Permissions |\n| ------- |\n| CreateOrder |\n| 6 |\n",
742748
"requestBody": {
743749
"content": {
744750
"application/json": {
745751
"schema": {
746-
"type": "object"
752+
"$ref": "#/components/schemas/NewMessage"
747753
}
748754
}
749755
}
@@ -758,6 +764,11 @@
758764
"tags": [
759765
"SubscriptionTransactionsController"
760766
],
767+
"security": [
768+
{
769+
"HTTPBearer": []
770+
}
771+
],
761772
"responses": {
762773
"200": {
763774
"description": "Subscription model instance",
@@ -766,6 +777,7 @@
766777
}
767778
}
768779
},
780+
"description": "\n\n| Permissions |\n| ------- |\n| UpdateTransaction |\n| 20 |\n",
769781
"requestBody": {
770782
"content": {
771783
"application/x-www-form-urlencoded": {
@@ -1445,6 +1457,11 @@
14451457
"tags": [
14461458
"TransactionsController"
14471459
],
1460+
"security": [
1461+
{
1462+
"HTTPBearer": []
1463+
}
1464+
],
14481465
"responses": {
14491466
"200": {
14501467
"description": "Transacttion Gateway Request",
@@ -1453,6 +1470,7 @@
14531470
}
14541471
}
14551472
},
1473+
"description": "\n\n| Permissions |\n| ------- |\n| CreateTransaction |\n| 18 |\n",
14561474
"requestBody": {
14571475
"content": {
14581476
"application/x-www-form-urlencoded": {
@@ -1516,6 +1534,11 @@
15161534
"tags": [
15171535
"TransactionsController"
15181536
],
1537+
"security": [
1538+
{
1539+
"HTTPBearer": []
1540+
}
1541+
],
15191542
"responses": {
15201543
"200": {
15211544
"description": "HTML response for payment gateway interface.",
@@ -1528,6 +1551,7 @@
15281551
}
15291552
}
15301553
},
1554+
"description": "\n\n| Permissions |\n| ------- |\n| CreateOrder |\n| 6 |\n",
15311555
"parameters": [
15321556
{
15331557
"name": "id",
@@ -1548,6 +1572,11 @@
15481572
"tags": [
15491573
"TransactionsController"
15501574
],
1575+
"security": [
1576+
{
1577+
"HTTPBearer": []
1578+
}
1579+
],
15511580
"responses": {
15521581
"200": {
15531582
"description": "Refund Object from payment gateway",
@@ -1576,6 +1605,11 @@
15761605
"tags": [
15771606
"TransactionsController"
15781607
],
1608+
"security": [
1609+
{
1610+
"HTTPBearer": []
1611+
}
1612+
],
15791613
"responses": {
15801614
"200": {
15811615
"description": "Refund Object from payment gateway",
@@ -1604,6 +1638,11 @@
16041638
"tags": [
16051639
"TransactionSubscriptionsController"
16061640
],
1641+
"security": [
1642+
{
1643+
"HTTPBearer": []
1644+
}
1645+
],
16071646
"responses": {
16081647
"302": {
16091648
"description": "Array of Transactions model instances",
@@ -1616,6 +1655,7 @@
16161655
}
16171656
}
16181657
},
1658+
"description": "\n\n| Permissions |\n| ------- |\n| UpdateSubscriptions |\n| 4 |\n",
16191659
"parameters": [
16201660
{
16211661
"name": "id",
@@ -2238,6 +2278,39 @@
22382278
"additionalProperties": false,
22392279
"x-typescript-type": "Partial<Transactions>"
22402280
},
2281+
"NewMessage": {
2282+
"title": "NewMessage",
2283+
"type": "object",
2284+
"description": "(tsType: Omit<Orders, 'id'>, schemaOptions: { title: 'NewMessage', exclude: [ 'id' ] })",
2285+
"properties": {
2286+
"totalAmount": {
2287+
"type": "number"
2288+
},
2289+
"currency": {
2290+
"type": "string"
2291+
},
2292+
"status": {
2293+
"type": "string"
2294+
},
2295+
"paymentGatewayId": {
2296+
"type": "string"
2297+
},
2298+
"paymentmethod": {
2299+
"type": "string"
2300+
},
2301+
"metaData": {
2302+
"type": "object"
2303+
}
2304+
},
2305+
"required": [
2306+
"totalAmount",
2307+
"currency",
2308+
"status",
2309+
"paymentGatewayId"
2310+
],
2311+
"additionalProperties": false,
2312+
"x-typescript-type": "Omit<Orders, 'id'>"
2313+
},
22412314
"PaymentGateways": {
22422315
"title": "PaymentGateways",
22432316
"type": "object",

0 commit comments

Comments
 (0)