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

Revert "2.0.0-beta2 release" #11

Merged
merged 1 commit into from
Aug 23, 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
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

Binary file modified Docs/MobilePaymentsSDK_DocC.zip
Binary file not shown.
8 changes: 6 additions & 2 deletions MockReaderUI.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
Pod::Spec.new do |s|
s.name = 'MockReaderUI'
s.version = '2.0.0-beta2'
s.version = '2.0.0-beta1'
s.license = {:type=>"Square Developer License", :text=>"Copyright (c) 2020-present, Square, Inc. All rights reserved.\n\nYour use of this software is subject to the Square Developer Terms of\nService (https://squareup.com/legal/developers). This copyright notice shall\nbe included in all copies or substantial portions of the software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"}
s.homepage = 'https://github.com/square/mobile-payments-sdk-ios'
s.authors = 'Square'
s.summary = 'Enables developers to build use mock readers for testing the MobilePaymentsSDK'

s.ios.deployment_target = '15.0'

s.source ={ :http => "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/MockReaderUI_b854a2f0e98b.zip" }
s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git" , :tag => "2.0.0-beta1" }

s.vendored_frameworks = 'MockReaderUI.xcframework'
s.prepare_command = <<-CMD
unzip XCFrameworks/MockReaderUI_6432c60c8568.zip
CMD

end
6 changes: 2 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ let package = Package(
targets: [
.binaryTarget(
name: "SquareMobilePaymentsSDK",
url: "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/SquareMobilePaymentsSDK_b854a2f0e98b.zip",
checksum: "0b7b6244183048b49cc8d392e6127bb5cf59bfc23de23b2715db7b51146fab15"
path: "XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip"
),
.binaryTarget(
name: "MockReaderUI",
url: "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/MockReaderUI_b854a2f0e98b.zip",
checksum: "4e22f18fe259e2e490d04f2c2e422415188469aae06185f6268dc9ded353707e"
path: "XCFrameworks/MockReaderUI_6432c60c8568.zip"
),
]
)
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Install with [Swift Package Manager](https://www.swift.org/documentation/package

1. Select `File > Add Package Dependencies...`.
2. Enter the repository URL: `https://github.com/square/mobile-payments-sdk-ios`.
3. Select the `Exact Version` dependency rule and specify the version as `2.0.0-beta2`.
3. Select the `Exact Version` dependency rule and specify the version as `2.0.0-beta1`.
4. Ensure the `SquareMobilePaymentsSDK` product is added to your target.

Optionally, you can also add the `MockReaderUI` product to your target to simulate a physical reader when one is not present in a sandbox environment.
Expand All @@ -29,11 +29,11 @@ Install with [CocoaPods](http://cocoapods.org/) by adding the following to your
```
use_frameworks!

pod "SquareMobilePaymentsSDK", "~> 2.0.0-beta2"
pod "SquareMobilePaymentsSDK", "~> 2.0.0-beta1"

# Optionally include MockReaderUI if you wish to simulate a physical reader when one is not present.
# This feature is only available when provided a sandbox application ID.
pod "MockReaderUI", "~> 2.0.0-beta2", configurations: ['Debug']
pod "MockReaderUI", "~> 2.0.0-beta1", configurations: ['Debug']
```
_Note that MockReaderUI framework **requires** the `SquareMobilePaymentsSDK` framework to also be present in your `Podfile`._

Expand Down
5 changes: 2 additions & 3 deletions Scripts/sdk_constants.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
module SquareMobilePaymentsSDK
VERSION = '2.0.0-beta2'
COMMIT_SHA = 'b854a2f0e98b'
CLOUDFRONT_DOMAIN = 'd3eygymyzkbhx3.cloudfront.net'
VERSION = '2.0.0-beta1'
COMMIT_SHA = '6432c60c8568'
LICENSE_TYPE = 'Square Developer License'
LICENSE_TEXT = <<-LICENSE
Copyright (c) 2020-present, Square, Inc. All rights reserved.
Expand Down
57 changes: 1 addition & 56 deletions Scripts/sdk_utilities.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
require 'erb'
require 'fileutils'
require 'open3'
require 'net/http'
require 'uri'
require 'digest'

class TemplateBuilder
def initialize(version, commit_sha, license, homepage_url, authors, ios_deployment_target, cloudfront_domain)
def initialize(version, commit_sha, license, homepage_url, authors, ios_deployment_target)
@version = version
@commit_sha = commit_sha
@license = license
@homepage_url = homepage_url
@authors = authors
@ios_deployment_target = ios_deployment_target
@cloudfront_domain = cloudfront_domain
@sdk_checksum, @mock_reader_checksum = checksums(@cloudfront_domain, @version, @commit_sha)
end

def build_and_write(template_path, file_name, output_dir)
Expand All @@ -25,10 +20,6 @@ def build_and_write(template_path, file_name, output_dir)
file.write(result)
end
end

def checksums(cloudfront_domain, version, commit_sha)
SdkDownloader.download_and_return_checksum(cloudfront_domain, version, commit_sha)
end
end

class CommandExecutor
Expand All @@ -52,49 +43,3 @@ def self.compare(file1_path, file2_path)
return true
end
end

class SdkDownloader
class << self
def download_and_return_checksum(cloudfront_domain, version, commit_sha)
sdk_url = "https://#{cloudfront_domain}/mpsdk/#{version}/SquareMobilePaymentsSDK_#{commit_sha}.zip"
mock_reader_url = "https://#{cloudfront_domain}/mpsdk/#{version}/MockReaderUI_#{commit_sha}.zip"

self.http_download(sdk_url)
file_content = File.read("t.zip", mode: 'rb')
sdk_hash = Digest::SHA256.hexdigest(file_content)
puts "SHA-256 hash: #{sdk_hash}"

self.http_download(mock_reader_url)
file_content = File.read("t.zip", mode: 'rb')
mock_reader_hash = Digest::SHA256.hexdigest(file_content)
puts "SHA-256 hash: #{mock_reader_hash}"

FileUtils.rm("t.zip")

[sdk_hash, mock_reader_hash]
end

def http_download(uri, filename: "t.zip")
url = URI.parse(uri)
progress = 0
Net::HTTP.start(url.host, url.port, use_ssl: true) do |http|
response_for_size = http.request_head(url)
size = response_for_size['content-length'].to_f

puts "Starting download: #{uri}"
http.request_get(url.path) do |response|
# This here is only so we can show some progress, files are heavy
open(filename, 'w') do |f|
response.read_body do |chunk|
f.write chunk
progress += chunk.length
printf("\rDownloaded: %.2f%%", 100*(progress/size))
end
end

end
end
puts "\nDownload Complete"
end
end
end
8 changes: 4 additions & 4 deletions Scripts/sdk_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def self.validate_podspecs
# Runs pod spec lint validation
command = "pod spec lint"
stdout, stderr = CommandExecutor.execute(command)
stdout.scan(/^(\w+)/).flatten

# Validates output
unless stdout.include?("All the specs passed validation.")
Expand All @@ -27,10 +28,10 @@ def self.validate_spm_package
# Resolves all packages in Package.swift
command = "swift package resolve"
_stdout, stderr = CommandExecutor.execute(command)
any_errors = stderr.scan("error").flatten
stderr.scan(/^(\w+)/).flatten

# Validates output of resolve does not have errors.
unless any_errors.nil? || any_errors.empty?
unless stderr.nil? || stderr.empty?
puts "❌ SPM Package could not be validated"
puts stderr
return false
Expand Down Expand Up @@ -67,8 +68,7 @@ def self.validate_template_files
SquareMobilePaymentsSDK::LICENSE,
SquareMobilePaymentsSDK::HOMEPAGE_URL,
SquareMobilePaymentsSDK::AUTHORS,
SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET,
SquareMobilePaymentsSDK::CLOUDFRONT_DOMAIN
SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET
)

files_to_test = [
Expand Down
6 changes: 5 additions & 1 deletion Scripts/templates/MockReaderUI.podspec.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Pod::Spec.new do |s|

s.ios.deployment_target = '<%= @ios_deployment_target %>'

s.source ={ :http => "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/MockReaderUI_<%= @commit_sha %>.zip" }
s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git" , :tag => "<%= @version %>" }

s.vendored_frameworks = 'MockReaderUI.xcframework'
s.prepare_command = <<-CMD
unzip XCFrameworks/MockReaderUI_<%= @commit_sha %>.zip
CMD

end
6 changes: 2 additions & 4 deletions Scripts/templates/Package.swift.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ let package = Package(
targets: [
.binaryTarget(
name: "SquareMobilePaymentsSDK",
url: "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip",
checksum: "<%= @sdk_checksum %>"
path: "XCFrameworks/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip"
),
.binaryTarget(
name: "MockReaderUI",
url: "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/MockReaderUI_<%= @commit_sha %>.zip",
checksum: "<%= @mock_reader_checksum %>"
path: "XCFrameworks/MockReaderUI_<%= @commit_sha %>.zip"
),
]
)
6 changes: 5 additions & 1 deletion Scripts/templates/SquareMobilePaymentsSDK.podspec.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Pod::Spec.new do |s|

s.ios.deployment_target = '<%= @ios_deployment_target %>'

s.source ={ :http => "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip" }
s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git", :tag => "<%= @version %>" }

s.vendored_frameworks = 'SquareMobilePaymentsSDK.xcframework'
s.prepare_command = <<-CMD
unzip XCFrameworks/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip
CMD

end
5 changes: 2 additions & 3 deletions Scripts/update-sdk-version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
SquareMobilePaymentsSDK::LICENSE,
SquareMobilePaymentsSDK::HOMEPAGE_URL,
SquareMobilePaymentsSDK::AUTHORS,
SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET,
SquareMobilePaymentsSDK::CLOUDFRONT_DOMAIN
SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET
)

# Generate README
Expand All @@ -25,4 +24,4 @@

# Generate Package.swift
template_builder.build_and_write('./Scripts/templates/Package.swift.erb', 'Package.swift', './')
puts "✅ Updated Package.swift"
puts "✅ Updated Package.swift"
8 changes: 6 additions & 2 deletions SquareMobilePaymentsSDK.podspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
Pod::Spec.new do |s|
s.name = 'SquareMobilePaymentsSDK'
s.version = '2.0.0-beta2'
s.version = '2.0.0-beta1'
s.license = {:type=>"Square Developer License", :text=>"Copyright (c) 2020-present, Square, Inc. All rights reserved.\n\nYour use of this software is subject to the Square Developer Terms of\nService (https://squareup.com/legal/developers). This copyright notice shall\nbe included in all copies or substantial portions of the software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"}
s.homepage = 'https://github.com/square/mobile-payments-sdk-ios'
s.authors = 'Square'
s.summary = 'Enables developers to build secure in-person payment solutions'

s.ios.deployment_target = '15.0'

s.source ={ :http => "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/SquareMobilePaymentsSDK_b854a2f0e98b.zip" }
s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git", :tag => "2.0.0-beta1" }

s.vendored_frameworks = 'SquareMobilePaymentsSDK.xcframework'
s.prepare_command = <<-CMD
unzip XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip
CMD

end
Binary file added XCFrameworks/MockReaderUI_6432c60c8568.zip
Binary file not shown.
Binary file not shown.
Loading