-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(connector): [GETNET] Add cards payment flow #7256
base: main
Are you sure you want to change the base?
Conversation
cd21e86
to
58287c6
Compare
1cb32da
to
58287c6
Compare
2088440
to
b00b6c1
Compare
b00b6c1
to
7f30d78
Compare
Please update the |
@@ -1248,8 +1248,7 @@ pub fn create_webhook_url( | |||
merchant_connector_id_or_connector_name: &str, | |||
) -> String { | |||
format!( | |||
"{}/webhooks/{}/{}", | |||
router_base_url, | |||
"https://3489-110-227-219-118.ngrok-free.app/webhooks/{}/{}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this.
Err(errors::ConnectorError::NotImplemented("get_url method".to_string()).into()) | ||
let auth = getnet::GetnetAuthType::try_from(&req.connector_auth_type) | ||
.change_context(errors::ConnectorError::FailedToObtainAuthType)?; | ||
let id = auth.merchant_id; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let id = auth.merchant_id; | |
let merchant_id = auth.merchant_id; |
@@ -150,6 +166,22 @@ impl ConnectorCommon for Getnet { | |||
|
|||
impl ConnectorValidation for Getnet { | |||
//TODO: implement functions when support enabled | |||
fn validate_connector_against_payment_request( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove TODO comment from the PR
#[serde(rename = "first-name")] | ||
pub first_name: Secret<String>, | ||
#[serde(rename = "last-name")] | ||
pub last_name: Secret<String>, | ||
pub email: Email, | ||
pub phone: Option<Secret<String>>, | ||
pub address: Address, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add these fields to crates/router/src/configs/defaults/payment_connector_required_fields.rs
if they are mandatory.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added
0dcf5f7
to
7e93823
Compare
7e93823
to
57c029f
Compare
[getnet] | ||
[[getnet.credit]] | ||
payment_method_type = "Mastercard" | ||
[[getnet.credit]] | ||
payment_method_type = "Visa" | ||
[[getnet.credit]] | ||
payment_method_type = "Interac" | ||
[[getnet.credit]] | ||
payment_method_type = "AmericanExpress" | ||
[[getnet.credit]] | ||
payment_method_type = "JCB" | ||
[[getnet.credit]] | ||
payment_method_type = "DinersClub" | ||
[[getnet.credit]] | ||
payment_method_type = "Discover" | ||
[[getnet.credit]] | ||
payment_method_type = "CartesBancaires" | ||
[[getnet.credit]] | ||
payment_method_type = "UnionPay" | ||
[[getnet.credit]] | ||
payment_method_type = "Rupay" | ||
[[getnet.credit]] | ||
payment_method_type = "Maestro" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only credit is added? What about debit cards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Getnet documentation lists only creditcard
as payment method. Ref: https://docs.getneteurope.com/PaymentMethods.html
@@ -388,6 +388,7 @@ pub trait ConnectorActions: Connector { | |||
payment_data: Option<types::RefundsData>, | |||
payment_info: Option<PaymentInfo>, | |||
) -> Result<types::RefundSyncRouterData, Report<ConnectorError>> { | |||
println!("$$$ in rsync {:?} ", payment_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this
enums::CaptureMethod::Automatic | ||
| enums::CaptureMethod::Manual | ||
| enums::CaptureMethod::ManualMultiple => Ok(()), | ||
enums::CaptureMethod::Scheduled | enums::CaptureMethod::SequentialAutomatic => Err( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add SequentialAutomatic
whenever Automatic
is available and SequentialAutomatic
is not implemented
match capture_method { | ||
enums::CaptureMethod::Automatic | ||
| enums::CaptureMethod::Manual | ||
| enums::CaptureMethod::ManualMultiple => Ok(()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is manual multiple implemented?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sequentialAutomatic and ManualMultiple got interchanged here mistakenly, Corrected
common: HashMap::from( | ||
[ | ||
( | ||
"payment_method_data.card.card_number".to_string(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is email and first_name, last_name not added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These fields are optional for Getnet
}; | ||
let capture_method = &item.request.capture_method; | ||
let transaction_type = match capture_method { | ||
Some(CaptureMethod::Automatic) => GetnetTransactionType::VoidCapture, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You cannot void a auto capture request from hyperswitch as it has already been captured.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be VoidPurchase. Corrected.
let transaction_type = match capture_method { | ||
Some(CaptureMethod::Automatic) => GetnetTransactionType::VoidCapture, | ||
Some(CaptureMethod::Manual) => GetnetTransactionType::VoidAuthorization, | ||
Some(CaptureMethod::ManualMultiple) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If ManualMultiple is supported as a capture method why is not supported in void?
#[serde(rename = "card-token")] | ||
pub card_token: CardToken, | ||
#[serde(rename = "ip-address")] | ||
pub ip_address: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub ip_address: String, | |
pub ip_address: Secret<String>, |
#[derive(Serialize, Deserialize, Debug)] | ||
pub struct GetnetWebhookNotificationResponse { | ||
#[serde(rename = "response-signature-base64")] | ||
pub response_signature_base64: String, | ||
#[serde(rename = "response-signature-algorithm")] | ||
pub response_signature_algorithm: String, | ||
#[serde(rename = "response-base64")] | ||
pub response_base64: String, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do these fields contain any sensitive info? If yes, we should make them secret.
#[serde(rename = "card-token")] | ||
pub card_token: CardToken, | ||
#[serde(rename = "ip-address")] | ||
pub ip_address: String, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pub ip_address: String, | |
pub ip_address: Secret<String>, |
9954194
to
8a826ab
Compare
90fe160
to
417909b
Compare
#[derive(Debug, Clone, Serialize, Deserialize)] | ||
pub struct GetnetPaymentsResponse { | ||
status: GetnetPaymentStatus, | ||
id: String, | ||
payment: PaymentResponseData, | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We also need to handle webhooks
response in GetnetPaymentsResponse
REFER: AdyenPaymentResponse
Type of Change
Description
Additional Changes
Motivation and Context
https://github.com/juspay/hyperswitch-cloud/issues/8445
How did you test it?
Response
Response
Response
Response
Refund
Response
Void
Response
PSync
Response
RSync
Response
Checklist
cargo +nightly fmt --all
cargo clippy