Skip to content

Commit

Permalink
Merge Development Into Main (#10)
Browse files Browse the repository at this point in the history
* chore: Include swiftlint

* feat: Plugin init + Setup Configurations (#1)

Initialise plugin with required structure.
Create structure to deal with Apple Pay. Despite being ready to deal with any kind of dictionary, provide an accelerator to read the configuration from the main bundle.
Add Nimble and Quick through Cocoapods to use BDD for unit testing.

* feat: Check Wallet and Payment Availability (#2)

Add verification for wallet and payment availability. Payment verification is enhanced by also checking it against the configured payment networks and supported capabilities.

* feat: Set Details and Trigger Payment (#3)

Configure the missing payment details and, by mixing it with the configuration info, trigger the payment request.

* refactor: Add DocC documentation and minor fixes. (#4)

Add DocC documentation.
Add empty value check and mandatory fields when fetching configuration properties.

* fix: Payment Setup Verification Failed on Invalid Configuration (#5)

Fix error when verifying payment setup on ReadyToPay method. If some payment network or merchant capabilities are missing, return the associated error.

* fix: Errors and Contact Management (#6)

Clean errors and its codes and messages accordingly.
New OSPMTContact struct that allows the management of the correct shipping and billing information to use on a payment request. This is required due to a limitation on OutSystems related with nullable lists.
Change the OSPMTConfigurationDelegate to OSPMTConfigurationModel, in order to comply with the new OutSystems structure.
Clean code (privatise local methods and make OSPMTPayment's delegate property weak, in order to avoid possible retain cycles).

* fix: Check if GivenName and FamilyName are empty (#7)

* chore: Add Unreleased Section

* Chore: Add Podspec (#9)

* refactor: Simply Generic Method

* chore: Add public podspec

Add public podspec. This implies also updating the readme.md file to something more descriptive and user-friendly.
  • Loading branch information
OS-ricardomoreirasilva committed Apr 11, 2024
1 parent abd7296 commit c96c06e
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 28 deletions.
9 changes: 0 additions & 9 deletions OSPaymentsLib/Models/OSPMTConfigurationModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,6 @@ class OSPMTApplePayConfiguration: OSPMTConfigurationModel {
// MARK: Billing Information
let billingSupportedContacts: [String]? = Self.getProperty(forSource: source, andKey: ConfigurationKeys.billingSupportedContacts)

// MARK: Payment Service Provider Information
var gatewayModel: OSPMTGatewayModel?
if let providerGateway: [String: Any] = Self.getProperty(forSource: source, andKey: ConfigurationKeys.paymentGateway),
let providerGatewayName = providerGateway[ConfigurationKeys.paymentGatewayName] as? String,
let requestURL = providerGateway[ConfigurationKeys.paymentRequestURL] as? String {
let publishableKey = providerGateway[ConfigurationKeys.stripePublishableKey] as? String
gatewayModel = OSPMTGatewayModel(gateway: providerGatewayName, publishableKey: publishableKey, requestURL: requestURL)
}

self.init(
merchantID: merchantID,
merchantName: merchantName,
Expand Down
10 changes: 4 additions & 6 deletions OSPaymentsLib/OSPMTPayments.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,13 @@ extension OSPMTPayments: OSPMTActionDelegate {
}
}

/// Sets payment details and triggers the request process.
/// - Parameters:
/// - details: Payment details model serialized into a text field.
/// - accessToken: Authorisation token related with a full payment type.
public func set(_ details: String, and accessToken: String?) {
/// Sets payment details and triggers the request proccess.
/// - Parameter details: Payment details model serialized into a text field.
public func set(_ details: String) {
let detailsResult = self.decode(details)
switch detailsResult {
case .success(let detailsModel):
self.handler.set(detailsModel, and: accessToken) { [weak self] result in
self.handler.set(detailsModel) { [weak self] result in
guard let self = self else { return }
switch result {
case .success(let scopeModel):
Expand Down
1 change: 0 additions & 1 deletion OSPaymentsPluginLib.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,4 @@ Pod::Spec.new do |s|
s.swift_versions = '5.0'

s.source_files = 'OSPaymentsLib/**/*.swift'
s.dependency 'StripePayments', '23.2.0'
end
11 changes: 1 addition & 10 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,7 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## 1.1.0

### 2023-01-05
- Feat: Add access token to Full Payment Process (https://outsystemsrd.atlassian.net/browse/RMET-2147).

### 2022-12-12
- Feat: Add Payment Service Provider property to `OSPMTDetailsModel` struct (https://outsystemsrd.atlassian.net/browse/RMET-2095).

### 2022-12-02
- Feat: Add Stripe as Payment Service Provider (https://outsystemsrd.atlassian.net/browse/RMET-2078).
## [Unreleased]

### 2022-11-14
- Add `podspec` file.
Expand Down
3 changes: 1 addition & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ The method's success is returned through a `OSPMTCallbackDelegate` call. Success
### Set Details and Trigger Payment

```swift
func set(_ details: String, and: accessToken: String?)
func set(_ details: String)
```

Sets payment details and triggers the request proccess. The method contains the following parameter:
- `details`: Payment details model serialized into a text field. This model can be checked in the `OSPMTDetailsModel` structure.
- `accessToken`: Authorisation token related with a full payment type. Can be empty, which should be the case for custom payments.

The method's success is returned through a `OSPMTCallbackDelegate` call. Success operations returns an object of the structure type `OSPMTScopeModel`, encoded in a UTF-8 string. An `OSPMTError` error is returned in case of error.

0 comments on commit c96c06e

Please sign in to comment.