Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Feature Request : Performing Donations ( Ability to store donation transaction in Talwa-api ) #755

Closed
SiddheshKukade opened this issue Aug 29, 2022 · 1 comment · Fixed by #756
Assignees

Comments

@SiddheshKukade
Copy link
Member

SiddheshKukade commented Aug 29, 2022

This Issue is associated with Google Summer of Code 2022 Project link

Is your feature request related to a problem? Please describe.
Ability to perform donations from talawa app and store them in the database using talawa API

Describe the solution you'd like


Changes are still under review of mentors (there might be some changes in the current description)


Donation API in Talawa-api

User in oraganization can perform donations as per thier choice and amount .

Donations can be performed only through the talawa app and will be stored in the server once it is verified with the PayPal API

Org Admins can see those donations on the dashboard page of the talawa-admin web portal

Here’s how the donation model as a transaction would look like

Donation Model

{
_id : OBJECT_ID, // Transaction Id 
userId : OBJECT_ID //(of the current logged in user)
orgId : OBJECT_ID // id of the org to which it is being donated 
payPalId : OBJECT_ID // Transaction Id from paypal API 
nameOfUser: String // name of the user
amount: Int // amount of donation
}

Mutations and Query for Donations

Queries

  1. getDonations GraphQL Query to get the list of Donation Transactions
query getDonationTest {
  getDonations {
    _id
    payPalId
    nameOfUser
    amount
    userId
  }
}
  1. getDonationById GraphQL Query to get the of Donation Transaction that matches with the Id provided as parameter
query getDonationByIdTest {
    getDonationById(id:"630f15eaa89c4129d256bc56"){
    _id
    payPalId
    nameOfUser
    amount
    userId
   }
}
  1. getDonationsByOrgId It returns the transactions that only matches with the organization Id (it will take an Organization id as a parameter)
query getDonationByOrgIdTest {
  getDonationByOrgId(orgId:"62cfcd6333bbe266f59644db"){
        payPalId,
	_id,
	name,
	amount
  }
}

Mutations

  1. createDonation GraphQL Mutation to add a new transaction only if it is successful.
mutation { 
createDonation(
            userId :"62ccd63293bbe266f59644db"
            orgId :"62cfcd6333bbe266f59644db",
            nameOfOrg:"John Doe Org",
            nameOfUser:" Sam",
            payPalId:"randomPaypalId"
            amount :24.3
      ){
            _id,
	    name,
	    amount,
	    payPalId
      }
}
 
  1. deleteDonationById Mutation to delete a donation by providing its ID as parameter will return object containing a result in a property called success if true then deleted else if false then deletion is failed.
mutation { 
createDonation(
            userId :"62ccd63293bbe266f59644db"
            orgId :"62cfcd6333bbe266f59644db",
            nameOfOrg:"John Doe Org",
            nameOfUser:" Sam",
            payPalId:"randomPaypalId"
            amount :24.3
      ){
            _id,
	    name,
	    amount,
	    payPalId
      }
}
 

Describe alternatives you've considered
Improvements can be suggested by mentors

Approach to be followed (optional)
We have to create model and graphQL queries for the above things

Additional context
Not Needed but will be added soon as the implementation continues

@SiddheshKukade
Copy link
Member Author

@palisadoes Sir I would like to work on this issue.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
2 participants