Skip to content
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

Develop #4

Merged
merged 4 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## [0.0.1](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v0.0.6...v0.0.1) (2024-09-02)

### Bug Fixes

* fix: update version script to actually set the version ([9193d60c4e3f3160ef628c8e093573394a802bc4](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/9193d60c4e3f3160ef628c8e093573394a802bc4))

### Features

* feat: add apple pay transformer and tests ([110182da3735202d0d3ee2b6bde2f57739221d49](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/commit/110182da3735202d0d3ee2b6bde2f57739221d49))

## [0.0.1](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v0.0.5...v0.0.1) (2024-08-29)

## [0.0.1](https://github.com/PAYONE-GmbH/PCP-ServerSDK-ruby/compare/v0.0.4...v0.0.1) (2024-08-28)
Expand Down
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Welcome to the Ruby SDK for the PAYONE Commerce Platform! This repository contai
## Installation

```sh
gem install PCP-server-Ruby-SDK
gem install pcp-server-ruby-sdk
```

**[back to top](#table-of-contents)**
Expand All @@ -60,12 +60,12 @@ communicator_configuration = PCPServerSDK::CommunicatorConfiguration.new(
)
```

With the configuration you can create an API client for each reource you want to interact with. For example to create a commerce case you can use the `PCPServerSDK::Endpoints::`.
With the configuration you can create an API client for each reource you want to interact with. For example to create a commerce case you can use the `PCPServerSDK::Endpoints::CommerceCaseApiClient`.

```rb
require 'pcp-server-ruby-sdk'

client = PCPServerSDK::Endpoints::.new(communicator_configuration)
client = PCPServerSDK::Endpoints::CommerceCaseApiClient.new(communicator_configuration)
```

All payloads and reponses are availabe as ruby classes within the `pcp-server-ruby-sdk` package. The serialization and deserialization is handled by the SDK internally. For example, to create an empty commerce case you can pass a `PCPServerSDK::Models::CreateCommerceCaseRequest` instance:
Expand All @@ -92,12 +92,14 @@ For most [payment methods](https://docs.payone.com/pcp/commerce-platform-payment

### Apple Pay

When a client is successfully made a payment via ApplePay it receives a [ApplePayPayment](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment). This structure is accessible as the `ApplePayPayment` class. You can use the `ApplePayTransformer` to map an `ApplePayPayment` to a `MobilePaymentMethodSpecificInput` which can be used for payment executions or order requests. The transformer has a static method `transformApplePayPaymentToMobilePaymentMethodSpecificInput()` which takes an `ApplePayPayment` and returns a `MobilePaymentMethodSpecificInput`. The transformer does not check if the response is complete, if anything is missing the field will be set to `null`.
When a client is successfully made a payment via ApplePay it receives a [ApplePayPayment](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypayment). This structure is accessible as the `PCPServerSDK::Models::ApplePayPayment` class. You can use the `PCPServerSDK::Transformer::ApplePayTransformer` to map an `PCPServerSDK::Models::ApplePayPayment` to a `PCPServerSDK::Models::MobilePaymentMethodSpecificInput` which can be used for payment executions or order requests. The transformer has a static method `PCPServerSDK::Transformer::transformApplePayPaymentToMobilePaymentMethodSpecificInput` which takes an `PCPServerSDK::Models::ApplePayPayment` and returns a `PCPServerSDK::Models::MobilePaymentMethodSpecificInput`. The transformer does not check if the response is complete, if anything is missing the field will be set to `null`.

```rb
require 'pcp-server-ruby-sdk'

# TODO
payment = PCPServerSDK::Models::ApplePayPayment.new(get_json_string_from_request_somehow)
# input is of type PCPServerSDK::Models::MobilePaymentMethodSpecificInput
input = PCPServerSDK::Transformer::transformApplePayPaymentToMobilePaymentMethodSpecificInput(payment)
```

**[back to top](#table-of-contents)**
Expand Down
2 changes: 1 addition & 1 deletion lib/PCP-server-Ruby-SDK/utils/server_meta_info.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ServerMetaInfo

def initialize(integrator = '')
@platform_identifier = "#{RbConfig::CONFIG['host_os']}, ruby version is: #{RUBY_VERSION}"
@sdk_identifier = 'RubyServerSDK/v1.0.0' # Adjust version as needed
@sdk_identifier = "RubyServerSDK/v#{PCPServerSDK::VERSION}" # Adjust version as needed
@sdk_creator = 'PAYONE GmbH'
@integrator = integrator
end
Expand Down
2 changes: 1 addition & 1 deletion lib/PCP-server-Ruby-SDK/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

module PCPServerSDK
VERSION = '0.0.6'
VERSION = '1.0.0'
end
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.