Skip to content

Add Wallet Type with the connection in User Type#69

Merged
rainerdema merged 8 commits intomasterfrom
rainerd/41-wallet-connection-in-user-type
Mar 13, 2020
Merged

Add Wallet Type with the connection in User Type#69
rainerdema merged 8 commits intomasterfrom
rainerd/41-wallet-connection-in-user-type

Conversation

@rainerdema
Copy link
Copy Markdown
Contributor

@rainerdema rainerdema commented Jan 24, 2020

Quick Info

Issue Schema updates New type
#41 👍 👍
  • Add PaymentMethod Type:
  • Add CreditCard Type:
  • Add PaymentSource Interface:
    • Adds the PaymentSource interface with the common Payment Source fields. And implements the interface in the type that represents the default Solidus Payment Source (Spree::CreditCard);
  • Add WalletPaymentSource Type:
  • Add WalletPaymentSource connection in User Type:
    • The wallet connection field, which returns the wallet payment sources associated to the current user. The method that represents this field is wallet_payment_sources.
  • Make the gem configurable externally

@rainerdema rainerdema self-assigned this Jan 24, 2020
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch 3 times, most recently from 4b47222 to 589429c Compare January 24, 2020 16:10
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch 9 times, most recently from e803240 to 6b90eab Compare February 21, 2020 13:14
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch 6 times, most recently from 00ca460 to c0da8c8 Compare February 28, 2020 09:57
@rainerdema rainerdema marked this pull request as ready for review February 28, 2020 10:10
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch 8 times, most recently from 11e1627 to f659120 Compare March 6, 2020 13:00
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch 2 times, most recently from 50d8d9d to 206dc4e Compare March 6, 2020 15:11
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch from 206dc4e to 5b3f64b Compare March 6, 2020 15:25
It adds the `PaymentMethod` type, based on `Spree::PaymentMethod`.
It adds the `CreditCard` type, based on `Spree::CreditCard`.
By adding `attr_accessor` instance variables in the `Configuration`
class, it's possible to insert configurations through the `configure`
method that uses `yield`.
In this way, it's not necessary to initialize the attribute but it's
possible to set it externally.

Ex.
```
SolidusGraphqlApi.configure do |config|
  config.foo = 'bar'
end
```
It adds the `PaymentSource` interface with the common
Payment Source fields.
And implements the interface in the type that represents
the default Solidus Payment Source (Spree::CreditCard).

For more information about the implementation of
the interfaces:
https://github.com/rmosolgo/graphql-ruby/blob/90474a965062820673c0c596ec0e55236b83dfd2/guides/type_definitions/interfaces.md
It's necessary to allow to set the payment sources externally.

In this way, when is need to add a new payment method, simply:
1) Add the new type that implements the
   `Types::Interfaces::PaymentSource` interface;
2) Add the new type to the configuration.
It adds the `WalletPaymentSource` type, based on `Spree::WalletPaymentSource`.
The `payment_source` field is indicated through the
`Types::Interfaces::PaymentSource` interface and can represent
any type of payment source.
It adds the `wallet` connection field, which returns the
wallet payment sources associated to the current user.
Using command "bundle exec rake schema:idl"
@rainerdema rainerdema force-pushed the rainerd/41-wallet-connection-in-user-type branch from 5b3f64b to e58bdf7 Compare March 13, 2020 10:53
Copy link
Copy Markdown
Contributor

@AlessioRocco AlessioRocco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😼

Copy link
Copy Markdown
Contributor

@ChristianRimondi ChristianRimondi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔝

@rainerdema rainerdema merged commit 65ae8b2 into master Mar 13, 2020
@rainerdema rainerdema deleted the rainerd/41-wallet-connection-in-user-type branch March 13, 2020 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants