Skip to content

feat(service): Migrate b2c, b2b to the builder pattern#112

Open
itsyaasir wants to merge 1 commit intomasterfrom
feat/migrate-b2b-b2c
Open

feat(service): Migrate b2c, b2b to the builder pattern#112
itsyaasir wants to merge 1 commit intomasterfrom
feat/migrate-b2b-b2c

Conversation

@itsyaasir
Copy link
Copy Markdown
Collaborator

No description provided.

@itsyaasir itsyaasir mentioned this pull request Jul 8, 2024
7 tasks
@itsyaasir itsyaasir requested review from c12i and crispinkoech July 8, 2024 15:33
@itsyaasir itsyaasir self-assigned this Jul 8, 2024
Comment thread src/services/b2b.rs
pub party_a: String,
pub sender_identifier_type: IdentifierTypes,
pub party_b: String,
#[serde(rename(serialize = "RecieverIdentifierType"))]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Do we still need this inner rename if he outer struct has the rename_all="PascalCase" attribute?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Funny things, there is a typo in the receiver so I am renaming the single field and same fields can't parse the way it the API expects like ResultURL

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hehehe yeah, always has to be safaricom with the inconsistent API/docs.

Comment thread src/services/b2b.rs
pub queue_time_out_url: Url,
#[serde(rename = "ResultURL")]
pub result_url: Url,
#[serde(rename = "AccountReference")]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same for the AccountReference...

Comment thread src/services/b2b.rs
skip_serializing_if = "Option::is_none"
)]
account_reference: Option<&'mpesa str>,
pub reciever_identifier_type: IdentifierTypes,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Following from the comment above, I guess we can then rename this struct field to have the correct english naming like so:

Suggested change
pub reciever_identifier_type: IdentifierTypes,
pub receiver_identifier_type: IdentifierTypes,

Copy link
Copy Markdown
Collaborator

@crispinkoech crispinkoech Jul 12, 2024

Choose a reason for hiding this comment

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

...but it might be desirable to keep the same as the typo that mpesa api uses. Up to you

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.

2 participants